Skip to content

Commit 5ff7443

Browse files
timtebeekTeamModerne
authored andcommitted

File tree

4 files changed

+11
-28
lines changed

4 files changed

+11
-28
lines changed

src/main/java/org/openrewrite/java/migrate/JREThrowableFinalMethods.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
package org.openrewrite.java.migrate;
1717

1818
import com.fasterxml.jackson.annotation.JsonCreator;
19+
import lombok.AccessLevel;
1920
import lombok.EqualsAndHashCode;
2021
import lombok.Getter;
22+
import lombok.RequiredArgsConstructor;
2123
import org.openrewrite.ExecutionContext;
2224
import org.openrewrite.Preconditions;
2325
import org.openrewrite.Recipe;
@@ -31,6 +33,7 @@
3133
import org.openrewrite.java.tree.TypeUtils;
3234

3335
@EqualsAndHashCode(callSuper = false)
36+
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
3437
public class JREThrowableFinalMethods extends Recipe {
3538

3639
private final String methodPatternAddSuppressed;
@@ -42,14 +45,6 @@ public JREThrowableFinalMethods() {
4245
this.methodPatternGetSuppressed = "*..* getSuppressed()";
4346
}
4447

45-
/**
46-
* Overload constructor to allow for custom method patterns used in tests only.
47-
*/
48-
JREThrowableFinalMethods(String methodPatternAddSuppressed, String methodPatternGetSuppressed) {
49-
this.methodPatternAddSuppressed = methodPatternAddSuppressed;
50-
this.methodPatternGetSuppressed = methodPatternGetSuppressed;
51-
}
52-
5348
@Getter
5449
final String displayName = "Rename final method declarations `getSuppressed()` and `addSuppressed(Throwable exception)` in classes that extend `Throwable`";
5550

src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package org.openrewrite.java.migrate;
1717

18+
import lombok.AccessLevel;
1819
import lombok.EqualsAndHashCode;
20+
import lombok.RequiredArgsConstructor;
1921
import lombok.Value;
2022
import org.jspecify.annotations.Nullable;
2123
import org.openrewrite.*;
@@ -161,14 +163,10 @@ public Json.Document visitDocument(Json.Document document, ExecutionContext ctx)
161163
return doc;
162164
}
163165

166+
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
164167
private static final class ConvertedEntry {
165168
final Json.JsonObject entry;
166169
final boolean hasWarning;
167-
168-
ConvertedEntry(Json.JsonObject entry, boolean hasWarning) {
169-
this.entry = entry;
170-
this.hasWarning = hasWarning;
171-
}
172170
}
173171

174172
private @Nullable ConvertedEntry convertPatternEntry(Json.JsonObject entryObj) {
@@ -309,15 +307,11 @@ private static String escapeJsonString(String s) {
309307

310308
// Regex to glob conversion logic integrated from RegexToGlobConverter
311309

310+
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
312311
private static final class ConversionResult {
313312
final @Nullable String glob;
314313
final @Nullable String warningMessage;
315314

316-
ConversionResult(@Nullable String glob, @Nullable String warningMessage) {
317-
this.glob = glob;
318-
this.warningMessage = warningMessage;
319-
}
320-
321315
boolean isSuccessful() {
322316
return glob != null;
323317
}

src/main/java/org/openrewrite/java/migrate/guava/AbstractNoGuavaImmutableOf.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package org.openrewrite.java.migrate.guava;
1717

18+
import lombok.AccessLevel;
1819
import lombok.Getter;
20+
import lombok.RequiredArgsConstructor;
1921
import org.jspecify.annotations.Nullable;
2022
import org.openrewrite.*;
2123
import org.openrewrite.internal.ListUtils;
@@ -33,6 +35,7 @@
3335

3436
import static java.util.Collections.emptyList;
3537

38+
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
3639
abstract class AbstractNoGuavaImmutableOf extends Recipe {
3740

3841
private final String guavaType;
@@ -46,11 +49,6 @@ abstract class AbstractNoGuavaImmutableOf extends Recipe {
4649
@Nullable
4750
Boolean convertReturnType;
4851

49-
AbstractNoGuavaImmutableOf(String guavaType, String javaType) {
50-
this.guavaType = guavaType;
51-
this.javaType = javaType;
52-
}
53-
5452
AbstractNoGuavaImmutableOf(String guavaType, String javaType, @Nullable Boolean convertReturnType) {
5553
this.guavaType = guavaType;
5654
this.javaType = javaType;

src/main/java/org/openrewrite/java/migrate/lombok/LombokValueToRecord.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ private boolean hasMemberVariableAssignments(List<J.VariableDeclarations> member
212212

213213
}
214214

215+
@RequiredArgsConstructor
215216
private static class LombokValueToRecordVisitor extends JavaIsoVisitor<ExecutionContext> {
216217
private static final JavaTemplate TO_STRING_TEMPLATE = JavaTemplate
217218
.builder("@Override public String toString() { return \"#{}(\" +\n#{}\n\")\"; }")
@@ -226,11 +227,6 @@ private static class LombokValueToRecordVisitor extends JavaIsoVisitor<Execution
226227
private final @Nullable Boolean useExactToString;
227228
private final Map<String, Set<String>> recordTypeToMembers;
228229

229-
public LombokValueToRecordVisitor(@Nullable Boolean useExactToString, Map<String, Set<String>> recordTypeToMembers) {
230-
this.useExactToString = useExactToString;
231-
this.recordTypeToMembers = recordTypeToMembers;
232-
}
233-
234230
@Override
235231
public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx) {
236232
J.MethodInvocation methodInvocation = super.visitMethodInvocation(method, ctx);

0 commit comments

Comments
 (0)