Skip to content

Commit c5a0bc7

Browse files
committed
Java 21: review reformart code + default gradle jdk compatibility
1 parent f463c2c commit c5a0bc7

File tree

10 files changed

+5
-25
lines changed

10 files changed

+5
-25
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ subprojects {
5050
apply plugin: 'java-library'
5151
apply plugin: 'org.inferred.processors'
5252

53-
53+
sourceCompatibility = 11
54+
targetCompatibility = 11
5455

5556
tasks.withType(Checkstyle).configureEach {
5657
enabled = false

gradle-palantir-java-format/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ configurations {
1010
canBeResolved = true
1111
}
1212
}
13-
java{
14-
sourceCompatibility = 11
15-
targetCompatibility = 11
16-
}
13+
1714

1815
dependencies {
1916
compileOnly 'com.diffplug.spotless:spotless-plugin-gradle'

idea-plugin/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ configurations {
6161
}
6262
}
6363

64-
java{
65-
sourceCompatibility = 11
66-
targetCompatibility = 11
67-
}
6864

6965
dependencies {
7066
implementation project(':palantir-java-format-jdk-bootstrap')

palantir-java-format-jdk-bootstrap/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ apply plugin: 'java-library'
22
apply plugin: 'com.palantir.external-publish-jar'
33
apply plugin: 'com.palantir.revapi'
44

5-
java{
6-
sourceCompatibility = 11
7-
targetCompatibility = 11
8-
}
9-
105
dependencies {
116
annotationProcessor "org.immutables:value"
127

palantir-java-format-spi/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ apply plugin: 'java-library'
22
apply plugin: 'com.palantir.external-publish-jar'
33
apply plugin: 'com.palantir.revapi'
44

5-
java{
6-
sourceCompatibility = 11
7-
targetCompatibility = 11
8-
}
95

106
dependencies {
117
api 'com.google.guava:guava'

palantir-java-format/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ tasks.withType(JavaCompile).configureEach {
5353
if (JavaVersion.current() < JavaVersion.VERSION_14) {
5454
excludes = ['**/Java14InputAstVisitor.java']
5555
}
56+
5657
}
5758

5859
tasks.withType(Test).configureEach {
@@ -94,8 +95,7 @@ tasks.named("jar", Jar) {
9495

9596
tasks.named('jar', Jar){
9697
// hack to get java21 Class ...
97-
// the build script should be completely review to handle java 21
98+
// the build script should be completely rewritten to handle java 21
9899
from ('build/classes/java/main', '../palantir-java-format21/build/classes/java/main')
99-
100100
include('**/*')
101101
}

palantir-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ static JavaOutput format(
131131
OpsBuilder opsBuilder = new OpsBuilder(javaInput);
132132

133133
JavaInputAstVisitor visitor;
134-
135134
if (getRuntimeVersion() >= 21) {
136135
try {
137136
visitor = Class.forName("com.palantir.javaformat.java.java21.Java21InputAstVisitor")

palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInput.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
447447
if (stringFragmentKind) {
448448
stringFragmentEndPos = t.endPos();
449449
}
450-
451450
} else if (tokText.startsWith("//") || tokText.startsWith("/*")) {
452451
// For compatibility with an earlier lexer, the newline after a // comment is its own tok.
453452
if (tokText.startsWith("//") && (originalTokText.endsWith("\n") || originalTokText.endsWith("\r"))) {

palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ protected void handleModule(boolean first, CompilationUnitTree node) {}
394394

395395
/** Skips over extra semi-colons at the top-level, or in a class member declaration lists. */
396396
protected void dropEmptyDeclarations() {
397-
398397
if (builder.peekToken().equals(Optional.of(";"))) {
399398
while (builder.peekToken().equals(Optional.of(";"))) {
400399
builder.forcedBreak();

palantir-java-format21/src/main/java/com/palantir/javaformat/java/java21/Java21InputAstVisitor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ public Void visitDeconstructionPattern(DeconstructionPatternTree node, Void unus
7878

7979
Void r = scan(node.getDeconstructor(), unused);
8080
token("(");
81-
82-
// r = scanAndReduceVoid(, unused, r);
8381
boolean firstInRow = true;
8482
for (PatternTree item : node.getNestedPatterns()) {
8583
if (!firstInRow) {

0 commit comments

Comments
 (0)