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

Historical data for JDK 8 should include the jdk.net package

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • 11, 17, 21, 25, 26
    • tools
    • None

      We noticed that javac --release N misses some APIs that were added in relevant Maintenance Releases. For example, this causes false errors when compiling targeting older releases, see for example accessing jdk.net.ExtendedSocketOptions.TCP_KEEPINTERVAL that was added by JDK 8 Maintenance Release 3.

      % cat YoloMR.java
      public class YoloMR {
      public static void main(String... args) {
      jdk.net.ExtendedSocketOptions.TCP_KEEPINTERVAL.hashCode();
      }
      }

      % /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/bin/javac YoloMR.java
      [all fine]

      % /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/bin/javac --release 8 YoloMR.java
      YoloMR.java:3: error: package jdk.net.ExtendedSocketOptions does not exist
      jdk.net.ExtendedSocketOptions.TCP_KEEPINTERVAL.hashCode();
      ^

      % /Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/bin/javac --release 8 YoloMR.java
      YoloMR.java:3: error: package jdk.net.ExtendedSocketOptions does not exist
      jdk.net.ExtendedSocketOptions.TCP_KEEPINTERVAL.hashCode();

       /Library/Java/JavaVirtualMachines/amazon-corretto-21.jdk/Contents/Home/bin/javac --release 8 YoloMR.java
      warning: [options] source value 8 is obsolete and will be removed in a future release
      warning: [options] target value 8 is obsolete and will be removed in a future release
      warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
      YoloMR.java:3: error: package jdk.net.ExtendedSocketOptions does not exist
      jdk.net.ExtendedSocketOptions.TCP_KEEPINTERVAL.hashCode();
      ^
      1 error


      % /Library/Java/JavaVirtualMachines/amazon-corretto-24.jdk/Contents/Home/bin/javac --release 8 YoloMR.java
      warning: [options] source value 8 is obsolete and will be removed in a future release
      warning: [options] target value 8 is obsolete and will be removed in a future release
      warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
      YoloMR.java:3: error: package jdk.net.ExtendedSocketOptions does not exist
      jdk.net.ExtendedSocketOptions.TCP_KEEPINTERVAL.hashCode();
      ^
      1 error
      3 warnings

            jlahoda Jan Lahoda
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: