Bug 124388 - [DOM AST] Method defaults not resolved
Summary: [DOM AST] Method defaults not resolved
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-18 16:11 EST by Tim Hanson CLA
Modified: 2006-02-14 08:59 EST (History)
1 user (show)

See Also:


Attachments
JUnit test that demonstrate the problem (7.93 KB, patch)
2006-01-18 17:51 EST, Theodora Yeung CLA
no flags Details | Diff
Proposed patch (2.86 KB, patch)
2006-01-26 13:36 EST, Olivier Thomann CLA
no flags Details | Diff
Regression test (2.20 KB, patch)
2006-01-26 13:37 EST, 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 Tim Hanson CLA 2006-01-18 16:11:59 EST
Method defaults for annotation members are not resolved when navigating the dom ast bindings to an annotation type that is in a different file. They are resolved lazily.

Let me know if you need more info.
Comment 1 Philipe Mulet CLA 2006-01-18 17:37:42 EST
Ideally, a testcase (junit) demonstrating the expected behavior would be very nice. 
Comment 2 Philipe Mulet CLA 2006-01-18 17:38:47 EST
Along the same line as making field constants lazily reachable in DOM AST.
Comment 3 Theodora Yeung CLA 2006-01-18 17:51:37 EST
Created attachment 33235 [details]
JUnit test that demonstrate the problem

The attached "patch" does not fix the bug but simply add a test to ParticipantBuildTests.java that demonstrate the problem. 

The new test fails because of an unexpected IProblem reported from a compilation participant. The IProblem complaints about getDefaultValue() returning null when it should have returned an enum constant.
Comment 4 Theodora Yeung CLA 2006-01-19 20:06:39 EST
org.eclipse.jdt.apt.tests.MirrorDeclarationTests.DISABLED_testDefault() needs to be enabled once this bug is fixed.
Comment 5 Olivier Thomann CLA 2006-01-26 13:36:27 EST
Created attachment 33661 [details]
Proposed patch

We might need to check if something needs to be done in:
resolveTypesFor(MethodBinding method) in SourceTypeBinding.
I am not sure about this part.
Comment 6 Olivier Thomann CLA 2006-01-26 13:37:30 EST
Created attachment 33662 [details]
Regression test

New regression test. The default value is not a String. It will be a IVariableBinding in the case of an enum value.
Comment 7 Olivier Thomann CLA 2006-01-26 13:38:01 EST
Kent,

Could you please double check my changes? Meanwhile I will run all the tests.
Comment 8 Olivier Thomann CLA 2006-01-26 15:06:03 EST
Fixed and released in HEAD.
Philippe, please review the changes.
MethodBinding.getDefaultValue()
MethodBinding.setDefaultValue(Object)
added a new TagBits: DefaultValueResolved.

The test case now works once fixed. Wrong type expected for the default value.
Comment 9 Tim Hanson CLA 2006-01-26 16:39:11 EST
The fix looks good to me.
Comment 10 David Audel CLA 2006-02-14 08:59:12 EST
Verified for 3.2 M5 using build I20060214-0010