groovy / groovy-eclipse

Eclipse Groovy Development Tools
656 stars 193 forks source link

Workspace search breaks when running on openjdk-10 #582

Closed papegaaij closed 6 years ago

papegaaij commented 6 years ago

Any java Search in Eclipse fails when eclipse is running on openjdk-10 with the stacktrace below. I'm running Eclipse 4.7.3a with groovy-eclipse 3.0.0.xx-201804302107-e47.

java.lang.NoClassDefFoundError: Unable to load class org.codehaus.groovy.runtime.DateGroovyMethods due to missing dependency java/sql/Date
    at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:429)
    at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:360)
    at org.codehaus.groovy.ast.ClassNode.getDeclaredMethods(ClassNode.java:972)
    at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:987)
    at org.eclipse.jdt.groovy.search.CategoryTypeLookup.lookupType(CategoryTypeLookup.java:56)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.lookupExpressionType(TypeInferencingVisitorWithRequestor.java:2476)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.handleSimpleExpression(TypeInferencingVisitorWithRequestor.java:1992)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstantExpression(TypeInferencingVisitorWithRequestor.java:1127)
    at org.codehaus.groovy.ast.expr.ConstantExpression.visit(ConstantExpression.java:85)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitPropertyExpression(TypeInferencingVisitorWithRequestor.java:1663)
    at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:57)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:328)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitListExpression(CodeVisitorSupport.java:236)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitListExpression(TypeInferencingVisitorWithRequestor.java:1411)
    at org.codehaus.groovy.ast.expr.ListExpression.visit(ListExpression.java:64)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitAnnotation(ClassCodeVisitorSupport.java:118)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitAnnotation(TypeInferencingVisitorWithRequestor.java:819)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitAnnotations(ClassCodeVisitorSupport.java:112)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitAnnotations(ClassCodeVisitorSupport.java:97)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitConstructorOrMethod(TypeInferencingVisitorWithRequestor.java:1212)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:520)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitJDT(TypeInferencingVisitorWithRequestor.java:393)
    at org.eclipse.jdt.groovy.search.TypeInferencingVisitorWithRequestor.visitCompilationUnit(TypeInferencingVisitorWithRequestor.java:357)
    at org.codehaus.jdt.groovy.integration.internal.GroovyLanguageSupport.maybePerformDelegatedSearch(GroovyLanguageSupport.java:236)
    at org.codehaus.jdt.groovy.integration.LanguageSupportFactory.maybePerformDelegatedSearch(LanguageSupportFactory.java:114)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1267)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1389)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1521)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:122)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:236)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:583)
    at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:608)
    at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:175)
    at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:92)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
eclipse.buildId=4.7.3.M20180330-0640
java.version=10.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -data file:/home/papegaaij/workspaces-4.6/fabric/ -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
eric-milles commented 6 years ago

GroovyClassLoader used does not yet support modulepath entries. For reference, here is the translation of project's classpath and modulepath to class loaders: https://github.com/groovy/groovy-eclipse/blob/master/base/org.eclipse.jdt.groovy.core/src/org/codehaus/jdt/groovy/internal/compiler/GroovyClassLoaderFactory.java

chrylis commented 6 years ago

I'm having the same problem on JDK 9. Is there any workaround?

eric-milles commented 6 years ago

The workaround is to use Java 8 for the Eclipse runtime. You will still be able to develop project's that target Java 9+.

eric-milles commented 6 years ago

This should be resolved now. Could you please retest with the latest snapshot?

papegaaij commented 6 years ago

Running on Eclipse Photon 4.8.0 with Groovy Eclipse 3.0.0.xx-201807031944-e48 on openjdk-10.0.1 I can confirm I no longer get the stacktrace.