Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ jobs:
- name: 'Test'
shell: bash
run: mvn test -B
- name: 'SanityCheck'
shell: bash
run: mvn rewrite:dryRun
- name: 'Javadoc'
shell: bash
run: mvn -P '!examples' javadoc:javadoc
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

# intellij
.idea/ant.xml
.idea/codestream.xml
.idea/checkstyle-idea.xml
.idea/codeStyleSettings.xml
.idea/codestream.xml
.idea/compiler.xml
.idea/copyright
.idea/dataSources.ids
Expand All @@ -21,6 +22,7 @@
.idea/libraries
.idea/misc.xml
.idea/modules.xml
.idea/palantir-java-format.xml
.idea/shelf
.idea/tasks.xml
.idea/uiDesigner.xml
Expand Down
12 changes: 12 additions & 0 deletions check_api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<artifactId>jspecify</artifactId>
<version>${jspecify.version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<!-- GPLv2 with Classpath Exception -->
<groupId>io.github.eisop</groupId>
Expand Down Expand Up @@ -103,6 +109,12 @@
<version>${truth.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
Copy link
Author

Choose a reason for hiding this comment

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

java migration

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what this means, why was this change made?

Copy link
Author

Choose a reason for hiding this comment

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

yes this is kind of new to everyone but seems best practise:

Copy link
Author

@Pankraz76 Pankraz76 Nov 12, 2025

Choose a reason for hiding this comment

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

its needed as part of upcomming javax to jakarta bump, so its kind of required:

PRO tip: here its not included due to maven ignorance but this is kind of bug it system design.

<version>1.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- MIT -->
<groupId>org.mockito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.sun.tools.javac.tree.EndPosTable;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import java.net.URI;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -68,7 +68,7 @@ private DescriptionBasedDiff(
URI sourceFileUri = compilationUnit.getSourceFile().toUri();
this.sourcePath =
(sourceFileUri.isAbsolute() && Objects.equals(sourceFileUri.getScheme(), "file"))
? Paths.get(sourceFileUri).toAbsolutePath().toString()
? Path.of(sourceFileUri).toAbsolutePath().toString()
: sourceFileUri.getPath();
this.ignoreOverlappingFixes = ignoreOverlappingFixes;
this.importsToAdd = new LinkedHashSet<>();
Expand Down
11 changes: 11 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
<artifactId>pcollections</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<!-- Apache 2.0 -->
<groupId>com.google.guava</groupId>
Expand All @@ -99,6 +105,11 @@
<artifactId>dataflow-errorprone</artifactId>
<version>${dataflow.version}</version>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<!-- Apache 2.0 -->
<groupId>com.google.auto.value</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import com.sun.tools.javac.util.List;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Optional;
import java.util.stream.Stream;

Expand Down Expand Up @@ -98,13 +98,13 @@ enum ConfigParser {
AS_STRINGS {
@Override
MethodPredicate load(String file) throws IOException {
return configByInterpretingMethodsAsStrings(MoreFiles.asCharSource(Paths.get(file), UTF_8));
return configByInterpretingMethodsAsStrings(MoreFiles.asCharSource(Path.of(file), UTF_8));
}
},
PARSE_TOKENS {
@Override
MethodPredicate load(String file) throws IOException {
return configByParsingApiObjects(MoreFiles.asCharSource(Paths.get(file), UTF_8));
return configByParsingApiObjects(MoreFiles.asCharSource(Path.of(file), UTF_8));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.stream.Stream;
Expand Down Expand Up @@ -215,7 +214,7 @@ public void applyToPatchFile() throws IOException {
assertThat(
Files.readAllLines(patchFile, UTF_8).stream()
.filter(l -> l.startsWith("--- "))
.map(l -> Paths.get(l.substring("--- ".length())).getFileName().toString())
.map(l -> Path.of(l.substring("--- ".length())).getFileName().toString())
.collect(toImmutableList()))
.containsExactly("A.java", "B.java");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributes;
Expand Down Expand Up @@ -62,7 +61,7 @@ public SourceBuilder(File tempFolder) {

@CanIgnoreReturnValue
public SourceBuilder addSourceLines(String name, String... lines) throws IOException {
Path filePath = Paths.get(tempFolder.getAbsolutePath(), name);
Path filePath = Path.of(tempFolder.getAbsolutePath(), name);
sources.add(filePath);
Files.write(filePath, Arrays.asList(lines), UTF_8, StandardOpenOption.CREATE);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -110,7 +109,7 @@ public boolean processLine(String line) throws IOException {
}

// replace spaces in filename with underscores
Path checkPath = Paths.get(pattern.name.replace(' ', '_') + ".md");
Path checkPath = Path.of(pattern.name.replace(' ', '_') + ".md");

try (Writer writer = Files.newBufferedWriter(outputDir.resolve(checkPath), UTF_8)) {

Expand Down
7 changes: 3 additions & 4 deletions docgen/src/main/java/com/google/errorprone/DocGenTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -93,15 +92,15 @@ public static void main(String[] args) throws IOException {
Options options = new Options();
new JCommander(options).parse(args);

Path bugPatterns = Paths.get(options.bugPatterns);
Path bugPatterns = Path.of(options.bugPatterns);
if (!Files.exists(bugPatterns)) {
usage("Cannot find bugPatterns file: " + options.bugPatterns);
}
Path explanationDir = Paths.get(options.explanations);
Path explanationDir = Path.of(options.explanations);
if (!Files.exists(explanationDir)) {
usage("Cannot find explanations dir: " + options.explanations);
}
Path wikiDir = Paths.get(options.docsRepository);
Path wikiDir = Path.of(options.docsRepository);
Files.createDirectories(wikiDir);
Path bugpatternDir = wikiDir.resolve("bugpattern");
if (!Files.exists(bugpatternDir)) {
Expand Down
6 changes: 6 additions & 0 deletions docgen_processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service-annotations</artifactId>
Expand Down
31 changes: 31 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,40 @@
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>6.23.0</version>
<configuration>
<activeRecipes>
<recipe>com.google.openrewrite.SanityCheck</recipe>
</activeRecipes>
<exclusions>
<exclusion>**/refaster/testdata/**</exclusion>
</exclusions>
<exportDatatables>true</exportDatatables>
<failOnDryRunResults>true</failOnDryRunResults>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>3.21.1</version>
</dependency>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-rewrite</artifactId>
<version>0.15.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions rewrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
type: specs.openrewrite.org/v1beta/recipe
name: com.google.openrewrite.SanityCheck
displayName: Apply Java & Maven best practices
description: Comprehensive code quality recipe combining modernization, security, and best practices.
recipeList:
- org.openrewrite.java.migrate.Java8toJava11
---