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

Java source launcher should not require `--source ...` to enable preview

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 23
    • tools
    • None
    • minimal
    • The Compatibility Risk is very low due to `--source N` is still allowed to be given as an additional argument to `--enable-preview` on the command-line without the launcher issueing any warning or error that it could be omitted.
    • add/remove/modify command line option

      Summary

      Improve the Java source launcher to imply --source N when only --enable-preview is given on the command-line using Java N.

      Problem

      Primary user of the Java source launcher is an early stage programmer learning Java. Explicit requirement of --enable-preview followed by --source N arguments to enable preview features is an obstacle for novice Java source launcher users.

      Solution

      Improve the Java source launcher to use preview features more easy by letting --enable-preview imply --source N, with N automatically selected for current Java Runtime.

      Specification

      The man page of the java launcher will be extended with a new item in the In source-file mode, compilation proceeds as follows subsection as follows:

      - If `--enable-preview` is specified, the `--source N` arguments can be omitted.
        The Java Runtime of version `N` implies an implicit `--release N` being added
        for the compilation of the source files.

      An update of the related command-line help message of java is not required, because the current text covers the new behaviour already:

          --enable-preview
                        allow classes to depend on preview features of this release

            cstein Christian Stein
            asotona Adam Sotona
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: