Community
Participate
Working Groups
Using the following snippet as a condition for a breakpoint, you get an exception when the breakpoint is hit "java.lang.IllegalArgumentException: Number of arguments does not match" MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodType type = MethodType.methodType(boolean.class); MethodHandle handle = lookup.findStatic(J7.class, "bool", type); boolean value = (Boolean)handle.invoke(); System.out.println("invoked: "+value); If I make the snippet simpler by calling my own varargs method: void varargs(Object... args) { System.out.println("called varargs"); } as a condition: varargs(); return true; I get the following exception: java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:371) at java.util.ArrayList.get(ArrayList.java:384) at org.eclipse.jdt.core.dom.ASTNode$NodeList.get(ASTNode.java:1225) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.pushMethodArguments(ASTInstructionCompiler.java:2783) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTInstructionCompiler.visit(ASTInstructionCompiler.java:2765) at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:237) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2566) at org.eclipse.jdt.core.dom.ExpressionStatement.accept0(ExpressionStatement.java:144) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2589) at org.eclipse.jdt.core.dom.Block.accept0(Block.java:136) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2566) at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:504) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2589) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:484) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2589) at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:219) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2518) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.createExpressionFromAST(ASTEvaluationEngine.java:448) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:267) at org.eclipse.jdt.internal.debug.core.breakpoints.ConditionalBreakpointHandler.breakpointHit(ConditionalBreakpointHandler.java:198) at org.eclipse.jdt.internal.debug.core.model.JDIThread.handleSuspendForBreakpoint(JDIThread.java:1122) at org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.suspend(JavaBreakpoint.java:363) at org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleBreakpointEvent(JavaBreakpoint.java:351) at org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint.handleEvent(JavaBreakpoint.java:288) at org.eclipse.jdt.internal.debug.core.EventDispatcher.dispatch(EventDispatcher.java:187) at org.eclipse.jdt.internal.debug.core.EventDispatcher.access$0(EventDispatcher.java:104) at org.eclipse.jdt.internal.debug.core.EventDispatcher$1.run(EventDispatcher.java:248) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Created attachment 198863 [details] partial patch This patch fixes up the simple varargs case for the ArrayIndexOutOfBoundsException - we did not properly consider that varargs are '0 or more', so in the case of 0 arguments being passed in we tried to look up argument '-1'.
Tagging this for 3.8. After digging into the JDI / eval code I found this to be a problem with our handling of varargs in general and not an issue with Java 7. Using the snippet + steps from comment #0 will produce the same exceptions / warnings using 1.5 and 1.6 VMs.
Still planned for M2?
(In reply to comment #3) > Still planned for M2? No, the patch is only a partial solution. Moving to M3
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Nothing has changed. Anyone interested in working on the partial patch?