Skip to content

Commit 396d2aa

Browse files
committed
Java 21: review reformart code + default gradle jdk compatibility
1 parent c8e90f3 commit 396d2aa

File tree

10 files changed

+5
-31
lines changed

10 files changed

+5
-31
lines changed

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ subprojects {
4747
apply plugin: 'java-library'
4848
apply plugin: 'org.inferred.processors'
4949

50-
50+
sourceCompatibility = 11
51+
targetCompatibility = 11
5152

5253
tasks.withType(Checkstyle) {
5354
enabled = false

gradle-palantir-java-format/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ configurations {
88
implicitDependencies
99
pluginClasspath
1010
}
11-
java{
12-
sourceCompatibility = 11
13-
targetCompatibility = 11
14-
}
11+
1512

1613
dependencies {
1714
implementation gradleApi()

idea-plugin/build.gradle

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ configurations {
5151
}
5252
}
5353

54-
java{
55-
sourceCompatibility = 11
56-
targetCompatibility = 11
57-
}
5854

5955
dependencies {
6056
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ def exports = [
4343
'jdk.compiler/com.sun.tools.javac.api'
4444
]
4545

46-
java{
47-
sourceCompatibility = 11
48-
targetCompatibility = 11
49-
}
5046

5147
def jvmArgList = exports.stream().map(new Function<String, String>() {
5248
@Override
@@ -64,7 +60,6 @@ tasks.withType(JavaCompile).configureEach {
6460
if (JavaVersion.current() < JavaVersion.VERSION_14) {
6561
exclude '**/Java14InputAstVisitor.java'
6662
}
67-
6863
}
6964

7065
tasks.withType(Test).configureEach {
@@ -93,7 +88,7 @@ tasks.test {
9388

9489
// necessary to compile Java14InputAstVisitor
9590
idea {
96-
module.languageLevel = new org.gradle.plugins.ide.idea.model.IdeaLanguageLevel(17)
91+
module.languageLevel = new org.gradle.plugins.ide.idea.model.IdeaLanguageLevel(14)
9792
}
9893

9994
// This block may be replaced by BaselineExportsExtension exports
@@ -106,8 +101,7 @@ jar {
106101

107102
tasks.named('jar', Jar){
108103
// hack to get java21 Class ...
109-
// the build script should be completely review to handle java 21
104+
// the build script should be completely rewritten to handle java 21
110105
from ('build/classes/java/main', '../palantir-java-format21/build/classes/java/main')
111-
112106
include('**/*')
113107
}

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)