diff --git a/pom.xml b/pom.xml
index ae6adcc..b7c846d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,6 +159,9 @@
org.openrewrite.java.migrate.UpgradeToJava17
+ org.openrewrite.staticanalysis.JavaApiBestPractices
+ org.openrewrite.staticanalysis.CommonStaticAnalysis
+ org.openrewrite.staticanalysis.CodeCleanup
diff --git a/src/main/java/de/kreth/property2java/Configuration.java b/src/main/java/de/kreth/property2java/Configuration.java
index c4ddff7..3227a61 100644
--- a/src/main/java/de/kreth/property2java/Configuration.java
+++ b/src/main/java/de/kreth/property2java/Configuration.java
@@ -59,8 +59,7 @@ public interface Configuration {
String path = Regex.PATTERN.matcher(fileName).replaceAll(".").replaceAll("\\.", "_").replaceAll(" ", "_")
.replaceAll("/", "_");
- path = WordUtils.capitalize(path, '_');
- return path;
+ return WordUtils.capitalize(path, '_');
}
}
diff --git a/src/main/java/de/kreth/property2java/Generator.java b/src/main/java/de/kreth/property2java/Generator.java
index 07ac05d..1bb883c 100644
--- a/src/main/java/de/kreth/property2java/Generator.java
+++ b/src/main/java/de/kreth/property2java/Generator.java
@@ -75,13 +75,13 @@ public class Generator {
root.put("fileName", fileName);
root.put("bundle_base_name", fileName.substring(0, min(fileName.length(), fileName.lastIndexOf('.'))));
root.put("classname", config.mapFilenameToClassName(fileName));
- if (config.getOptions().isEmpty() == false) {
+ if (!config.getOptions().isEmpty()) {
root.put("options", config.getOptions());
List imports = config.getOptions().stream()
.map(GeneratorOptions::getAdditionalImport)
.flatMap(Arrays::stream)
.collect(Collectors.toList());
- if (imports.isEmpty() == false) {
+ if (!imports.isEmpty()) {
root.put("imports", imports);
}
}
diff --git a/src/main/java/de/kreth/property2java/GeneratorOptions.java b/src/main/java/de/kreth/property2java/GeneratorOptions.java
index b72b374..5b39e69 100644
--- a/src/main/java/de/kreth/property2java/GeneratorOptions.java
+++ b/src/main/java/de/kreth/property2java/GeneratorOptions.java
@@ -15,7 +15,7 @@ public enum GeneratorOptions {
private final String[] additionalImport;
private GeneratorOptions(String... additionalImport) {
- this.additionalImport = additionalImport!= null ? additionalImport : new String[] {};
+ this.additionalImport = additionalImport!= null ? additionalImport : new String[]{};
}
String[] getAdditionalImport() {
diff --git a/src/main/java/de/kreth/property2java/cli/ArgumentConfiguration.java b/src/main/java/de/kreth/property2java/cli/ArgumentConfiguration.java
index c8d8b7c..3fee716 100644
--- a/src/main/java/de/kreth/property2java/cli/ArgumentConfiguration.java
+++ b/src/main/java/de/kreth/property2java/cli/ArgumentConfiguration.java
@@ -14,7 +14,7 @@ import java.util.Map;
import de.kreth.property2java.Configuration;
-public class ArgumentConfiguration implements Configuration {
+public final class ArgumentConfiguration implements Configuration {
private final String packageName;
@@ -51,7 +51,7 @@ public class ArgumentConfiguration implements Configuration {
@Override
public Writer outWriter(String fileName) throws IOException {
File dir;
- if (packageName != null && packageName.isBlank() == false) {
+ if (packageName != null && !packageName.isBlank()) {
dir = new File(rootPath.toFile(), packageName.replace('.', File.separatorChar));
} else {
dir = rootPath.toFile();
diff --git a/src/main/java/de/kreth/property2java/config/Regex.java b/src/main/java/de/kreth/property2java/config/Regex.java
index 597222a..f06b225 100644
--- a/src/main/java/de/kreth/property2java/config/Regex.java
+++ b/src/main/java/de/kreth/property2java/config/Regex.java
@@ -5,4 +5,7 @@ import java.util.regex.Pattern;
public class Regex {
public static final Pattern PATTERN = Pattern.compile("_[a-z]{2}(_[A-Z]{2})?\\.");
+
+ private Regex() {
+ }
}
diff --git a/src/main/java/de/kreth/property2java/processor/ProcessorConfiguration.java b/src/main/java/de/kreth/property2java/processor/ProcessorConfiguration.java
index 1fefdf9..f170ffa 100644
--- a/src/main/java/de/kreth/property2java/processor/ProcessorConfiguration.java
+++ b/src/main/java/de/kreth/property2java/processor/ProcessorConfiguration.java
@@ -90,7 +90,7 @@ public class ProcessorConfiguration implements Configuration {
return new Builder(filer, element);
}
- static class Builder {
+ static final class Builder {
public GeneratorOptions[] options;
private final Filer filer;
private final Element element;
diff --git a/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java b/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java
index 576eb4e..5fd600b 100644
--- a/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java
+++ b/src/main/java/de/kreth/property2java/processor/Property2JavaGenerator.java
@@ -20,9 +20,9 @@ import de.kreth.property2java.Format;
import de.kreth.property2java.GeneratorException;
import de.kreth.property2java.GeneratorOptions;
-@SupportedAnnotationTypes({ "de.kreth.property2java.processor.GenerateProperty2Java",
+@SupportedAnnotationTypes({"de.kreth.property2java.processor.GenerateProperty2Java",
"de.kreth.property2java.processor.GenerateResourceBundleProperty2Javas",
- "de.kreth.property2java.processor.GenerateResourceBundleProperty2Java" })
+ "de.kreth.property2java.processor.GenerateResourceBundleProperty2Java"})
@SupportedSourceVersion(SourceVersion.RELEASE_8)
public class Property2JavaGenerator extends AbstractProcessor {