Community
Participate
Working Groups
Hi, First of all, I started out using build 3.1 M1 and then went back to 3.0.1 but encountered the same problem. I have an interface that contains an embedded static class, which extends Exception, like this: public interface I { public static class MyException extends Exception { } } and another class that has a method that throws that exception like this: public class A { protected void test() throws I$MyException { } } but when I try to build the project in either build of eclipse, I get the following compile time error: The exception type I$MyException cannot be referenced using its binary name. even though the interface compiles correctly and I can see that I$MyException.class exists. The compiler does, however, give this warning when I compile the interface: The serializable class MyException does not declare a static final serialVersionUID field of type long. I doubt that this is causing the problem, though. This does compile when I use javac (through ant) and JBuilder and I know that it is legal in the Java language. I am trying to migrate from JBuilder to eclipse. All of this source is older stuff and I did not write the interface and class that is causing this problem. At the same time, I should't have to go back to modify it (even if it is bad) to work with an IDE.
Aren't inner types supposed to be referenced using OuterClass.InnerClass (instead of OuterClass$InnerClass)?
I don't understand how you can compile this code with javac. I tried version 1.3.1, 1.4.2_05 and 1.5.0 and all of them fail with: symbol : class I$MyException location: class p1.A perchance you meant 'I.MyException' protected void test() throws I$MyException { ^ 1 error or: p1/A.java:4: cannot resolve symbol symbol : class I$MyException location: class p1.A protected void test() throws I$MyException { ^ 1 error It doesn't compile. If you replace I$MyException with I.MyException, then it works fine on Eclipse and any javac version. I also tried jikes 1.21 and it fails. Close as INVALID.
It does compile as outer$inner if you compile outside of eclipse (such as by invoking javac at a prompt). Just compile I first and then A without using an IDE. I guess this really isn't that important since the person who wrote this code did it in a non-standard way and I should just fix the code. It would be interesting to find out why it doesn't work in eclipse, though.
Our compiler doesn't allow to use member types with binary names, as per spec. Looks like other compilers let it go thru.
*** Bug 82487 has been marked as a duplicate of this bug. ***