--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Tue Mar 22 19:34:47 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Wed Mar 23 13:39:15 2016 +0100
@@ -282,7 +282,9 @@
* @param env The current environment.
*/
void checkAssignable(DiagnosticPosition pos, VarSymbol v, JCTree base, Env<AttrContext> env) {
- if ((v.flags() & FINAL) != 0 &&
+ if (v.name == names._this) {
+ log.error(pos, Errors.CantAssignValToThis);
+ } else if ((v.flags() & FINAL) != 0 &&
((v.flags() & HASINIT) != 0
||
!((base == null ||