Bug 166963 - [compiler] resolve binding for local variable in ConstructorInvocation
Summary: [compiler] resolve binding for local variable in ConstructorInvocation
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 156731 165758
  Show dependency tree
 
Reported: 2006-12-06 10:06 EST by Markus Keller CLA
Modified: 2007-04-27 09:15 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch (4.58 KB, patch)
2007-04-02 05:55 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2006-12-06 10:06:18 EST
I20061205-0800

package test;
public class E1 {
        public E1(String label) {}
        public E1() {
                String s= "foo";
                System.out.println(s);
                this(s);
                System.out.println(s);
        }
}

=> "s" in "this(s)" does not have a binding.
=> Expected: Binding for "s", like in "System.out.println(s)".
Comment 1 Olivier Thomann CLA 2006-12-06 10:39:44 EST
The problem comes from the compiler that doesn't resolve the this(s) call when this is not the first statement of the constructor declaration.
Comment 2 Philipe Mulet CLA 2007-04-02 05:54:03 EDT
Fault-tolerance issue. When ill-positionned, the compiler doesn't resolve subparts of an explicit constructor call, e.g.

public class X {
	public X() {
		System.out.println();
		this(zork);
		Zork.this.this();
		<Zork>this();
	}
}

could diagnose all 'zork' issues.

Added GenericTypeTest#test1120.
Comment 3 Philipe Mulet CLA 2007-04-02 05:55:12 EDT
Created attachment 62641 [details]
Proposed patch
Comment 4 Philipe Mulet CLA 2007-04-02 06:20:09 EDT
Olivier - do you want to add a DOM test?
Comment 5 Philipe Mulet CLA 2007-04-02 06:20:46 EDT
Released for 3.3M7
Fixed
Comment 6 Olivier Thomann CLA 2007-04-02 21:21:48 EDT
Added org.eclipse.jdt.core.tests.dom.ASTConverter15Test#test0262 and org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0675
Comment 7 Jerome Lanneluc CLA 2007-04-27 09:15:45 EDT
Verified for 3.3M7 with I20070427-0010