Summary: | Compiler fails to recognize a Map when using J2SE 1.4 compiler settings | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Thomas Watson <tjwatson> | ||||||||||
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||||
Severity: | normal | ||||||||||||
Priority: | P3 | CC: | amj87.iitr, daniel_megert, jarthana, john.arthorne, Olivier_Thomann | ||||||||||
Version: | 3.7 | Flags: | Olivier_Thomann:
review+
|
||||||||||
Target Milestone: | 3.7 M4 | ||||||||||||
Hardware: | PC | ||||||||||||
OS: | Mac OS X - Carbon (unsup.) | ||||||||||||
Whiteboard: | |||||||||||||
Attachments: |
|
Description
Thomas Watson
2010-10-27 09:49:30 EDT
Srikanth, please investigate. This is caused by the fix for bug 324850. Srikanth, I think we now need to "filter" some generic information where we didn't need to in the past. If we cannot "fix" this, we might want to revert bug 324850 for M3 as this is causing grief to OSGI users. Created attachment 181907 [details]
Patch under test
This patch fixes the problem. The automated tests are being run
now. Will update status once done.
Basically, the problem is that with hybrid 1.4/1.5+ projects
modes, while establishing type equivalence, the compiler needs
to be prepared for a type such as Map appearing in one of three
distinct forms:
(a) As a ParameterizedTypeBinding e.g Map<String, String>
(b) As a RawTypeBinding (Map#RAW) and finally
(c) As a BinaryTypeBinding
When the usage of a type lacks type parameters, whether we land
up with the raw form or not depends on whether the underlying type
was "seen to be" a generic type in the particular build environment
or not. So usages of Map in a 1.4 project don't produce a "raw" type,
as Map is not seen to be a generic type in the first place by the
compiler when found in a 1.4 JRE.
Created attachment 181911 [details]
Revised patch under test
Patch that avoids applying erasure prematurely.
Under test.
Created attachment 181920 [details]
Final patch - passes all JDT/Core tests
Same fix as before, with its application tightened.
Olivier, please review, TIA. We probably need a similar fix in org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.isEquivalentTo(TypeBinding) and org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.isEquivalentTo(TypeBinding) but I'll treat that as a separate case from this bug report. I agree with the principle. Just verified that build I20101028-1441 does not have this bug. Will you also update the SourceTypeBinding implementation ? Released in HEAD for 3.7 M4 (In reply to comment #9) > Will you also update the SourceTypeBinding implementation ? Yes, however, I'll follow up on this on a separate defect. (In reply to comment #6) > Olivier, please review, TIA. We probably need a similar fix > in > org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.isEquivalentTo(TypeBinding) > > and > org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.isEquivalentTo(TypeBinding) > > but I'll treat that as a separate case from this bug report. The latter change is necessitated by and handled in the context of the fix for bug 186565 (In reply to comment #11) > The latter change is necessitated by and handled in the context of ^^^^^^^^^^^^^^^^ I meant to say "needed for". Verified for 3.7M4 using build I20101205-2000. |