- 
    Enhancement 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    20
- 
        b04
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8341572 | 17.0.14 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 | 
                    Spotted in an erroneous bug report. Consider a class:
package circular;
public class I {
}
which gets compiled into ./circular/I.class
You then incorrectly invoke it as:
java -cp circular I
the error is:
Error: Could not find or load main class I
Caused by: java.lang.NoClassDefFoundError: circular/I (wrong name: I)
but it should be:
Error: Could not find or load main class I
Caused by: java.lang.NoClassDefFoundError: I (wrong name: circular/I)
because the VM was asked to load class I but couldn't find I; it found a classfile I.class, but that classfile identified the class in it as circular.I which is the wrong name.
There is obviously a matter of perspective on this but the error should reflect things from the user's perspective:
User: Hey JVM please load class I
JVM: Where should I look for it?
User: in the circular directory
JVM: NoClassDefFoundError: I
User: Hey it is in file I.class
JVM: No the class in that file has the wrong name: circular.I
            
package circular;
public class I {
}
which gets compiled into ./circular/I.class
You then incorrectly invoke it as:
java -cp circular I
the error is:
Error: Could not find or load main class I
Caused by: java.lang.NoClassDefFoundError: circular/I (wrong name: I)
but it should be:
Error: Could not find or load main class I
Caused by: java.lang.NoClassDefFoundError: I (wrong name: circular/I)
because the VM was asked to load class I but couldn't find I; it found a classfile I.class, but that classfile identified the class in it as circular.I which is the wrong name.
There is obviously a matter of perspective on this but the error should reflect things from the user's perspective:
User: Hey JVM please load class I
JVM: Where should I look for it?
User: in the circular directory
JVM: NoClassDefFoundError: I
User: Hey it is in file I.class
JVM: No the class in that file has the wrong name: circular.I
- backported by
- 
                    JDK-8341572 classfile parser 'wrong name' error message has the names the wrong way around -           
- Resolved
 
-         
- relates to
- 
                    JDK-8238358 Implementation of JEP 371: Hidden Classes -           
- Resolved
 
-         
- links to
- 
                     Commit
        openjdk/jdk/925084c4 Commit
        openjdk/jdk/925084c4
- 
                     Commit(master)
        openjdk/jdk17u-dev/594ce95e Commit(master)
        openjdk/jdk17u-dev/594ce95e
- 
                     Review
        openjdk/jdk/9264 Review
        openjdk/jdk/9264
- 
                     Review(master)
        openjdk/jdk17u-dev/2925 Review(master)
        openjdk/jdk17u-dev/2925
             (1 links to)