Class CtSym

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 and traversing all possible release related directories and searching for matching path.