Bug 51943

Summary: java editor marks false errors for default access interface
Product: [Eclipse Project] JDT Reporter: Lukas Vosahlik <lukas.vosahlik>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: minor    
Priority: P3    
Version: 2.1.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Lukas Vosahlik CLA 2004-02-13 05:31:23 EST
The Java editor marks false errors when using an interface with default
(package) access. The errors are not shown in Tasks or Package Explorer and the
code can be compiled and run normally.

How to reproduce: create a project containing package cz.netkit.test and 3
files: SomethingFactory.java, SomethingImpl.java and TestBug.java. 

File content:

// SomethingFactory.java
package cz.netkit.test;

interface ISomething
{
}

public class SomethingFactory
{
  public static ISomething getIt()
  {
    return new SomethingImpl();
  }
}

// SomethingImpl.java
package cz.netkit.test;

public class SomethingImpl implements ISomething // MARKED FALSE ERROR
{
}

// TestBug.java
package cz.netkit.test;

public class TestBug
{
  public static void main(String[] args)
  {
    ISomething it = SomethingFactory.getIt(); // MARKED FALSE ERROR
  }
}
Comment 1 Philipe Mulet CLA 2004-02-13 07:18:58 EST
This error is an artifact which only occurs in editor while typing. As you 
observed, it goes away when compiling the code (though the editor still shows 
it).

It only occurs in presence of secondary types. The workaround is to define each 
type in its own file.
Comment 2 Philipe Mulet CLA 2004-02-13 07:48:20 EST

*** This bug has been marked as a duplicate of 36032 ***