Bug 79243 - TypeCollidesWithPackage not detected in default package
Summary: TypeCollidesWithPackage not detected in default package
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-22 17:14 EST by Stephan Herrmann CLA
Modified: 2004-11-23 16:04 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2004-11-22 17:14:50 EST
The error "The type {0} collides with a package" is not detected at 
the root of the package hierarchy, ie., the compiler accepts a toplevel 
package and a type in the default package having the same name. 
 
Fix: add to the front of 
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createPackage 
 
something like: 
 if (compoundName.length == 1) 
  if (defaultPackage.getType0(compoundName[0])!= null) 
   return null; 
The message will be produced at the calling site.
Comment 1 Kent Johnson CLA 2004-11-23 16:04:06 EST
Types in the default package are special. They are only visible to other types 
in the default package.

Check with javac - they do not report collisions either.