Bug 275381

Summary: [1.5][compiler] Missing innerClass attribute for inner types used as type arguments
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: kent_johnson, mlists
Version: 3.5Flags: kent_johnson: review+
Target Milestone: 3.5 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
First draft
none
Proposed fix + regression tests
none
Proposed fix + regression tests none

Description Olivier Thomann CLA 2009-05-07 17:18:33 EDT
In the case an inner types is only used as a type arguments, the compiler doesn't provide the right inner class info for the corresponding entry.
Look at bug 171184 comment 17.
Since this is a spec issue, I think it should be fixed for 3.5.
Comment 1 Olivier Thomann CLA 2009-05-07 17:19:36 EDT
Targetting 3.5RC1 as this is a spec issue.
Comment 2 Ismael Juma CLA 2009-05-07 17:27:01 EDT
Thanks for the quick response Olivier. It would be great to see this fixed for 3.5 indeed.
Comment 3 Olivier Thomann CLA 2009-05-07 17:30:14 EDT
Unless I am missing something obvious, the fix should be trivial.
Comment 4 Olivier Thomann CLA 2009-05-08 13:22:59 EDT
Created attachment 134991 [details]
First draft
Comment 5 Olivier Thomann CLA 2009-05-10 21:15:44 EDT
Created attachment 135088 [details]
Proposed fix + regression tests
Comment 6 Olivier Thomann CLA 2009-05-10 21:16:10 EDT
Kent, please review.
Comment 7 Kent Johnson CLA 2009-05-12 12:03:44 EDT
Consider changing ContainsNestedTypes to ContainsNestedTypeReferences or HasNestedTypeReferences

And could remove duplicate method in MethodBinding by forwarding to Util method, then checking to see if bit on method needs to be set
Comment 8 Olivier Thomann CLA 2009-05-12 14:57:45 EDT
Created attachment 135428 [details]
Proposed fix + regression tests

- Reorganized the code to share the set of visited types through the class file instance.
- Rename the tag bit field.
- Factorized the recording in the Util class only.

Kent, could you please do a quick review ?
Comment 9 Kent Johnson CLA 2009-05-12 15:20:07 EDT
Looks good.

A small issues - the constructor for NestedTypeBinding sets the bit for all instances, so why do we need this test in WildcardBinding.resolve :

if (resolveType.isNestedType()
  || ((resolveType.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {

instead of just :

if ((resolveType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
Comment 10 Olivier Thomann CLA 2009-05-12 15:22:35 EDT
Sure, I'll fix it.
Comment 11 Olivier Thomann CLA 2009-05-12 19:44:19 EDT
Released for 3.5RC1.
Regression tests added in org.eclipse.jdt.core.tests.compiler.regression.InnerEmulationTest_1_5.
Comment 12 Kent Johnson CLA 2009-05-14 11:33:54 EDT
Verified for 3.5RC1 using I20090513-2000