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

Improve interaction between source launcher and classpath

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 12
    • 11, 12
    • tools
    • b13

        See mail thread started on core-libs-dev, continued on compiler-dev
        http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-September/055437.html
        http://mail.openjdk.java.net/pipermail/compiler-dev/2018-September/012427.html

        The source launcher currently checks that the main class in the source file does not also exist on the application class path, to avoid the wrong one being used.

        This can cause a surprise for people comparing explicit use of javac and java with the source launcher, when compiled files may be left in the current directory, and will need to be deleted.
        For example,
            javac HelloWorld.java
            java HelloWorld
            #
            java HelloWorld.java

        The policy about just checking for the presence of the main class on the application class path is also insufficient when the code also has nested or inner classes. It is also inconvenient to have to delete such files if they have been left around.

        It would be better for the source launcher to prefer the classes declared in the source file over any found on the application class path.

              jjg Jonathan Gibbons
              jjg Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: