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

Add javac support for preview features

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 11
    • tools
    • b10
    • Verified

      # Class files

      - With --enable-preview, every class file written by javac is a preview class file (minor_version is 65535). Without --enable-preview, every class file written by javac is not a preview class file (minor_version is 0).

      - With --enable-preview, javac reads preview class files from the module path/class path as necessary. Without --enable-preview, javac gives an error if it attempts to read a preview class file.

      # Diagnostics

      - With --enable-preview, if javac detects the use of one or more preview features in source, then javac prints a "note" at the end of the compilation to indicate the use of preview features. Compiling with --enable-preview -Xlint:preview will cause javac to print info about all uses.

      * Without --enable-preview, if javac detects the use any preview feature in source, then javac fails with an error. As well as giving the error, javac also mentions that a preview feature was used, and that --enable-preview can be given.

      * If a source file depends on one or more preview class files, then javac counts that as a use of a preview feature. Accordingly, javac either gives a "note"/lint warning (with --enable-preview) or an error (without --enable-preview).

            mcimadamore Maurizio Cimadamore
            mtrudeau Michel Trudeau
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: