Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 235809

Summary: [compiler] wrong resolution for X.this involving an extending inner class
Product: [Eclipse Project] JDT Reporter: Maxime Daniel <maxime_daniel>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, philippe_mulet
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug

Description Maxime Daniel CLA 2008-06-05 08:31:58 EDT
I20080604-2000

Eclipse behaves differently than javac on InnerEmulationTest#87.
Namely, it links X.this to X$1N in the following test case, instead of X, as javac does and JLS3 ยง15.8.4 demands:
public class X {
	public static void main(String[] arguments) {
		new X().f();
	}
    void f () {
        class C {
          C() {
            System.out.println("["+X.this.getClass().getName()+"]");	
          }
        }
        class N extends X {
            { new C(); }	
        }
        new N();
    }	
}

Talked to Philippe and we believe this is a bug. Added an excuse to the test for now (should align with javac when this bug is fixed).
Comment 1 Philipe Mulet CLA 2008-06-05 09:04:54 EDT
From testing, javac 1.3.1 behaved like us (i.e. print [X$1$N]). From 1.4 on, it will print [X]
Comment 2 Philipe Mulet CLA 2008-06-05 10:04:31 EDT
Problem comes from the generation of inner emulation for "{ new C(); }" which allows compatible match (i.e. 'this' is compatible with X).
Comment 3 Eclipse Genie CLA 2020-04-24 01:41:56 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.