Bug 26526 - Inner class imports flagged as errors.!
Summary: Inner class imports flagged as errors.!
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-15 17:34 EST by Jay Patel CLA
Modified: 2002-11-28 13:47 EST (History)
0 users

See Also:


Attachments
Test Case that shows the problem (6.69 KB, application/octet-stream)
2002-11-27 22:50 EST, Jay Patel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Patel CLA 2002-11-15 17:34:56 EST
If inner classes are specified in import statement, they are flagged as errors 
WHEN:
  the inner classes come from either 1. interface or 2. super class.

To reproduce:

create Foo.java with inner public class InnerFoo
create Bar.java that implements Foo.java
create Baz.java that has import statement as: import Bar.InnerFoo;

Javac does not complain about abocve setup.

Eclipse does not complain if all inner classes are in Baz.java.

Thanks.

Jay.
Comment 1 Kent Johnson CLA 2002-11-19 12:01:12 EST
I have tried inheriting the inner type from an interface & a superclass... 
javac 1.3 doesn't except either import statements.

Which version of javac are you running?

Can you paste in the exact source files so there is no confusion please.
Comment 2 Kent Johnson CLA 2002-11-22 11:28:55 EST
Reopen when you have a repeatable case.
Comment 3 Jay Patel CLA 2002-11-27 22:50:39 EST
Created attachment 2546 [details]
Test Case that shows the problem

This file contains complete code that shows the problem indicated by this bug
report. When compiled outside of Eclipse, all scenarios described in test
classes compile and work fine. Inside of Eclipse, however, some imports are
flagged as errors.
Comment 4 Jay Patel CLA 2002-11-27 22:56:01 EST
test case description:

there are two packages: 
  1. test.pkg.one
       This package contains inheritance and implementation classes needed 
       the test.
 
  2. test.pkg.two
       This package contains two test files; one for inheritance test and one
       for implementation test. Both tests have import statements that work 
       with eclipse. Therefore, as is, the code will cause eclipse to flag 
       errors within code. However, when compiled with JDK 131 and JDK 141, 
       both tests compile and run fine.

Comment 5 Kent Johnson CLA 2002-11-28 13:47:54 EST
I think you have found a bug in Sun's compiler. Here is the trace from using 
javac (both 1.3 & 1.4.1 behave the same):

D:\Bug>javac test\pkg\one\Subclass.java test\pkg\one\AbstractClass.java

D:\Bug>javac test\pkg\two\InheritanceTest.java

NOTE: No problem compiling the test IF the necessary .class files exist for the 
member types

D:\Bug>javac test\pkg\two\InheritanceTest.java test\pkg\one\Subclass.java 
test\pkg\one\AbstractClass.java
test\pkg\two\InheritanceTest.java:7: cannot resolve symbol
symbol  : class AbstractInnerClassOne
location: class test.pkg.one.SubClass
import test.pkg.one.SubClass.AbstractInnerClassOne;
                             ^
test\pkg\two\InheritanceTest.java:13: cannot resolve symbol
symbol  : variable AbstractInnerClassOne
location: class test.pkg.two.InheritanceTest
    System.out.println( AbstractInnerClassOne.NAME );
                        ^
2 errors

BUT when all 3 source files are compiled together (the .class files still 
exist), then javac cannot resolve the member type.

Our compiler always complains that the member type cannot be resolved.