Bug 33751 - The numbering of anonymous could be optimized
Summary: The numbering of anonymous could be optimized
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-04 09:43 EST by Olivier Thomann CLA
Modified: 2003-06-05 09:38 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2003-03-04 09:43:32 EST
Using 0227, the following test case generated:
A.class
A$1.class
A$3.class

A$2.class is not generated.

public class A {
 public static void main(String[] args) {
  Object o  = new Object() {};
  if (true) {
   System.out.println("Always true");
  } else {
   System.out.println(new Object() {});
  }
  System.out.println("last inner class = " + new Object() {});
 }
}

javac 1.4.1 behaves the same. jikes 1.18 generates all of them even if the
anonymous in the false clause of the if(true) is never used.

Ideally we want to have:
A.class
A$1.class (this would correspond to the first anonymous class in the code)
A$2.class (this would correspond to the third anonymous class in the code)
Comment 1 Olivier Thomann CLA 2003-03-04 09:44:17 EST
This is for post 2.1.
Comment 2 Philipe Mulet CLA 2003-04-02 06:43:17 EST
reopen
Comment 3 Philipe Mulet CLA 2003-04-02 09:39:34 EST
Inner emulation was incorrectly performed in fake reachable code.
Comment 4 Philipe Mulet CLA 2003-04-02 09:41:21 EST
Fixed in latest, also avoid doing any emulation in fake reachable code.
Comment 5 David Audel CLA 2003-06-05 09:38:36 EDT
Verified.