diff --git a/build.gradle b/build.gradle index 38bade70..811ac11c 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,8 @@ subprojects { apply plugin: 'java-library' apply plugin: 'org.inferred.processors' - + sourceCompatibility = 11 + targetCompatibility = 11 tasks.withType(Checkstyle) { enabled = false diff --git a/gradle-palantir-java-format/build.gradle b/gradle-palantir-java-format/build.gradle index ec2f514b..51813b73 100644 --- a/gradle-palantir-java-format/build.gradle +++ b/gradle-palantir-java-format/build.gradle @@ -8,10 +8,7 @@ configurations { implicitDependencies pluginClasspath } -java{ - sourceCompatibility = 11 - targetCompatibility = 11 -} + dependencies { implementation gradleApi() diff --git a/idea-plugin/build.gradle b/idea-plugin/build.gradle index 4df0292d..77c16a60 100644 --- a/idea-plugin/build.gradle +++ b/idea-plugin/build.gradle @@ -51,10 +51,6 @@ configurations { } } -java{ - sourceCompatibility = 11 - targetCompatibility = 11 -} dependencies { implementation project(':palantir-java-format-jdk-bootstrap') diff --git a/palantir-java-format-jdk-bootstrap/build.gradle b/palantir-java-format-jdk-bootstrap/build.gradle index 7e5c1d47..9348a282 100644 --- a/palantir-java-format-jdk-bootstrap/build.gradle +++ b/palantir-java-format-jdk-bootstrap/build.gradle @@ -2,11 +2,6 @@ apply plugin: 'java-library' apply plugin: 'com.palantir.external-publish-jar' apply plugin: 'com.palantir.revapi' -java{ - sourceCompatibility = 11 - targetCompatibility = 11 -} - dependencies { annotationProcessor "org.immutables:value" diff --git a/palantir-java-format-spi/build.gradle b/palantir-java-format-spi/build.gradle index 3d434a77..5f9171a1 100644 --- a/palantir-java-format-spi/build.gradle +++ b/palantir-java-format-spi/build.gradle @@ -2,10 +2,6 @@ apply plugin: 'java-library' apply plugin: 'com.palantir.external-publish-jar' apply plugin: 'com.palantir.revapi' -java{ - sourceCompatibility = 11 - targetCompatibility = 11 -} dependencies { api 'com.google.guava:guava' diff --git a/palantir-java-format/build.gradle b/palantir-java-format/build.gradle index f1e8a3bd..59038ae9 100644 --- a/palantir-java-format/build.gradle +++ b/palantir-java-format/build.gradle @@ -43,10 +43,6 @@ def exports = [ 'jdk.compiler/com.sun.tools.javac.api' ] -java{ - sourceCompatibility = 11 - targetCompatibility = 11 -} def jvmArgList = exports.stream().map(new Function() { @Override @@ -64,7 +60,6 @@ tasks.withType(JavaCompile).configureEach { if (JavaVersion.current() < JavaVersion.VERSION_14) { exclude '**/Java14InputAstVisitor.java' } - } tasks.withType(Test).configureEach { @@ -93,7 +88,7 @@ tasks.test { // necessary to compile Java14InputAstVisitor idea { - module.languageLevel = new org.gradle.plugins.ide.idea.model.IdeaLanguageLevel(17) + module.languageLevel = new org.gradle.plugins.ide.idea.model.IdeaLanguageLevel(14) } // This block may be replaced by BaselineExportsExtension exports @@ -106,8 +101,7 @@ jar { tasks.named('jar', Jar){ // hack to get java21 Class ... - // the build script should be completely review to handle java 21 + // the build script should be completely rewritten to handle java 21 from ('build/classes/java/main', '../palantir-java-format21/build/classes/java/main') - include('**/*') } diff --git a/palantir-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java b/palantir-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java index b1540ccb..6237b561 100644 --- a/palantir-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java +++ b/palantir-java-format/src/main/java/com/palantir/javaformat/java/Formatter.java @@ -131,7 +131,6 @@ static JavaOutput format( OpsBuilder opsBuilder = new OpsBuilder(javaInput); JavaInputAstVisitor visitor; - if (getRuntimeVersion() >= 21) { try { visitor = Class.forName("com.palantir.javaformat.java.java21.Java21InputAstVisitor") diff --git a/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInput.java b/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInput.java index ec72f3fb..12bfb170 100644 --- a/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInput.java +++ b/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInput.java @@ -447,7 +447,6 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept if (stringFragmentKind) { stringFragmentEndPos = t.endPos(); } - } else if (tokText.startsWith("//") || tokText.startsWith("/*")) { // For compatibility with an earlier lexer, the newline after a // comment is its own tok. if (tokText.startsWith("//") && (originalTokText.endsWith("\n") || originalTokText.endsWith("\r"))) { diff --git a/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java b/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java index 930f4ae1..b4428c64 100644 --- a/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java +++ b/palantir-java-format/src/main/java/com/palantir/javaformat/java/JavaInputAstVisitor.java @@ -394,7 +394,6 @@ protected void handleModule(boolean first, CompilationUnitTree node) {} /** Skips over extra semi-colons at the top-level, or in a class member declaration lists. */ protected void dropEmptyDeclarations() { - if (builder.peekToken().equals(Optional.of(";"))) { while (builder.peekToken().equals(Optional.of(";"))) { builder.forcedBreak(); diff --git a/palantir-java-format21/src/main/java/com/palantir/javaformat/java/java21/Java21InputAstVisitor.java b/palantir-java-format21/src/main/java/com/palantir/javaformat/java/java21/Java21InputAstVisitor.java index 0245375f..837d6ad6 100644 --- a/palantir-java-format21/src/main/java/com/palantir/javaformat/java/java21/Java21InputAstVisitor.java +++ b/palantir-java-format21/src/main/java/com/palantir/javaformat/java/java21/Java21InputAstVisitor.java @@ -78,8 +78,6 @@ public Void visitDeconstructionPattern(DeconstructionPatternTree node, Void unus Void r = scan(node.getDeconstructor(), unused); token("("); - - // r = scanAndReduceVoid(, unused, r); boolean firstInRow = true; for (PatternTree item : node.getNestedPatterns()) { if (!firstInRow) {