Bug 27235

Summary: Bug with assignement with no effect mask
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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.