java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.util.CtSym

public class CtSym extends Object
Abstraction to the ct.sym file access (see https://openjdk.java.net/jeps/247). The ct.sym file is required to implement JEP 247 feature (compile with "--release" option against class stubs for older releases) and is currently (Java 15) a jar file with undocumented internal structure, currently existing in at least two different format versions (pre Java 12 and Java 12 and later).

The only documentation known seem to be the current implementation of com.sun.tools.javac.platform.JDKPlatformProvider and probably some JDK build tools that construct ct.sym file. Root directories inside the file are somehow related to the Java release number, encoded as single digit or letter (single digits for releases 7 to 9, capital letters for 10 and higher).

If a release directory contains "system-modules" file, it is a flag that this release files are not inside ct.sym file because it is the current release, and jrt file system should be used instead.

All other release directories contain encoded signature (*.sig) files with class stubs for classes in the release.

Some directories contain files that are shared between different releases, exact logic how they are distributed is not known.

Known format versions of ct.sym:

Pre JDK 12:

 ct.sym -> 9 -> java/ -> lang/
 ct.sym -> 9-modules -> java.base -> module-info.sig
 
From JDK 12 onward:
 ct.sym -> 9 -> java.base -> java/ -> lang/
 ct.sym -> 9 -> java.base -> module-info.sig
 
Notably,
  1. in JDK 12 modules classes and ordinary classes are located in the same location
  2. in JDK 12, ordinary classes are found inside their respective modules

Searching a file for a given release in ct.sym means finding Ungültige Eingabe: "&" traversing all possible release related directories and searching for matching path.

  • Felddetails

    • DISABLE_CACHE

      public static final boolean DISABLE_CACHE
  • Methodendetails

    • getFs

      public FileSystem getFs()
      Gibt zurück:
      never null
    • isJRE12Plus

      public boolean isJRE12Plus()
      Gibt zurück:
      true if this file is from Java 12+ JRE
    • getRoot

      public Path getRoot()
      Gibt zurück:
      never null
    • releaseRoots

      public List<Path> releaseRoots(String releaseCode)
      Parameter:
      releaseCode - major JDK version segment as version code (8, 9, A, etc)
      Gibt zurück:
      set with all root paths related to given release in ct.sym file
    • getFullPath

      public Path getFullPath(String releaseCode, String qualifiedSignatureFileName, String moduleName)
      Retrieves the full path in ct.sym file fro given signature file in given release

      12+: something like

      java/io/Reader.sig -> /879/java.base/java/io/Reader.sig

      before 12:

      java/io/Reader.sig -> /8769/java/io/Reader.sig

      Parameter:
      releaseCode - release number encoded (7,8,9,A,B...)
      qualifiedSignatureFileName - signature file name (without module)
      moduleName -
      Gibt zurück:
      corresponding path in ct.sym file system or null if not found
    • getModuleInJre12plus

      public String getModuleInJre12plus(String releaseCode, String qualifiedSignatureFileName)
    • getFileBytes

      public byte[] getFileBytes(Path path) throws IOException
      Löst aus:
      IOException
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • getReleaseCode

      public static String getReleaseCode(String release)
      Tries to translate numeric Java version to the corresponding release "code".
      • 7, 8 and 9 are just returned "as is"
      • versions up from 10 are returned as upper letters starting with "A", so 10 is "A", 11 is "B" and so on.
      Parameter:
      release - release version as number (8, 9, 10, ...)
      Gibt zurück:
      the "code" used by ct.sym for given Java version