Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4023101

Class.getMethod()/getDeclaredMethod() doesn't find non-ASCII method name

    • 1.1fcs
    • generic
    • generic
    • Not verified


      masayoshi.okutsu@Eng 1996-12-20
      A method name in non-ASCII characters cannot be found using
      Class.getMethod() or Class.getDeclaredMethod().

      To reproduce, run the following:

      Source program:

      import java.lang.reflect.*;

      public class methodmini{
      //
      public static void main(String[] args){
      Method method;
      testMethod testmethod = new testMethod();
      Class c = testmethod.getClass();
      String methodName = "\u30c6\u30b9\u30c8";
      Class[] parameterList = null;
      //
      // getMethod()
      //
      try{
      method = c.getMethod(methodName,parameterList);
      }
      catch(NoSuchMethodException e){ e.printStackTrace(); }
      catch(SecurityException e){ e.printStackTrace(); }
      //
      // getDeclaredMethod()
      //
      try{
      method = c.getDeclaredMethod(methodName,parameterList);
      }
      catch(NoSuchMethodException e){ e.printStackTrace(); }
      catch(SecurityException e){ e.printStackTrace(); }
      }
      }

      //
      // class testMethod
      //
      class testMethod{
      public testMethod(){}
      public static void \u30c6\u30b9\u30c8(){}
      }

      Execution:

      % java methodmini
      java.lang.NoSuchMethodException
      at java.lang.Class.getMethod(Class.java)
      at methodmini.main(methodmini.java:15)
      java.lang.NoSuchMethodException
      at java.lang.Class.getDeclaredMethod(Class.java)
      at methodmini.main(methodmini.java:23)

            nsaraiyasunw Nakul Saraiya (Inactive)
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: