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

[AOT] jaotc --classpath option is confusing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • hotspot
    • b156
    • x86_64
    • linux

    Backports

      Description

        I tried to change compilation of SPEC benchmarks from using
        -J-cp -J<lib1>:...:<libN> benchmark.jar to --classpath <lib1>:...:<libN> benchmark.jar
        It was expected to work this way but it produces java.lang.InternalError because of class resolution. I see that JEP 295 text states the option as a "<path>" but it's really confusing when compared to javac.

        jdk.tools.jaotc.collect.ClassCollector code threats options.classpath as a single entry which actually can be jar or directory. Seems to be not too complex to split the option by cp separator and threat it as a bunch of jars/dirs.

        Besides that ClassCollector is supposed to report an error if the path is malformed but it doesn't.

        Currently there are 3 variants for file arguments:
        1. .jar file. --classpath is ignored.
        Expected to be a valid classpath which helps to resolve external references.
        2. .class file. Classpath is treated as a path, arg is treated as not fully qualified class name.
        Expected real classpath for URLClassLoader to contain --classpath entries and the class to be loaded properly.
        3. Class name. Classpath is treated as a path where .class file is searched with file name matching arg, which is treated as not fully qualified class name.
        Expected valid classpath and fully qualified class name here, e.g. "jaotc --classpath . test.HelloWorld" instead of "jaotc --classpath . HelloWorld".

        Note, there is also a modulepath.

        Attachments

          Issue Links

            Activity

              People

                rbackman Rickard Backman (Inactive)
                dchuyko Dmitry Chuyko
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: