Community
Participate
Working Groups
Build: R3 when implementing an inner interface anonymously (like in the attached source) i get the attached error. i dont know if this is allowed or not.
Created attachment 12850 [details] source leading to the error javasource leading to the described error
Created attachment 12851 [details] stacktrace of the error
Compiling this code leads to the problem. The AST conversion has nothing to do with it. This code is illegal, but it is not rejected properly. class Display { public interface Bla { void a(); } } public class Test { void aMethod() { Display display = null; display.new Bla() { }; } } Javac 1.4.2 reports: Test.java:13: qualified new of static class display.new Bla() { ^ Test.java:13: <anonymous Test$1> is not abstract and does not override abstract method a() in Display.Bla display.new Bla() { ^ 2 errors Jikes 1.18 reports: Found 1 semantic error compiling "C:/tests_sources/Test.java": 13. display.new Bla() { ^-^ *** Semantic Error: The interface "Display$Bla" is not an inner class.
QualifiedAllocationExpression did not properly handle this incorrect code (did not check that the actual target had no enclosing type). Addressed in both 3.0.1 and 3.1 streams. Added regression test InnerEmulationTest#test116.
Verified for 3.0.1 RC1