Note : casewhere, I checked that this issue does not depend upon the values of INLINELIMIT and TAILCALL.


2014/1/6 jean-marc Mercier <jeanmarc.mercier@gmail.com>
Hello,

I have a quite strange behavior, that might be a bug in the introspection module. I am just describing it, and will work a bit to produce a reproductible code if you don't have a quick clue about the problem.

I created a map of string to functions, called $common:MapIntrospecting, generated by the introspection module.

The following code works perfectly (you can't run it, but believe me :)

declare variable $map := map:entry("Alimentation:nodes#1",Alimentation:nodes#1);
declare variable $nodes := a big node...

let $fun_1 := map:get($map,"Alimentation:nodes#1")
let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1")
return $fun_2($nodes)

And now, the following code (I just cut the useless first line) produces a spurious and ferocious exception

let $fun_2 := map:get($common:MapIntrospecting,"Alimentation:nodes#1")
return $fun_2($nodes)

Any clue ?

Improper use? Potential bug? Your feedback is welcome:
Version: BaseX 7.8 beta 132460f
Java: Oracle Corporation, 1.7.0_45
OS: Windows 7, amd64
Stack Trace: 
java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType
at org.basex.query.func.InlineFunc.item(InlineFunc.java:261)
at org.basex.query.func.InlineFunc.value(InlineFunc.java:280)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.var.StaticVar.value(StaticVar.java:129)
at org.basex.query.var.StaticVarRef.value(StaticVarRef.java:58)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFuncCall.evalArgs(StaticFuncCall.java:154)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.expr.List.value(List.java:133)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.value.item.FuncItem.invValue(FuncItem.java:130)
at org.basex.query.func.FuncCall.invoke(FuncCall.java:96)
at org.basex.query.func.FuncCall.value(FuncCall.java:52)
at org.basex.query.QueryContext.value(QueryContext.java:366)
at org.basex.query.MainModule.value(MainModule.java:79)
at org.basex.query.QueryContext.value(QueryContext.java:323)
at org.basex.query.QueryContext.iter(QueryContext.java:309)
at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81)
at org.basex.core.cmd.AQuery.query(AQuery.java:89)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:329)
at org.basex.core.Command.execute(Command.java:94)
at org.basex.server.LocalSession.execute(LocalSession.java:121)
at org.basex.server.Session.execute(Session.java:37)
at org.basex.core.Main.execute(Main.java:146)
at org.basex.BaseX.<init>(BaseX.java:119)
at org.basex.BaseX.main(BaseX.java:38)