Community
Participate
Working Groups
I20201006-1800 - Add a breakpoint on line 89 in org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaReferenceCodeMining.doResolve(ITextViewer viewer, IProgressMonitor monitor). - Ctrl-click on a code mining "1 reference" annotation in debug so that the above breakpoint is hit. - Select the entire expression in "if" and press Cmd+Shift+I to inspect. => Inspect popup is not shown and we have a warning in error log about compile error: Compile error during code evaluation: Only the first formal parameter may be declared explicitly as 'this'
At the same line when breakpoint is hit, if you don't select anything and just press Cmd+Shift+I to inspect, we get an error dialog and this exception in error log: Evaluation failed. Reason(s): Index -1 out of bounds for length 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:397) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:468) ... Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0 at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.getCompleteSnippet(EvaluationSourceGenerator.java:145) at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.<init>(EvaluationSourceGenerator.java:70) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:367) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.evaluate(ASTEvaluationEngine.java:149) at org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction$1.run(EvaluateAction.java:261) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Looks like a problem in lambda debugging. I was able to debug this code after converting both lambdas to anonymous classes.
Hi Nooopur, Can you provide a simple sample code to reproduce this error ? It will be easy to debug the jdt with running a simple code example.
(In reply to Noopur Gupta from comment #0) > I20201006-1800 > > - Add a breakpoint on line 89 in > org.eclipse.jdt.internal.ui.javaeditor.codemining.JavaReferenceCodeMining.doResolve(ITextViewer > viewer, IProgressMonitor monitor). I don't think I can provide a simplified code for this as I am seeing the problem here. > - Ctrl-click on a code mining "1 reference" annotation in debug so that the > above breakpoint is hit. package p; public class C { public static void main(String[] args) { new X(); } } class X { } Here, class X has "1 reference" annotation when code minings are enabled. Ctrl+click on that to reproduce the bug.
Is this a regression in 4.18 M1 or also present in 4.17?
Isn’t this reproduced able with a sample code other than using the code mining code as the test bench ?
(In reply to Gayan Perera from comment #6) > Isn’t this reproduced able with a sample code other than using the code > mining code as the test bench ? I haven't tried/seen it with any sample code.
This is not a regression, even 4.16 has the same behaviour. But I get a different error: Evaluation failed. Reason(s): Evaluations must contain either an expression or a block of well-formed statements
i see the same/a similar problem java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:397) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:468) at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:228) at org.eclipse.ui.internal.progress.ProgressManager.lambda$26(ProgressManager.java:821) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:854) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:830) at org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction.run(EvaluateAction.java:279) at org.eclipse.jdt.internal.debug.ui.actions.DisplayAction.run(DisplayAction.java:113) at org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction.run(EvaluateAction.java:597) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:239) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580) at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4439) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4226) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3843) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1461) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0 at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.getCompleteSnippet(EvaluationSourceGenerator.java:145) at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.<init>(EvaluationSourceGenerator.java:70) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:368) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.evaluate(ASTEvaluationEngine.java:150) at org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction$1.run(EvaluateAction.java:261) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122) Root exception: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0 at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.getCompleteSnippet(EvaluationSourceGenerator.java:145) at org.eclipse.jdt.internal.debug.eval.ast.engine.EvaluationSourceGenerator.<init>(EvaluationSourceGenerator.java:70) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.getCompiledExpression(ASTEvaluationEngine.java:368) at org.eclipse.jdt.internal.debug.eval.ast.engine.ASTEvaluationEngine.evaluate(ASTEvaluationEngine.java:150) at org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction$1.run(EvaluateAction.java:261) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
can reliably be reproduced with public static void main(String[] args) throws IOException { EcoreFactory factory = EcoreFactory.eINSTANCE; EcorePackage ecore = EcorePackage.eINSTANCE; EPackage ePackage = factory.createEPackage(); ePackage.setName("mypack"); ePackage.setNsPrefix("mypack"); ePackage.setNsURI("https://www.itemis.de/mypack"); EClass node = factory.createEClass(); node.setName("Node"); EAttribute name = factory.createEAttribute(); and rightklick+inspect after the = i also get this when selecting display on some of the variables but can not relate this reliably yet
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.