Duplicate :
|
FULL PRODUCT VERSION : java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) ADDITIONAL OS VERSION INFORMATION : Darwin alexbool-osx 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64 A DESCRIPTION OF THE PROBLEM : Under certain circumctances, javac 8 rejects to compile code that compiles under previous versions of javac. In the given example, if non-compiling line is modified to "return this.eq(this.value, value);" or "return super.eq(this.value, value);", the problem goes away. REGRESSION. Last worked in version 7u51 ERROR MESSAGES/STACK TRACES THAT OCCUR : error: no enclosing instance of type AbstractMapF is in scope REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.util.AbstractMap; public class Jdk8Test { public static abstract class SingletonMap<K, V> extends AbstractMapF<K, V> { private final K key; private final V value; public SingletonMap(K key, V value) { this.key = key; this.value = value; } @Override public boolean containsValue(Object value) { return eq(this.value, value); // does not compile } } public static abstract class AbstractMapF<K, V> extends AbstractMap<K, V> { protected boolean eq(Object a, Object b) { return true; } } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Qualifying instance on which method eq is invoked helps: either "this.eq(...)" or "super.eq(...)" compiles fine.