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

Bug 420125

Summary: [1.8][compiler] final modifier should not be allowed on this parameter.
Product: [Eclipse Project] JDT Reporter: Srikanth Sankaran <srikanth_sankaran>
Component: CoreAssignee: shankha banerjee <shankhba>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, shankhba, srikanth_sankaran
Version: 4.4   
Target Milestone: BETA J8   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Srikanth Sankaran CLA 2013-10-22 20:00:31 EDT
Per recent discussions in the EG, final modifiers should not be allowed
on the this parameter. Only annotations are allowed. Eclipse accepts this.
Initially, we *may* want to make it into warning and once javac complies
turn it into an error and if we choose that path, add an entry here:
bug 420045
Comment 1 Jay Arthanareeswaran CLA 2013-10-31 04:29:47 EDT
Srikanth, I am assigning this one to Shankha as he is more likely spare time for this right now.

Shankha, please take this forward.
Comment 2 shankha banerjee CLA 2013-11-06 00:52:22 EST
Hi,

Could you please help me with a test case:

I have the following test case:


class Y {
	void foo(final Y this) {} // Eclipse Error: Syntax error, modifiers are not allowed here // javac : No errors
}

class Z {
	class A {
		A (final Z this) {} // Eclipse Error: (1) Syntax error, modifiers are not allowed here (2) The explicit 'this' parameter is expected to be qualified with Z // javac error: the receiver name does not match the enclosing outer class type A (final Z this) {} 
		void foo (final Z.A this) {} // Eclipse Error: Syntax error, modifiers are not allowed here  // javac: No errors
	}
	class B {
	 	 B (final Z.B this) {}  // Eclipse Error: (1) Syntax error, modifiers are not allowed here, (2) The declared type of the explicit 'this' parameter is expected to be Z X.java // javac: error: the receiver type does not match the enclosing outer class type B (final Z.B this {}  
		 void foo (final Z this) {} // Similar errors as above.
	}  
}


Thanks,
Comment 3 Srikanth Sankaran CLA 2013-11-06 01:37:29 EST
Sorry, my bad. This has already been taken care of by the duplicate bug.

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