Community
Participate
Working Groups
Build ID: M20060921-0945 Steps To Reproduce: 1. Create a public class. Example, a file called "MyClass.java" with a class declaration: public class MyClass { } 2. In this same file, create a public interface or a public abstract class. This definition must use the word "public" to reproduce the error. For example: public interface MyInterface { } or public abstract class MyAbstract { } 3. You should get an error for the abstract class/interface you created in step two such as "The public type MyAbstract must be defined in its own file." More information: Despite the error that Eclipse gives you, the compiler takes this code. And even when you use these classes - not just define them - it takes the code. It appears the correct rule is, a class (such as "MyClass.java") can have only one CONCRETE public class, but it can have zero to many public interfaces and/or zero to many public abstract classes in the same file. These public abstract classes and interfaces do not have to match the name of the file. Along these lines, I did not test what happens when these zero to many public interfaces and abstract classes are the solely defined classes within one file. That is to say, if a public interface or a public abstract class is the only class defined within a file, does its class name have to match the file name? I'm not sure what the rules are for this scenario. Lastly, I also found, even though the following declarations have the same meaning to the compiler, Eclipse only seems to have a problem when the keyword "public" is present: public abstract inteface MyInterface { } * error public interface MyInterface { } * error interface MyInterface { } * no error abstract interface MyInterface { } * no error
Created attachment 56352 [details] This file compiles and runs without errors Eclipse finds an error on line 8
If I understand the issue correctly - your complaint is the code should not execute because of the public type name error - correct ? Its not an issue that we're failing to report the public type name error. We won't be changing this behaviour since there are several cases with problem types that we want users to debug these types, even though they have errors.
Verified for 3.4M2 using build I20070917-0010.