Bug 27235 - Bug with assignement with no effect mask
Summary: Bug with assignement with no effect mask
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-27 09:29 EST by Olivier Thomann CLA
Modified: 2002-12-17 11:49 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2002-11-27 09:29:08 EST
In 1119, we have a way not to generate code for an assignment with no effect.
This is for code like:
class A {
   int i;

   A() {
      i = i;
   }
}

In case of an inner class, we might want to do it anyway:

public class A {
    int i;
    A(int j) {
    	i = j;
    }
    A() {
    }
    class B extends A {
        B() {
            this.i = A.this.i;
        }
    }
    public static void main(String[] args) {
        A a = new A(3);
        System.out.print(a.i + " ");
        System.out.print(a.new B().i);
    }
}

Compile and run and you will end up with:
3 0

instead of:
3 3

Javac returns the proper values.
The bug is that the assignment this.i = A.this.i; is not generated.
Comment 1 Philipe Mulet CLA 2002-11-29 11:31:53 EST
Fixed. Qualified this references are no longer eligible for such a diagnosis.
Comment 2 David Audel CLA 2002-12-17 11:49:36 EST
Verified.