@@ -2015,8 +2015,8 @@ public static void main(String[] args) {
20152015 }
20162016 try {
20172017 Class<?> clazz = Class.forName("X");
2018- java.lang.reflect.Field method = clazz.getDeclaredField("fieldWithUnicode\u0001 Char");
2019- System.out.println("Field found: " + method .getName());
2018+ java.lang.reflect.Field field = clazz.getDeclaredField("fieldWithUnicode\u0001 Char");
2019+ System.out.println("Field found: " + field .getName());
20202020 } catch (ClassNotFoundException e) {
20212021 System.out.println("Class not found.");
20222022 } catch (NoSuchFieldException e) {
@@ -2031,6 +2031,46 @@ public static void main(String[] args) {
20312031 "Field not found." );
20322032 }
20332033 public void testIssue4001_2 () {
2034+ this .runConformTest (
2035+ new String [] {
2036+ "X.java" ,
2037+ """
2038+ public class X {
2039+ String fieldWithUnicode\u0001 Char = "";
2040+ public static void main(String[] args) {
2041+ try {
2042+ Class<?> clazz = Class.forName("X");
2043+ java.lang.reflect.Method method = clazz.getDeclaredMethod("methodWithUnicodeChar");
2044+ System.out.println("Method found: " + method.getName());
2045+ method.invoke(null);
2046+ } catch (ClassNotFoundException e) {
2047+ System.out.println("Class not found.");
2048+ } catch (NoSuchMethodException e) {
2049+ System.out.println("Method not found.");
2050+ } catch (Exception e) {
2051+ e.printStackTrace();
2052+ }
2053+ try {
2054+ Class<?> clazz = Class.forName("X");
2055+ java.lang.reflect.Field field = clazz.getDeclaredField("fieldWithUnicodeChar");
2056+ System.out.println("Field found: " + field.getName());
2057+ } catch (ClassNotFoundException e) {
2058+ System.out.println("Class not found.");
2059+ } catch (NoSuchFieldException e) {
2060+ System.out.println("Field not found.");
2061+ }
2062+ }
2063+ public static void methodWithUnicode\u0001 Char() {
2064+ String fieldWithUnicode\u0001 Char = "Hello";
2065+ System.out.println(fieldWithUnicodeChar);
2066+ }
2067+ }""" ,
2068+ },
2069+ "Method found: methodWithUnicodeChar\n " +
2070+ "Hello\n " +
2071+ "Field found: fieldWithUnicodeChar" );
2072+ }
2073+ public void testIssue4001_3 () {
20342074 this .runConformTest (
20352075 new String [] {
20362076 "X.java" ,
0 commit comments