Skip to content

Java 21 with Graal support #1211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 112 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
a67bad9
bump java
eholmer1 Oct 19, 2024
e658a4f
Remove tests for handling of extra semi-colons
cushon Apr 20, 2023
065c379
Add support for guard clauses in Java 21 switch expressions
TheCK Dec 7, 2023
2f58013
Initial support for pattern matching in switches
cushon Dec 8, 2023
640ca01
format
CRogers Oct 22, 2024
52712d6
add benchmarks
crogoz Jan 22, 2025
217a7b0
.
crogoz Jan 22, 2025
0618efc
.
crogoz Jan 22, 2025
fa35c61
spotlessApply
crogoz Jan 23, 2025
ef7b081
test?
crogoz Jan 24, 2025
25d20ea
some nativeImage
crogoz Jan 27, 2025
e5e8492
execute permissions
crogoz Jan 27, 2025
a73f12f
executable
crogoz Jan 27, 2025
5de0181
working transforms
crogoz Jan 28, 2025
c475f83
add replacement reflect classes for native-image
crogoz Jan 30, 2025
07a2d0e
.
crogoz Jan 30, 2025
b1119e2
bump gradle-jdks version
crogoz Jan 30, 2025
0fbf044
Add generated changelog entries
svc-changelog Jan 30, 2025
782f075
Add generated changelog entries
svc-changelog Jan 30, 2025
25bce25
natieImage
crogoz Jan 30, 2025
6d346d9
Merge branch 'cr/graal-1' of github.com:palantir/palantir-java-format…
crogoz Jan 30, 2025
2a2d086
spotless
crogoz Jan 31, 2025
320c77e
gradlew
crogoz Jan 31, 2025
d1323a4
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz Jan 31, 2025
12f2b1d
compatibility
crogoz Jan 31, 2025
4c058df
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz Jan 31, 2025
b9a2cc5
OS as part of classifier
crogoz Jan 31, 2025
cbccc19
configurable
crogoz Feb 3, 2025
2b0d8f9
fix tests
crogoz Feb 3, 2025
ce67ada
no log line
crogoz Feb 3, 2025
0f01291
no logging
crogoz Feb 3, 2025
ddad367
use gradle utils
crogoz Feb 4, 2025
f7fe10c
publishing
crogoz Feb 10, 2025
374729d
cleanup circle configs
crogoz Feb 10, 2025
09cd140
configurations
crogoz Feb 11, 2025
6fd3877
cleanup
crogoz Feb 11, 2025
7e0c6c7
cleanup
crogoz Feb 11, 2025
bb5c552
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz Feb 11, 2025
e37e8e3
wip
crogoz Feb 11, 2025
be60611
wip
crogoz Feb 11, 2025
7113b17
wip
crogoz Feb 12, 2025
760922c
spotless
crogoz Feb 12, 2025
1191756
different plugin
crogoz Feb 12, 2025
ca6969b
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz Feb 12, 2025
a399b9e
.
crogoz Feb 12, 2025
1336054
wip
crogoz Feb 12, 2025
b0a1950
using gradle-utils
crogoz Feb 12, 2025
975ba5d
separate project
crogoz Feb 12, 2025
65bc162
Merge branch 'develop' into cr/graal-1
crogoz Feb 12, 2025
23b563f
name
crogoz Feb 12, 2025
8db364f
keep :
crogoz Feb 12, 2025
22a9f7d
fix path
crogoz Feb 13, 2025
8456625
publication
crogoz Feb 13, 2025
0825b1b
osExtension
crogoz Feb 13, 2025
561286d
change
crogoz Feb 13, 2025
c492501
circleci check publishLocal
crogoz Feb 13, 2025
4e1e128
glibc or musl
crogoz Feb 13, 2025
ecbc2ed
only bin or exe
crogoz Feb 13, 2025
cc3a0f2
publishing
crogoz Feb 14, 2025
adf33ac
if else CI
crogoz Feb 14, 2025
76ea3fc
fix getEnv
crogoz Feb 14, 2025
c8bc7a5
fix
crogoz Feb 14, 2025
3a8850d
typo
crogoz Feb 14, 2025
6b9fa1f
old circle-all job
crogoz Feb 14, 2025
072f22c
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz Feb 14, 2025
fa45c1e
fix native
crogoz Feb 14, 2025
67ab915
fix
crogoz Feb 17, 2025
0f28770
Merge branch 'develop' into cr/use-graal-image
crogoz Feb 17, 2025
c9e4c0f
.
crogoz Feb 17, 2025
fbf59e7
gradle utils
crogoz Feb 17, 2025
0d39ef0
spotless
crogoz Feb 17, 2025
25330df
formatDiff
crogoz Feb 18, 2025
0937083
cleanup
crogoz Feb 18, 2025
9421d1a
Merge branch 'cr/use-graal-image' into cr/21-with-graal
crogoz Feb 18, 2025
e92581d
reflection
crogoz Feb 18, 2025
8f22a3a
wip
crogoz Feb 18, 2025
53484ad
cleanup
crogoz Feb 18, 2025
d47bc98
cleanup
crogoz Feb 18, 2025
7e40b3a
cleanup
crogoz Feb 18, 2025
509e0d8
separate 21
crogoz Feb 18, 2025
c149cd0
rm file
crogoz Feb 18, 2025
b800735
.
crogoz Feb 18, 2025
1119558
.
crogoz Feb 19, 2025
3baf58a
transform
crogoz Feb 19, 2025
1f084a1
no usenativeImageClasspath
crogoz Feb 20, 2025
c3186d0
Merge branch 'cr/use-graal-image' into cr/21-with-graal
crogoz Feb 20, 2025
9d34e07
Merge branch 'develop' into cr/21-with-graal
crogoz Feb 28, 2025
9fc2a0e
reflection, tests on 21, configuration of palantir-java-format
crogoz Mar 3, 2025
6b91edb
Add generated changelog entries
svc-changelog Mar 3, 2025
56e0514
fixes
crogoz Mar 3, 2025
d52e27b
Merge branch 'cr/21-with-graal' of github.com:palantir/palantir-java-…
crogoz Mar 3, 2025
76ff02b
fix test
crogoz Mar 3, 2025
75cc00f
fixes
crogoz Mar 3, 2025
95cf36a
fix dependencies
crogoz Mar 4, 2025
a91bb6e
fix
crogoz Mar 4, 2025
ab167a3
run tests with java21
crogoz Mar 4, 2025
cf73515
spotless
crogoz Mar 4, 2025
f4417c4
allow _ in binding pattern
crogoz Mar 5, 2025
8c9e58c
palantir java format
crogoz Mar 5, 2025
a36dd7b
tests not working?
crogoz Mar 5, 2025
69f5bbc
tests not working?
crogoz Mar 5, 2025
eca861b
Merge branch 'cr/21-with-graal' of github.com:palantir/palantir-java-…
crogoz Mar 5, 2025
8c34ee5
test
crogoz Mar 5, 2025
494d543
one last test is failing
crogoz Mar 6, 2025
0bb310b
move to palantir-java-format-tests
crogoz Mar 6, 2025
2ca81c6
.
crogoz Mar 7, 2025
c70baf8
Merge branch 'develop' into cr/21-with-graal
crogoz Mar 10, 2025
73f14e3
Merge branch 'develop' into cr/21-with-graal
crogoz Mar 10, 2025
2987918
reflowing is not currently supported in intellij plugin - fix in anot…
crogoz Mar 10, 2025
5ca751c
back to 17
crogoz Mar 10, 2025
ff54182
javaVersion
crogoz Mar 10, 2025
e1eba56
no newlines
crogoz Mar 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge branch 'develop' into cr/21-with-graal
  • Loading branch information
crogoz committed Mar 10, 2025
commit c70baf814cfe2c9ef964b0d3fd5f682a25f6cccd
14 changes: 6 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ subprojects {
apply plugin: 'java-library'
apply plugin: 'org.inferred.processors'

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

tasks.withType(Checkstyle).configureEach {
enabled = false
}
Expand All @@ -68,21 +71,16 @@ subprojects {
}

javaVersions {
libraryTarget = 17
runtime = 17
libraryTarget = 21
runtime = 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libraryTarget implies runtime, I think we can just leave this out to keep it like our other Gradle plugins.

}

jdks {
daemonTarget = 17
daemonTarget = 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need daemonTarget 21?

Copy link
Contributor Author

@crogoz crogoz Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, but since everything else would use java 21, I thought it is OK to move the daemon as well.
Moved it back to 17 5ca751c


jdk(23) {
distribution = 'graalvm-ce'
jdkVersion = '23.0.1'
}

}

javaVersions {
libraryTarget = 17
runtime = 17
}
2 changes: 1 addition & 1 deletion eclipse_plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ p2deps {
}

dependencies {
implementation project(':palantir-java-format-all')
implementation project(':palantir-java-format')
}

tasks.named("jar", Jar) {
Expand Down
5 changes: 2 additions & 3 deletions gradle-palantir-java-format/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ tasks.register("copyNativeImage", Copy.class) {
into("$buildDir/nativeImage")
}

def writeClasspathsForTests = tasks.register("writeClasspathsForTests") {
def writeImplClasspath = tasks.register("writeImplClasspath") {
inputs.files(tasks.named("copyNativeImage"))
doLast {
file("$buildDir/impl.classpath").text = configurations.impl.asPath
Expand All @@ -110,6 +110,5 @@ def writeClasspathsForTests = tasks.register("writeClasspathsForTests") {
}

tasks.named("test").configure {
dependsOn(writeClasspathsForTests)
dependsOn(writeImplClasspath)
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.palantir.javaformat.gradle
package com.palantir.javaformat.gradle;

import com.google.common.base.Splitter
import com.palantir.javaformat.bootstrap.BootstrappingFormatterService
Expand Down
1 change: 1 addition & 0 deletions idea-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

apply plugin: 'java'
apply plugin: 'com.palantir.external-publish-intellij'

def name = "palantir-java-format"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public void tearDown() throws Exception {

@Test
public void defaultFormatSettings() throws Exception {
String input = Files.readString(Paths.get(
"../palantir-java-format-tests/src/test/resources/com/palantir/javaformat/java/testdata/A.input"));
String output = Files.readString(Path.of(
"../palantir-java-format-tests/src/test/resources/com/palantir/javaformat/java/testdata/A.output"));
String input = Files.readString(
Paths.get("../palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.input"));
String output = Files.readString(
Path.of("../palantir-java-format/src/test/resources/com/palantir/javaformat/java/testdata/A.output"));
PsiFile file = createPsiFile("com/foo/FormatTest.java", input);
ReformatCodeProcessor processor = new ReformatCodeProcessor(file, false);
WriteCommandAction.runWriteCommandAction(file.getProject(), () -> {
Expand Down
51 changes: 0 additions & 51 deletions palantir-java-format-21/build.gradle

This file was deleted.

101 changes: 0 additions & 101 deletions palantir-java-format-all/build.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class BenchmarkState {
private static List<String> getFilesToFormat() {
Path srcJavaFormatFiles = Paths.get(".")
.toAbsolutePath()
.resolve("../palantir-java-format-all/src/main/java/com/palantir/javaformat/java");
.resolve("../palantir-java-format/src/main/java/com/palantir/javaformat/java");
try (Stream<String> paths = Files.list(srcJavaFormatFiles)
.filter(Files::isRegularFile)
.map(path -> path.toAbsolutePath().toString())) {
Expand Down
1 change: 0 additions & 1 deletion palantir-java-format-jdk-bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind'

// So that we have pjf on our test classpath
// TODO(crogoz)
testImplementation project(':palantir-java-format')
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.assertj:assertj-core'
Expand Down
5 changes: 0 additions & 5 deletions palantir-java-format-native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,3 @@ configurations {
}
}
}

javaVersion {
target = 21
runtime = 21
}
5 changes: 0 additions & 5 deletions palantir-java-format-spi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,3 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
}

tasks.withType(JavaCompile).named('compileJava') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved all the *Compatibility blocks to the root build.gradle in the subprojects block. We need to set the sourceCompatibility for groovy sourceSets as well, so I think it is better to always set the source & target compatibility to 11

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to set the sourceCompatibility for the groovy source sets too? If we can, I'd like to contain this strangeness to just the place that needs, ie the code for running the actual formatter

Copy link
Contributor

@CRogers CRogers Mar 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might avoid being able to do this by keeping libraryTarget = 17 on the root project (so the gradle plugin, idea plugin etc use 17) then putting libraryTarget = 21 on the palantir-java-format and palantir-java-format-spi projects

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I mean target = 21 in the subprojects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed in ff54182

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
15 changes: 0 additions & 15 deletions palantir-java-format-tests/build.gradle

This file was deleted.

This file was deleted.

50 changes: 48 additions & 2 deletions palantir-java-format/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,53 @@
apply plugin: 'application'
apply plugin: 'com.palantir.external-publish-jar'

mainClassName = 'com.palantir.javaformat.java.Main'

description = 'Palantir Java Format'

dependencies {
api project(':palantir-java-format-all')
api project(':palantir-java-format-21')
api project(':palantir-java-format-spi')
api 'com.google.guava:guava'
implementation 'org.functionaljava:functionaljava'
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
implementation 'com.fasterxml.jackson.module:jackson-module-parameter-names'

testImplementation 'com.google.guava:guava-testlib'
testImplementation 'com.google.truth:truth'
testImplementation 'com.google.testing.compile:compile-testing'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.junit.jupiter:junit-jupiter-migrationsupport'
testImplementation 'org.junit.jupiter:junit-jupiter'

compileOnly 'com.google.auto.service:auto-service'
annotationProcessor 'com.google.auto.service:auto-service'
compileOnly "org.immutables:value::annotations"
annotationProcessor "org.immutables:value"

compileOnly 'org.derive4j:derive4j-annotation'
annotationProcessor 'org.derive4j:derive4j'
}

moduleJvmArgs {
exports().addAll(
'jdk.compiler/com.sun.tools.javac.file',
'jdk.compiler/com.sun.tools.javac.main',
'jdk.compiler/com.sun.tools.javac.parser',
'jdk.compiler/com.sun.tools.javac.tree',
'jdk.compiler/com.sun.tools.javac.util',
'jdk.compiler/com.sun.tools.javac.code',
'jdk.compiler/com.sun.tools.javac.api')
}

// false positives due to org.junit.runners.* in the test cases
tasks.named("checkJUnitDependencies") {
enabled = false
}

tasks.named("test") {
// Run all classes and tests in parallel
// https://junit.org/junit5/docs/current/user-guide/#writing-tests-parallel-execution
systemProperty 'junit.jupiter.execution.parallel.mode.default', 'concurrent'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (c) Copyright 2024 Palantir Technologies Inc. All rights reserved.
* (c) Copyright 2025 Palantir Technologies Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,7 @@
* Extends {@link Java14InputAstVisitor} with support for AST nodes that were added or modified in
* Java 21.
*/
@SuppressWarnings("Since21")
public class Java21InputAstVisitor extends Java14InputAstVisitor {
public Java21InputAstVisitor(OpsBuilder builder, int indentMultiplier) {
super(builder, indentMultiplier);
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.