Bug 275381 - [1.5][compiler] Missing innerClass attribute for inner types used as type arguments
Summary: [1.5][compiler] Missing innerClass attribute for inner types used as type arg...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.5 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-07 17:18 EDT by Olivier Thomann CLA
Modified: 2009-05-14 11:33 EDT (History)
2 users (show)

See Also:
kent_johnson: review+


Attachments
First draft (48.17 KB, patch)
2009-05-08 13:22 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression tests (57.25 KB, patch)
2009-05-10 21:15 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression tests (52.21 KB, patch)
2009-05-12 14:57 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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