Java's backwards compatibility relies on more than just bytecode level settings. The `--release` compiler option, introduced in Java 9, enables safe cross-version compilation without installing older JDKs. It works via a file called `ct.sym` bundled in the JDK — a 7.2 MB ZIP containing stripped-down API signature files for each supported Java version. These `.sig` files are essentially class files organized by version, allowing `javac` to detect API usage incompatible with the target version at compile time. The post explores the internal structure of `ct.sym`, how version directories are encoded (including hex notation for versions 10+), how `javap` can be used to inspect the signature files, and reveals a synthetic `@jdk.Profile+Annotation` used for compact profile support. The conclusion is that `--release` should replace the older `-source`/`-target` flags entirely.

6m read timeFrom morling.dev
Post cover image

Sort: