Bug 190391 - ECJ: Constructors can initialize other instance's final fields instead of their own
Summary: ECJ: Constructors can initialize other instance's final fields instead of the...
Status: RESOLVED DUPLICATE of bug 151787
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.3 M7   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-31 21:54 EDT by Adrian Mettler CLA
Modified: 2007-06-01 04:20 EDT (History)
0 users

See Also:


Attachments
a class that can break DA/DU as implemented in ECJ (697 bytes, text/plain)
2007-05-31 21:57 EDT, Adrian Mettler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Mettler CLA 2007-05-31 21:54:57 EDT
Build ID: M20060921-0945

Steps To Reproduce:
1. Define a class with a final field
2. Give it a constructor which takes an instance of the same class
3. In the constructor, "initialize" the final field belonging to the passed-in instance instead of this.
Or better, just see the attached file.

More information:
A constructor can "initialize" a final field of another instance instead of the field in the instance being created.  The attached program compiles with Eclipse, and allows a final field to be overwritten; Both Sun's javac and gcj refuse to compile it.
Comment 1 Adrian Mettler CLA 2007-05-31 21:57:55 EDT
Created attachment 69648 [details]
a class that can break DA/DU as implemented in ECJ
Comment 2 Philipe Mulet CLA 2007-06-01 04:20:47 EDT
This is a dup of bug 151787, which was addressed for 3.3M7.

A 3.2 patch was issued, pls find it under:
http://www.eclipse.org/jdt/core/r3.2/index.php#UPDATES

or directly get the patch at:
http://www.eclipse.org/jdt/core/patches/org.eclipse.jdt.core_3.2.3.z20070503-1623.jar


*** This bug has been marked as a duplicate of bug 151787 ***