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

sun.misc classes from JEP 260 are not available when --release < 9

XMLWordPrintable

    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)

      A DESCRIPTION OF THE PROBLEM :
      The sun.misc.{Signal,SignalHandler,Unsafe} classes that were retained in JEP 260 are not included in the compiler tree ct.sym library for releases earlier than 9. Code targeting 1.8 that uses sun.misc.{Signal,SignalHandler} will compile without issue with --release 9 but not when --release 8 or earlier is used. This issue appears to have existed since the --release flag was first introduced.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the following code snippet using --release 8
      class Main {{ sun.misc.Signal.class.getName(); }}

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      test/Main.java:1: warning: Signal is internal proprietary API and may be removed in a future release
      package test; class Main {{ sun.misc.Signal.class.getName(); }}
                                          ^
      1 warning
      ACTUAL -
      test/Main.java:1: error: package sun.misc does not exist
      package test; class Main {{ sun.misc.Signal.class.getName(); }}
                                          ^
      1 error

      ---------- BEGIN SOURCE ----------
      package test; class Main {{ sun.misc.Signal.class.getName(); }}

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Build using a real JDK 1.8 toolchain or targeting Java 9+

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: