Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eclipse 4.6.1 hangs sometimes during code proposal #223

Closed
wagnerma opened this issue Nov 10, 2016 · 14 comments
Closed

Eclipse 4.6.1 hangs sometimes during code proposal #223

wagnerma opened this issue Nov 10, 2016 · 14 comments

Comments

@wagnerma
Copy link

First, thanks for your work! Sure, I also installed the newest version and I observe sometimes a complete hang of eclipse (4.6.1) during code proposals. Hope the following stack trace helps:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(Unknown Source) at org.codehaus.groovy.eclipse.quickfix.proposals.AddClassCastResolver$AddClassCastProposal.calculateTypeName(AddClassCastResolver.java:90) at org.codehaus.groovy.eclipse.quickfix.proposals.AddClassCastResolver$AddClassCastProposal.<init>(AddClassCastResolver.java:60) at org.codehaus.groovy.eclipse.quickfix.proposals.AddClassCastResolver.getQuickFixProposals(AddClassCastResolver.java:43) at org.codehaus.groovy.eclipse.quickfix.processors.GroovyQuickFixProcessor.getCorrections(GroovyQuickFixProcessor.java:73) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:384) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:344) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:339) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:474) at org.eclipse.jdt.internal.ui.text.java.hover.ProblemHover$ProblemInfo.getJavaAnnotationFixes(ProblemHover.java:102) at org.eclipse.jdt.internal.ui.text.java.hover.ProblemHover$ProblemInfo.getCompletionProposals(ProblemHover.java:76) at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.deferredCreateContent(AbstractAnnotationHover.java:287) at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.setInput(AbstractAnnotationHover.java:187) at org.eclipse.jface.text.AbstractInformationControlManager.internalShowInformationControl(AbstractInformationControlManager.java:1194) at org.eclipse.jface.text.AbstractInformationControlManager.presentInformation(AbstractInformationControlManager.java:1163) at org.eclipse.jface.text.AbstractHoverInformationControlManager.presentInformation(AbstractHoverInformationControlManager.java:894) at org.eclipse.jface.text.TextViewerHoverManager.doPresentInformation(TextViewerHoverManager.java:244) at org.eclipse.jface.text.TextViewerHoverManager$5.run(TextViewerHoverManager.java:234) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4203) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3819) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 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:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) at org.eclipse.equinox.launcher.Main.main(Main.java:1492)

@eric-milles
Copy link
Member

This is where the exception comes from:

        private String calculateTypeName() {
            String message = getQuickFixProblemContext().getProblemDescriptor().getMarkerMessages()[0];
            String name = message.substring(message.lastIndexOf(" ") + 1);

Would you happen to have the text of the problem marker you are trying to run the quick-fix on?

@wagnerma
Copy link
Author

I try to reproduce it, at the moment without success. I will report all exceptions I get. Another one:

java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at org.codehaus.groovy.eclipse.dsl.pointcuts.impl.FilteringPointcut.filterResult(FilteringPointcut.java:71) at org.codehaus.groovy.eclipse.dsl.pointcuts.impl.FilteringPointcut.matches(FilteringPointcut.java:59) at org.codehaus.groovy.eclipse.dsl.pointcuts.AbstractPointcut.matchOnPointcutArgument(AbstractPointcut.java:119) at org.codehaus.groovy.eclipse.dsl.pointcuts.impl.FilteringPointcut.matches(FilteringPointcut.java:57) at org.codehaus.groovy.eclipse.dsl.pointcuts.AbstractPointcut.matchOnPointcutArgument(AbstractPointcut.java:119) at org.codehaus.groovy.eclipse.dsl.pointcuts.impl.CurrentTypePointcut.matches(CurrentTypePointcut.java:61) at org.codehaus.groovy.eclipse.dsl.DSLDStore.findContributions(DSLDStore.java:132) at org.codehaus.groovy.eclipse.dsl.lookup.DSLDTypeLookup.lookupTypeAndDeclaration(DSLDTypeLookup.java:84) at org.eclipse.jdt.groovy.search.AbstractSimplifiedTypeLookup.lookupType(AbstractSimplifiedTypeLookup.java:133) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.lookupExpressionType(TypeInferencingVisitorWithRequestor.java:2033) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:2002) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstantExpression(TypeInferencingVisitorWithRequestor.java:1433) at org.codehaus.groovy.ast.expr.ConstantExpression.visit(ConstantExpression.java:83) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitMethodCallExpression(TypeInferencingVisitorWithRequestor.java:1606) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:278) at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:183) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitTupleExpression(TypeInferencingVisitorWithRequestor.java:1887) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitArgumentlistExpression(TypeInferencingVisitorWithRequestor.java:939) at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:76) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitMethodCallExpression(TypeInferencingVisitorWithRequestor.java:1625) at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66) at org.codehaus.groovy.ast.CodeVisitorSupport.visitBooleanExpression(CodeVisitorSupport.java:171) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitBooleanExpression(TypeInferencingVisitorWithRequestor.java:1169) at org.codehaus.groovy.ast.expr.BooleanExpression.visit(BooleanExpression.java:42) at org.codehaus.groovy.ast.CodeVisitorSupport.visitAssertStatement(CodeVisitorSupport.java:82) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitAssertStatement(ClassCodeVisitorSupport.java:246) at org.codehaus.groovy.ast.stmt.AssertStatement.visit(AssertStatement.java:50) at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:40) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:251) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitBlockStatement(TypeInferencingVisitorWithRequestor.java:1367) at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:148) at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:159) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstructorOrMethod(TypeInferencingVisitorWithRequestor.java:814) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:565) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:395) at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitCompilationUnit(TypeInferencingVisitorWithRequestor.java:350) at org.codehaus.groovy.eclipse.search.GroovyOccurrencesFinder.internalFindOccurences(GroovyOccurrencesFinder.java:180) at org.codehaus.groovy.eclipse.search.GroovyOccurrencesFinder.getOccurrences(GroovyOccurrencesFinder.java:102) at org.codehaus.groovy.eclipse.editor.GroovyEditor.updateOccurrenceAnnotations(GroovyEditor.java:1249) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$6.selectionChanged(JavaEditor.java:3364) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:182) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:158) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

@eric-milles
Copy link
Member

eric-milles commented Nov 11, 2016

That's the problem with DSLDStore that comes up from time to time. I tried to protect the maps, but they contain lists that are not synchronized. I may get old-school and use Hashtable<String, Vector>. Otherwise, the interface needs to be refactored so that these lookups and additions are properly synchronized.

@wagnerma
Copy link
Author

Another problem exists, when working with multiple opened groovy files containing errors, then you get unlimited exceptions clicking in the editor window:

`eclipse.buildId=4.6.1.M20160907-1200
java.version=1.8.0_112
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -clean

org.eclipse.core.jobs
Error
Mon Nov 14 11:02:18 CET 2016
An internal error occurred during: "Requesting Java AST from selection".

java.lang.StringIndexOutOfBoundsException: String index out of range: -19
at java.lang.String.substring(Unknown Source)
at org.codehaus.groovy.eclipse.codebrowsing.requestor.ASTNodeFinder.visitClass(ASTNodeFinder.java:124)
at org.codehaus.groovy.eclipse.codebrowsing.requestor.ASTNodeFinder.visitClass(ASTNodeFinder.java:205)
at org.codehaus.groovy.eclipse.codebrowsing.requestor.ASTNodeFinder.doVisit(ASTNodeFinder.java:77)
at org.codehaus.groovy.eclipse.codebrowsing.requestor.CodeSelectHelper.findNodeForRegion(CodeSelectHelper.java:172)
at org.codehaus.groovy.eclipse.codebrowsing.requestor.CodeSelectHelper.selectASTNode(CodeSelectHelper.java:100)
at org.codehaus.groovy.eclipse.search.GroovyOccurrencesFinder.initialize(GroovyOccurrencesFinder.java:221)
at org.codehaus.groovy.eclipse.editor.GroovyEditor.updateOccurrenceAnnotations(GroovyEditor.java:1248)
at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$6.selectionChanged(JavaEditor.java:3364)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:182)
at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:158)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
`

@eric-milles
Copy link
Member

Would you mind sending just the class declaration line of the open file or files when this happens? ASTNodeFinder is trying to look after the class name or its last generic type and before the opening {. In this example, the code hover may be on SomethingElse or SomeInterface, but they don't always have source location information.

public class Something extends SomethingElse implements SomeInterface {

@wagnerma
Copy link
Author

Sure the Groovy class:

@CompileStatic public class SvBoDocNewImpl extends SvBoDocNewImplBase {

And the Base Java Class:

public abstract class SvBoDocNewImplBase extends ServiceBase<de.effectivecompany.app.doc.service.SvBoDocNew> implements de.effectivecompany.app.doc.service.SvBoDocNew

And the interface:

@net.bull.javamelody.MonitoredWithSpring @Transactional(readOnly = true, propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) public interface SvBoDocNew

@wagnerma
Copy link
Author

...and the ServiceBase is:

public abstract class ServiceBase<S>

@eric-milles
Copy link
Member

Thanks. Could you try changing SvBoDocNew to an import to see if it makes a difference? I think the generics part is where the code is braking down.

@wagnerma
Copy link
Author

..well, strange I can't reproduce it any more, with or without the import... but a colleague has the problem, with and without the import...strange, I will verify with the newest build and a clean Eclipse setup..

One cosmetic thing, if you start Eclipse with opened groovy files, the g Icon in the editor tap is displayed, activating the editor tap, the g changes to j, like Java files.

@eric-milles
Copy link
Member

You mentioned this last error happened when you had syntax or compile errors. Can you recall where in the class the error was and what editing action you were taking when the error came?

@wagnerma
Copy link
Author

At the moment, I can't reproduce it any more, but colleagues will try...

Another compile error I have from time to time:

`
@CompileStatic
public class FrBoDoc extends EFCFrTd {

private static final long serialVersionUID = -1L;	

`
Then the -1L is a compile error:
The literal -1L of type long is out of range

@wagnerma
Copy link
Author

Has something to do with the CompileStatic annotation, removing it, the error disappears. But other classes with the same structure have no problems with this combination, only this one.
Hmmm, making a compile error in the FrBoDoc class with the long error, all classes referencing the error FrBoDoc will also get the type long is out of range error and correctly the references of the FrBoDoc class are marked error.

@eric-milles
Copy link
Member

Are you using the latest 2.9.2 snapshot? Number literals with a leading + or - required a fix for source position and this is likely why the literal is improperly formed.

@wagnerma
Copy link
Author

No, indeed the latest build fixes it. Thanks!

Please close this bug report, I will open a new one, when I find a new reproduceable one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants