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

"javac --release 8" fails when referencing classes from javax.smartcardio

XMLWordPrintable

    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 7, 64-bit
      All JDKs newer than 8 (i.e. 9, 10, and 11)

      A DESCRIPTION OF THE PROBLEM :
      Using the --release option (JEP 247) of the Java compiler (JDK versions >=9) and compiling a code which contains references to classes in the javax.smartcardio package (e.g. TerminalFactory), the compilation fails with the error message "cannot find symbol \n symbol: class TerminalFactory".

      The analysis of the issue resulted in the finding, that the ct.sym DOES NOT contain the signature data of the overall javax.smartcardio package API.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Create Java class CompilerBug.java (see test source code below) using one of the classes from the javax.smartcardio package, e.g. TerminalFactory.
      - Compile this class using JDK 11 compiler with --release CLI argument: "javac --release 8 CompilerBug.java"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Successful compilation
      ACTUAL -
      CompilerBug.java:1: error: package javax.smartcardio does not exist
      import javax.smartcardio.TerminalFactory;
                              ^
      CompilerBug.java:4: error: cannot find symbol
        private TerminalFactory tf = TerminalFactory.getDefault();
                ^
        symbol: class TerminalFactory
        location: class CompilerBug
      CompilerBug.java:4: error: cannot find symbol
        private TerminalFactory tf = TerminalFactory.getDefault();
                                     ^
        symbol: variable TerminalFactory
        location: class CompilerBug
      3 errors

      ---------- BEGIN SOURCE ----------
      import javax.smartcardio.TerminalFactory;

      class CompilerBug {
        private TerminalFactory tf = TerminalFactory.getDefault();
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Dirty workaround is to add the .class files of the javax.smartcardio package from the JRE8 rt.jar to the ct.sym of the new JDK.

      FREQUENCY : always


            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: