-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
x86
-
windows_nt
Name: bsC130419 Date: 06/01/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
When a class name contains international character (e.g. "Cl?",
written "Cl\u00E9" below for portability), the compiler finds it but some
reflection methods fail. Please compile and test the following program. The
interface "Cl?" doesn't need to be in a separated file.
import java.lang.reflect.Field;
public class Test
{
public static void main(final String[] args) throws Exception
{
final Class classe = Cl\u00E9.class; // Success
final Field field = classe.getField("ID"); // Success
final int ID = field.getInt(null); // Fail
System.out.println(ID);
}
}
class Cl\u00E9
{
public static final int ID=12;
}
This program work as expected if we use plain class name (e.g. "Cle" instead
of "Cl?"). With "Cl?", I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: Cl? (wrong name: Cl?)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:495)
at java.security.SecureClassLoader.defineClass
(SecureClassLoader.java:110)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:249)
at java.net.URLClassLoader.access$100(URLClassLoader.java:57)
at java.net.URLClassLoader$1.run(URLClassLoader.java:196)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:189)
at java.lang.ClassLoader.loadClass(ClassLoader.java:304)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:287)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:260)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at sun.reflect.GeneratedFieldAccessor1.getInt(Unknown Source)
at java.lang.reflect.Field.getInt(Field.java:312)
at Test.main(Test.java:9)
Looking in the exception message, we see that the lower-case "e" acute ("?")
has been replaced by an upper-case "e" acute ("?") for no apparent raison.
(Review ID: 125239)
======================================================================
- duplicates
-
JDK-4475696 JCK1.4: vm/concepts/unicode/unicode001/unicode00102m1/unicode00102m1.html, merli
- Closed