Repository navigation
Commit de69da8
committed
Allow building with a newer JDK while targeting Java 17
Compile with --release 17, so the output keeps Java 17 bytecode and
API usage whichever JDK compiles it. The toolchain still defaults to
17 and can be overridden with -PjavaToolchain=21, which also selects
the JDK the tests run on. Java 21 works with the current Gradle and
test libraries. Newer JDKs need a Gradle upgrade.
userApiJavadoc now runs the toolchain's javadoc instead of the one
from the JDK running Gradle, and its version is a task input, so
switching toolchains regenerates the docs. CONTRIBUTING.md describes
the new option.
Compared with the JDK 17 toolchain, a build with the JDK 21 toolchain
produces only Java 17 (major version 61) class files. Of the 3,640
classes, 1,487 are byte-identical. The vocab classes, which build
does not compile, are all byte-identical. The rest differ only in ways
that come from newer javac versions and do not change behavior:
- Metadata: constant pool order, MethodParameters attributes for the
mandated and synthetic parameters of inner class constructors, and
argN parameter names in the LocalVariableTable of anonymous class
constructors.
- Object methods called on an interface type (toString, equals,
getClass) are emitted as invokeinterface on the interface instead of
invokevirtual on Object (25 classes). The JVM resolves both to the
same method.
- A switch on an enum inside that enum's own class uses ordinal()
directly instead of a $SwitchMap. This drops two synthetic classes,
MetaDataColumnType$1 and ContextType$1, and three switch map fields
from other synthetic classes.
Closes #215.
Issue: #215
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Tony Germano <tony@germano.name>1 parent 52eb08d commit de69da8
3 files changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
158 | 163 | | |
159 | 164 | | |
160 | 165 | | |
161 | | - | |
| 166 | + | |
162 | 167 | | |
163 | 168 | | |
164 | 169 | | |
| |||
177 | 182 | | |
178 | 183 | | |
179 | 184 | | |
| 185 | + | |
180 | 186 | | |
181 | 187 | | |
182 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
495 | 498 | | |
496 | 499 | | |
497 | | - | |
| 500 | + | |
498 | 501 | | |
499 | 502 | | |
500 | 503 | | |
| |||
0 commit comments