Bug 36012

Summary: Multiple package private classes in one java file generates error
Product: [Eclipse Project] JDT Reporter: Frank Cornelissen <Frank.Cornelissen>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 3.2 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Frank Cornelissen CLA 2003-04-03 06:23:09 EST
Create a project with a seperate bin and source folder (the errors are weirder
when they are the same).

Create package x
Create java file named A with contents

  package x;

  class A {
  }

  class B {
  }

create java file C with contents

  package x;

  class C {
    B b;
  }

The last file will generate error "B cannot be resolved (or is not a valid type)  
for the field C.b"

I think this should be allowed...
Comment 1 Philipe Mulet CLA 2003-04-03 07:08:19 EST
Secondary types are legite, but discouraged. Incrementally they may not be 
found by compiling tools, which only expect to look types inside files with 
matching names. 

e.g. use javac and only mention x/A.java on the classpath (not as part of the 
compiled file on the command line), and you'll see that B won't be resolved.

We may want to improve this down the road, but we don't want to become slow 
just for this case.
Comment 2 Philipe Mulet CLA 2003-04-03 07:09:56 EST

*** This bug has been marked as a duplicate of 32505 ***
Comment 3 Frederic Fusier CLA 2007-04-02 07:25:49 EDT
Verified for 3.2 using M20060629-1905.