Community
Participate
Working Groups
org.eclipse.core.jobs Error Sun May 12 12:41:56 PDT 2019 An internal error occurred during: "Java Search". java.lang.ClassCastException: class org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding cannot be cast to class org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding (org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding and org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @5f9f1886) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.detectHierarchyCycle(ClassScope.java:1322) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.detectHierarchyCycle(ClassScope.java:1279) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.detectHierarchyCycle(ClassScope.java:1205) at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:73) at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:514) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:624) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:620) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:592) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1337) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:962) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1123) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectMemberTypes(ClassScope.java:930) at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1132) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:361) at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:507) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1311) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1377) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1496) at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:112) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:250) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:595) at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:670) at org.eclipse.jdt.internal.ui.search.JavaSearchQuery.run(JavaSearchQuery.java:178) at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:95) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Can you please provide steps to reproduce?
- Placed cursor on method name - Invoked Cmd+Shift+G (Search for references) The project is closed source. Thus, I cannot copy/paste the code here. The method was in a class without any special hierarchy, i.e. didn't extend any other class or implemented an interface.
What was the project JDK version configured and what was the runtime JDK? 9+?
Java 11 in both cases
C'mon Gunnar, you know we need more information :) Eg.: which Eclipse build? Any chance that somewhere in your project you have code vaguely similar to this? //-- class C<T> { class B implements T { } } //-- any compile errors?
(In reply to Stephan Herrmann from comment #5) > Eg.: which Eclipse build? 4.12 as selected in Bugzille. 2019-03 official release. If it's a special build I'd have probably not reported it. :) > Any chance that somewhere in your project you have code vaguely similar to > this? > //-- > class C<T> { > class B implements T { > } > } > //-- Well, not exactly sure but yes, lots of Generics when I ran into this. > any compile errors? Likely. This is a large code base I was looking into. Thus, that's why is hard to extract a reproducible test. It's a CCE. Probably something unexpected was returned. I suggest enhancing code like this with additional log/exception output for your analysis. This might help reporting these issues easier instead of throwing CCE to users.
(In reply to Gunnar Wagenknecht from comment #6) > (In reply to Stephan Herrmann from comment #5) > > Any chance that somewhere in your project you have code vaguely similar to > > this? > > //-- > > class C<T> { > > class B implements T { > > } > > } > > //-- > > Well, not exactly sure but yes, lots of Generics when I ran into this. To be specific: the stack trace seems to imply that some type tried to declare a supertype using a type variable. This is plain wrong and you may expect all kinds of breakage if you try to further analyse / search such code. Note, that the compiler has no place that it can possibly log to.
I am also seeing this with latest Eclipse and Java 11 project.
(In reply to Robert Ross from comment #8) > I am also seeing this with latest Eclipse and Java 11 project. So we have one more candidate who could possibly provide a reproducing example. I'm all ears.
The best I can provide right now is a stack trace. Creating a "reproducing example" would require someone to know what is causing the issue to begin with. Eclipse is a complicated collection of plugins, so I couldn't even be sure that your baseline test environment is the same as mine without essentially figuring out the root cause. I simply don't have the time to do that. However, I can confirm that this isn't an isolated incident. When this occurs, it appears to corrupt the search index so that subsequent calls to search for Java references return 0 results all the time. In order to even get the error again, I need to close out Eclipse, wipe out everything in .metadata\.plugins\org.eclipse.jdt.core and then restart Eclipse. I can then do a search for references again and get the exact same error stack reported by Gunnar.
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.