Summary: | [1.5][compiler] Ambiguous conversion from generic to parameterized/raw type confuses Eclipse's way of resolving unresolved binary references | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Tobias Riemenschneider <tobys> | ||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | daniel_megert, kent_johnson, martinae | ||||
Version: | 3.2 | ||||||
Target Milestone: | 3.2 RC4 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Tobias Riemenschneider
2006-05-08 10:24:09 EDT
Reproduced with RC3. When compiled from source, the parameter to Worker.method(Outer.Inner) is a RAW type [Inner#RAW enclosingType Outer#RAW] and the message send's argument is a ParameterizedType [ExtendedInner extends Inner enclosing type : ExtendedOuter<E>] But when Worker is picked up a class file, the method's parameter becomes a ParameterizedType [Inner enclosingType Outer<O>]. The problem appears to be in LookupEnvironment.convertToRawType() +1 for 3.2RC4 Added regression test: GenericTypeTest#test0981 (disabled) Kent suggested addressing it with following change on LookupEnvironment: ReferenceBinding getTypeFromCompoundName(char[][] compoundName, boolean isParameterized) { ReferenceBinding binding = getCachedType(compoundName); if (binding == null) { PackageBinding packageBinding = computePackageFrom(compoundName); binding = new UnresolvedReferenceBinding(compoundName, packageBinding); packageBinding.addType(binding); } else if (binding == TheNotFoundType) { problemReporter.isClassPathCorrect(compoundName, null); return null; // will not get here since the above error aborts the compilation } else if (!isParameterized) { // check raw type, only for resolved types binding = (ReferenceBinding)convertUnresolvedBinaryToRawType(binding); } return binding; } Post 3.2, we should revisit the separation between #convertToRawType and #convertUnresolvedBinaryToRawType. Should be only one, doing the latter; and implicit member references should be dealt with differently. But this is more extensive. Created attachment 41090 [details]
Proposed patch
This is the minimal patch, which is mirroring what we do in other cases in similar situations. Just missed one sender.
Without the patch, we reject valid code.
Dani/Martin: pls cast your vote
Also added: GenericTypeTest#test0982 Patch looks good. Approving for 3.2 RC4. +1 for 3.2 RC4 Fix released Verified with I20060511-2000 for 3.2RC4 |