-
Notifications
You must be signed in to change notification settings - Fork 83
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
Changes from all commits
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
a67bad9
bump java
eholmer1 e658a4f
Remove tests for handling of extra semi-colons
cushon 065c379
Add support for guard clauses in Java 21 switch expressions
TheCK 2f58013
Initial support for pattern matching in switches
cushon 640ca01
format
CRogers 52712d6
add benchmarks
crogoz 217a7b0
.
crogoz 0618efc
.
crogoz fa35c61
spotlessApply
crogoz ef7b081
test?
crogoz 25d20ea
some nativeImage
crogoz e5e8492
execute permissions
crogoz a73f12f
executable
crogoz 5de0181
working transforms
crogoz c475f83
add replacement reflect classes for native-image
crogoz 07a2d0e
.
crogoz b1119e2
bump gradle-jdks version
crogoz 0fbf044
Add generated changelog entries
svc-changelog 782f075
Add generated changelog entries
svc-changelog 25bce25
natieImage
crogoz 6d346d9
Merge branch 'cr/graal-1' of github.com:palantir/palantir-java-format…
crogoz 2a2d086
spotless
crogoz 320c77e
gradlew
crogoz d1323a4
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz 12f2b1d
compatibility
crogoz 4c058df
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz b9a2cc5
OS as part of classifier
crogoz cbccc19
configurable
crogoz 2b0d8f9
fix tests
crogoz ce67ada
no log line
crogoz 0f01291
no logging
crogoz ddad367
use gradle utils
crogoz f7fe10c
publishing
crogoz 374729d
cleanup circle configs
crogoz 09cd140
configurations
crogoz 6fd3877
cleanup
crogoz 7e0c6c7
cleanup
crogoz bb5c552
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz e37e8e3
wip
crogoz be60611
wip
crogoz 7113b17
wip
crogoz 760922c
spotless
crogoz 1191756
different plugin
crogoz ca6969b
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz a399b9e
.
crogoz 1336054
wip
crogoz b0a1950
using gradle-utils
crogoz 975ba5d
separate project
crogoz 65bc162
Merge branch 'develop' into cr/graal-1
crogoz 23b563f
name
crogoz 8db364f
keep :
crogoz 22a9f7d
fix path
crogoz 8456625
publication
crogoz 0825b1b
osExtension
crogoz 561286d
change
crogoz c492501
circleci check publishLocal
crogoz 4e1e128
glibc or musl
crogoz ecbc2ed
only bin or exe
crogoz cc3a0f2
publishing
crogoz adf33ac
if else CI
crogoz 76ea3fc
fix getEnv
crogoz c8bc7a5
fix
crogoz 3a8850d
typo
crogoz 6b9fa1f
old circle-all job
crogoz 072f22c
Merge branch 'cr/graal-1' into cr/use-graal-image
crogoz fa45c1e
fix native
crogoz 67ab915
fix
crogoz 0f28770
Merge branch 'develop' into cr/use-graal-image
crogoz c9e4c0f
.
crogoz fbf59e7
gradle utils
crogoz 0d39ef0
spotless
crogoz 25330df
formatDiff
crogoz 0937083
cleanup
crogoz 9421d1a
Merge branch 'cr/use-graal-image' into cr/21-with-graal
crogoz e92581d
reflection
crogoz 8f22a3a
wip
crogoz 53484ad
cleanup
crogoz d47bc98
cleanup
crogoz 7e40b3a
cleanup
crogoz 509e0d8
separate 21
crogoz c149cd0
rm file
crogoz b800735
.
crogoz 1119558
.
crogoz 3baf58a
transform
crogoz 1f084a1
no usenativeImageClasspath
crogoz c3186d0
Merge branch 'cr/use-graal-image' into cr/21-with-graal
crogoz 9d34e07
Merge branch 'develop' into cr/21-with-graal
crogoz 9fc2a0e
reflection, tests on 21, configuration of palantir-java-format
crogoz 6b91edb
Add generated changelog entries
svc-changelog 56e0514
fixes
crogoz d52e27b
Merge branch 'cr/21-with-graal' of github.com:palantir/palantir-java-…
crogoz 76ff02b
fix test
crogoz 75cc00f
fixes
crogoz 95cf36a
fix dependencies
crogoz a91bb6e
fix
crogoz ab167a3
run tests with java21
crogoz cf73515
spotless
crogoz f4417c4
allow _ in binding pattern
crogoz 8c9e58c
palantir java format
crogoz a36dd7b
tests not working?
crogoz 69f5bbc
tests not working?
crogoz eca861b
Merge branch 'cr/21-with-graal' of github.com:palantir/palantir-java-…
crogoz 8c34ee5
test
crogoz 494d543
one last test is failing
crogoz 0bb310b
move to palantir-java-format-tests
crogoz 2ca81c6
.
crogoz c70baf8
Merge branch 'develop' into cr/21-with-graal
crogoz 73f14e3
Merge branch 'develop' into cr/21-with-graal
crogoz 2987918
reflowing is not currently supported in intellij plugin - fix in anot…
crogoz 5ca751c
back to 17
crogoz ff54182
javaVersion
crogoz e1eba56
no newlines
crogoz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| type: improvement | ||
| improvement: | ||
| description: Java 21 with Graal support | ||
| links: | ||
| - https://github.com/palantir/palantir-java-format/pull/1211 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * (c) Copyright 2019 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. | ||
|
|
@@ -16,27 +16,36 @@ | |
|
|
||
| package com.palantir.javaformat.gradle; | ||
|
|
||
| import com.google.common.base.Splitter | ||
| import com.palantir.javaformat.bootstrap.BootstrappingFormatterService | ||
| import com.palantir.javaformat.java.FormatterService | ||
| import org.junit.jupiter.params.ParameterizedTest | ||
| import org.junit.jupiter.params.provider.MethodSource | ||
|
|
||
| import java.util.stream.Stream | ||
|
|
||
| import static java.nio.charset.StandardCharsets.UTF_8; | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import com.google.common.collect.ImmutableList; | ||
| import com.google.common.io.ByteStreams; | ||
| import com.palantir.javaformat.java.FormatterServiceImpl; | ||
| import java.io.ByteArrayOutputStream; | ||
| import java.io.IOException; | ||
| import com.palantir.javaformat.bootstrap.NativeImageFormatterService; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.nio.file.Paths; | ||
| import java.util.List; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.stream.Collectors; | ||
| import org.junit.jupiter.api.Assertions; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.io.TempDir; | ||
|
|
||
| class FormatDiffTest { | ||
|
|
||
| private static final CLASSPATH_FILE = new File("build/impl.classpath") | ||
| private static final NATIVE_IMAGE_FILE = new File("build/nativeImage.path") | ||
|
|
||
| @TempDir | ||
| Path repo; | ||
|
|
||
|
|
@@ -58,8 +67,9 @@ void parsing_git_diff_output_works() throws IOException { | |
| strings); | ||
| } | ||
|
|
||
| @Test | ||
| void reformat_a_subpath_of_a_git_directory_for_only_changed_lines() throws IOException, InterruptedException { | ||
| @ParameterizedTest | ||
| @MethodSource("getFormatters") | ||
| void reformat_a_subpath_of_a_git_directory_for_only_changed_lines(FormatterService formatterService) throws IOException, InterruptedException { | ||
| runCommandInRepo("git", "init"); | ||
| runCommandInRepo("git", "config", "user.name", "Test User"); | ||
| runCommandInRepo("git", "config", "user.email", "[email protected]"); | ||
|
|
@@ -77,7 +87,7 @@ void reformat_a_subpath_of_a_git_directory_for_only_changed_lines() throws IOExc | |
|
|
||
| runCommandInRepo("git", "add", "-N", "."); | ||
|
|
||
| FormatDiff.formatDiff(subdir, new FormatterServiceImpl()); | ||
| FormatDiff.formatDiff(subdir, formatterService); | ||
|
|
||
| assertThat(reformatMe).hasContent("class ReformatMe {}"); | ||
| assertThat(dontTouchMe).hasContent(" class DontTouchMe {}"); | ||
|
|
@@ -95,4 +105,27 @@ private void runCommandInRepo(String... args) throws IOException, InterruptedExc | |
|
|
||
| Preconditions.checkState(process.exitValue() == 0, "Expected return code of 0: " + stderr); | ||
| } | ||
|
|
||
| private static Stream<FormatterService> getFormatters() { | ||
| return Stream.of( | ||
| new BootstrappingFormatterService( | ||
| javaBinPath(), Runtime.version().feature(), getClasspath()), | ||
| new NativeImageFormatterService( | ||
| Path.of(NATIVE_IMAGE_FILE.text))); | ||
| } | ||
|
|
||
| private static getClasspath() { | ||
| return Splitter.on(':') | ||
| .trimResults() | ||
| .omitEmptyStrings() | ||
| .splitToStream(CLASSPATH_FILE.text) | ||
| .map(Path::of) | ||
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| private static Path javaBinPath() { | ||
| String javaHome = Preconditions.checkNotNull(System.getProperty("java.home"), "java.home property not set"); | ||
| return Path.of(javaHome).resolve("bin").resolve("java"); | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libraryTargetimpliesruntime, I think we can just leave this out to keep it like our other Gradle plugins.