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

Clean up ClassLoader::package_from_class_name API

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 15
    • 15
    • hotspot

      In ClassLoader::package_from_name, which takes a fully qualified class name, we check for and skip initial '['s. It seems to me this might be code that is asserting against accidental use of class signatures, which use leading ['s - e.g., "[Ljava/lang/String;"

      According to JLS 6.7[1] the fully qualified class name for String should be "java.lang.String[]", transformed into internal form java/lang/String[] as described in JVMS 4.2.1[2].

      I think the entire block testing for leading '['s can be replaced by an assert - or simplified.

      [1] https://docs.oracle.com/javase/specs/jls/se14/html/jls-6.html#jls-6.7
      [2] https://docs.oracle.com/javase/specs/jvms/se14/html/jvms-4.html#jvms-4.2.1

            redestad Claes Redestad
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: