Bug 187329

Summary: compilation error constants created with static methods
Product: [Eclipse Project] JDT Reporter: Nihal Sinha <nocturnal0wl>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann
Version: 3.3Flags: Olivier_Thomann: review+
Target Milestone: 3.3 RC1   
Hardware: PC   
OS: Windows XP   
URL: http://rapidshare.com/files/31660356/ConstantCompilationBug.zip.html
Whiteboard:
Attachments:
Description Flags
Eclipse project to reproduce the bug
none
Proposed patch
none
Update patch none

Description Nihal Sinha CLA 2007-05-16 13:37:57 EDT
Take a look at the Eclipse project I've zipped and uploaded to the URL given (File > Import > Existing Projects Into Workspace > Archive file).  I receive a compilation error for a constant (public static final class variable) that is (1) referred to in another class, and (2) is initialized to its value using a static method (imported using a static import).

I believe this has something to do with the order in which classes are built (see attached code).  I've been getting around this bug by changing the source file, and re-saving it.  That appears to fix it temporarily.  Doing a clean build causes the error to reappear.

I'm using Eclipse 3.3 M7 (Version: 3.3.0, Build id: I20070418-1012) with a Sun 1.5.0 compiler.
Comment 1 Nihal Sinha CLA 2007-05-16 13:45:47 EDT
Created attachment 67466 [details]
Eclipse project to reproduce the bug
Comment 2 Olivier Thomann CLA 2007-05-16 14:17:24 EDT
Kent,

Could you please have a look? This is an ordering issue in the full build.
Recompiling only Foo fixes the compile error, but it is back on a new full build.
Comment 3 Kent Johnson CLA 2007-05-16 15:29:16 EDT
Created attachment 67495 [details]
Proposed patch
Comment 4 Kent Johnson CLA 2007-05-16 15:47:34 EDT
Created attachment 67500 [details]
Update patch

Found another place where we access static imports possibly before they're resolved
Comment 5 Olivier Thomann CLA 2007-05-16 15:50:16 EDT
+1.
Comment 6 Kent Johnson CLA 2007-05-16 16:50:40 EDT
Released into HEAD for 3.3RC1
Comment 7 Olivier Thomann CLA 2007-05-17 10:30:23 EDT
Verified for 3.3RC1 with I20070516-1800.