Bug 95992 - Problems resolving type name inside generic class
Summary: Problems resolving type name inside generic class
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.5.0 M4   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-19 14:12 EDT by Ivo Kasiuk CLA
Modified: 2005-08-31 09:48 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 Ivo Kasiuk CLA 2005-05-19 14:12:24 EDT
ajc reports an error when compiling the following code:

interface Base<T> {
    static interface Inner {
    }
}
class Test<T extends Test.InnerTest> implements Base<T> {
    static class InnerTest implements Inner {
    }
}

$ ajc -1.5 Test.java
Test.java:14 [error] Inner cannot be resolved to a type
static class InnerTest implements Inner {


Sun's javac compiles it without any error.
The error can be avoided by simply writing "Base.Inner" instead of just "Inner".
Also, it compiles fine if the constraint "extends Test.InnerTest" is left away.
Comment 1 Andrew Clement CLA 2005-05-25 16:33:11 EDT
this program also fails in the regular Eclipse JDT compiler (3.1m7)
Comment 2 Andrew Clement CLA 2005-06-06 09:47:45 EDT
This program also fails to compile using the Java compiler in Eclipse 3.1 RC1. 
(same error)
Comment 3 Ivo Kasiuk CLA 2005-07-09 10:39:03 EDT
Eclipse + JDT 3.1.0 (final) does compile it.
Comment 4 Dror Dotan CLA 2005-08-24 05:51:56 EDT
Another example of a similar bug, which causes error while trying to resolve 
classes:

public interface ExampleInterface<T> {
}
public class ExampleClass {
    private static class MyClass implements ExampleInterface<String> {
    }
}

But if the inner class is defined without the generic, everything works:
public class ExampleClass {
    private static class MyClass implements ExampleInterface {
    }
}
Comment 5 Andrew Clement CLA 2005-08-24 06:18:31 EDT
This program: 

public interface ExampleInterface<T> {
}
public class ExampleClass {
    private static class MyClass implements ExampleInterface<String> {
    }
}

works with the latest dev build of the compiler (20050824100440), however the 
first program mentioned in this bug seems to have changed from failing because 
of JDT to failing because of AJ.  Compiling it now gives:

[error] can't find type Test$InnerTest
Comment 6 Adrian Colyer CLA 2005-08-31 09:48:00 EDT
This bug had the same root cause as bug 108454, and is now fixed in tree. The
most recent published build on the AspectJ downloads page contains the fix.