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

Improve interaction between source launcher and classpath

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11, 12
    • Fix Version/s: 12
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b13

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: