Summary: | [5.0][templates] foreach template does not work when an Iterable over a static inner class exists | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Hendrik Maryns <hendrik> | ||||
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | minor | ||||||
Priority: | P3 | CC: | eclipse | ||||
Version: | 3.2 | ||||||
Target Milestone: | 3.3 M5 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Hendrik Maryns
2006-05-05 07:38:47 EDT
Created attachment 40471 [details]
A test class showing the problem
This class file shows the problem.
After much trimming, I found the core of the problem: an iterator over Map.Entry: If you remove 'Map.' from the Iterable statement, it works fine.
Changed the subject, as that really seems to be the problem. The problem seems to be that the supertype hierarchy for the package visible type does not contain the implemented interface. Moving to jdt-core for comments. Given the example code in the attached Java source file, and a super type hierarchy on 'Function' will contain Iterable in its allInterfaces list, but not return Iterable as a super type of Function, nor Function as a sub type of Iterable. I get the following exception in the log: Caused by: org.eclipse.jface.text.Assert$AssertionFailedException: Assertion failed: at org.eclipse.jface.text.Assert.isTrue(Assert.java:188) at org.eclipse.jface.text.Assert.isTrue(Assert.java:173) at org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion$TypeParameterResolver.computeTypeParameterBinding(CompilationUnitCompletion.java:454) at org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion$TypeParameterResolver.computeBinding(CompilationUnitCompletion.java:421) at org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion$TypeParameterResolver.computeBinding(CompilationUnitCompletion.java:399) at org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion$LocalVariable.getMemberTypeSignatures(CompilationUnitCompletion.java:246) at org.eclipse.jdt.internal.corext.template.java.CompilationUnitCompletion$LocalVariable.getMemberTypeNames(CompilationUnitCompletion.java:272) at org.eclipse.jdt.internal.corext.template.java.JavaContextType$AbstractIterableType.resolve(JavaContextType.java:129) at org.eclipse.jface.text.templates.TemplateContextType.resolve(TemplateContextType.java:272) at org.eclipse.jface.text.templates.TemplateContextType.resolve(TemplateContextType.java:239) at org.eclipse.jdt.internal.corext.template.java.JavaContext.evaluate(JavaContext.java:164) at org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateProposal.getAdditionalProposalInfo(TemplateProposal.java:391) at org.eclipse.jface.text.contentassist.AdditionalInfoController$6.run(AdditionalInfoController.java:162) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) ... 20 more Changed HierarchyResolver#findSuperInterfaces(...) to check for '<' before checking for '.' Added regression test TypeHierarchyTests#testGeneric10(). Released for 3.3M5 in HEAD. Verified for 3.3M5 using I20070205-0009. |