FULL PRODUCT VERSION :
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
The Java compiler does not add "final" modifier to anonymous inner class whereas 15.9.5 of JLS requires this.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the code from "Source code" field; check the console ouput.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Class is final: true
ACTUAL -
Class is final: false
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.lang.reflect.Modifier;
public class TestClass {
public static void main(String args[]) {
Object o = new Object() { };
System.out.println("Class is final: " + Modifier.isFinal(o.getClass().getModifiers()));
}
}
---------- END SOURCE ----------