Bug 68698 - Bug in inner class emulation:compiler doesn't reject illegal code.
Summary: Bug in inner class emulation:compiler doesn't reject illegal code.
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-26 17:38 EDT by Christian Köstlin CLA
Modified: 2004-09-06 10:25 EDT (History)
0 users

See Also:


Attachments
source leading to the error (189 bytes, text/plain)
2004-06-26 17:39 EDT, Christian Köstlin CLA
no flags Details
stacktrace of the error (1.94 KB, text/plain)
2004-06-26 17:39 EDT, Christian Köstlin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Köstlin CLA 2004-06-26 17:38:18 EDT
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.
Comment 1 Christian Köstlin CLA 2004-06-26 17:39:18 EDT
Created attachment 12850 [details]
source leading to the error

javasource leading to the described error
Comment 2 Christian Köstlin CLA 2004-06-26 17:39:48 EDT
Created attachment 12851 [details]
stacktrace of the error
Comment 3 Olivier Thomann CLA 2004-06-28 23:04:12 EDT
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.



Comment 4 Philipe Mulet CLA 2004-07-07 07:47:54 EDT
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.

Comment 5 David Audel CLA 2004-09-06 10:25:46 EDT
Verified for 3.0.1 RC1