it seems that this bug is linked to the introspection module. I isolated a code that produces on my config a exception, see at end of mail.
- It seems to be a regression, as this code worked finely with the 3/12 version of BaseX.
- It took me a whole day to isolate this exception. This "overhead" is due to the JAVA catch / raising exception BaseX mechanism, letting the user blind with its XQUERY code. As bugs are becoming harder and harder to spot, maybe we should think about a way, or a tool, to easen trace / debug while the interpreter raises a JAVA exception ?
declare function local:map_inspect_functions() { map:new(for $fun in inspect:functions() return map:entry(local:name-function($fun),$fun)) };
declare function local:name-function($fun){fn:data(inspect:function($fun)/@name)};
declare function local:get_void() { function(){ () }};
declare variable $local:MapIntrospecting := local:map_inspect_functions();
let $fun_2 := map:get($local:MapIntrospecting,"local:get_void")
return count($fun_2())
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.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.func.FuncCall.iter(FuncCall.java:57)
at org.basex.query.QueryContext.iter(QueryContext.java:355)
at org.basex.query.func.FNAggr.item(FNAggr.java:36)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46)
at org.basex.query.MainModule.iter(MainModule.java:96)
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)