Skip to content

Commit e31a547

Browse files
author
bhavanapidapa
committed
Merge Conflicts
2 parents 81f9345 + 6dce1fb commit e31a547

File tree

119 files changed

+6033
-1054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+6033
-1054
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
insert_final_newline = true
5+
trim_trailing_whitespace = true
6+
7+
[src/test*/java/**.java]
8+
indent_size = 4
9+
ij_continuation_indent_size = 2

.sdkmanrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Enable auto-env through the sdkman_auto_env config
22
# Add key=value pairs of SDKs to use below
3-
java=21.0.2-tem
3+
java=21.0.5-tem

build.gradle.kts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
testImplementation("org.projectlombok:lombok:latest.release")
1717

1818
annotationProcessor("org.openrewrite:rewrite-templating:$rewriteVersion")
19-
compileOnly("com.google.errorprone:error_prone_core:2.19.1") {
19+
compileOnly("com.google.errorprone:error_prone_core:2.+") {
2020
exclude("com.google.auto.service", "auto-service-annotations")
2121
}
2222

@@ -29,6 +29,7 @@ dependencies {
2929
implementation("org.openrewrite.recipe:rewrite-static-analysis:$rewriteVersion")
3030
implementation("org.openrewrite.recipe:rewrite-jenkins:$rewriteVersion")
3131
implementation("org.openrewrite:rewrite-templating:$rewriteVersion")
32+
implementation("org.openrewrite.meta:rewrite-analysis:$rewriteVersion")
3233

3334
runtimeOnly("org.openrewrite:rewrite-java-8")
3435
runtimeOnly("org.openrewrite:rewrite-java-11")
@@ -48,12 +49,29 @@ dependencies {
4849
testImplementation("org.assertj:assertj-core:latest.release")
4950

5051
testImplementation("com.google.guava:guava:33.0.0-jre")
52+
testImplementation("joda-time:joda-time:2.12.3")
5153

5254
testRuntimeOnly("com.fasterxml.jackson.datatype:jackson-datatype-jsr353")
5355
testRuntimeOnly("com.fasterxml.jackson.core:jackson-core")
5456
testRuntimeOnly("com.fasterxml.jackson.core:jackson-databind")
57+
testRuntimeOnly("org.apache.johnzon:johnzon-core:1.2.18")
5558
testRuntimeOnly("org.codehaus.groovy:groovy:latest.release")
5659
testRuntimeOnly("jakarta.annotation:jakarta.annotation-api:2.1.1")
60+
testRuntimeOnly("org.springframework:spring-core:6.1.13")
5761
testRuntimeOnly("com.google.code.findbugs:jsr305:3.0.2")
5862
testRuntimeOnly(gradleApi())
5963
}
64+
65+
java {
66+
toolchain {
67+
languageVersion.set(JavaLanguageVersion.of(21))
68+
}
69+
}
70+
71+
tasks.withType(Javadoc::class.java) {
72+
exclude("**/PlanJavaMigration.java")
73+
}
74+
75+
tasks.test {
76+
maxHeapSize = "2g" // Set max heap size to 2GB or adjust as necessary
77+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
3+
distributionSha256Sum=57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

lombok.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ lombok.addNullAnnotations = CUSTOM:org.openrewrite.internal.lang.NonNull:org.ope
44
lombok.copyableAnnotations += org.openrewrite.internal.lang.Nullable
55
lombok.copyableAnnotations += org.openrewrite.internal.lang.NonNull
66
lombok.anyConstructor.addConstructorProperties=true
7+
lombok.builder.className=Builder

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public Xml visitTag(Xml.Tag tag, ExecutionContext ctx) {
7272
// Update or apply bean-discovery-mode=all
7373
if (hasBeanDiscoveryMode) {
7474
TreeVisitor<?, ExecutionContext> changeTagVisitor = new ChangeTagAttribute("beans", "bean-discovery-mode", "all", null, null).getVisitor();
75-
t = (Xml.Tag) changeTagVisitor.visit(t, ctx, getCursor());
75+
t = (Xml.Tag) changeTagVisitor.visit(t, ctx, getCursor().getParentOrThrow());
7676
} else {
7777
t = addAttribute(t, "bean-discovery-mode", "all", ctx);
7878
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public J visitTypeCast(J.TypeCast typeCast, ExecutionContext ctx) {
6363
elementType = ((JavaType.Array) elementType).getElemType();
6464
}
6565

66-
boolean matches = (elementType instanceof JavaType.Class || elementType instanceof JavaType.Parameterized)
67-
&& ((JavaType.FullyQualified) elementType).getOwningClass() == null // does not support inner class now
68-
&& LIST_TO_ARRAY.matches(typeCast.getExpression())
69-
&& typeCast.getExpression() instanceof J.MethodInvocation
70-
&& ARRAYS_AS_LIST.matches(((J.MethodInvocation) typeCast.getExpression()).getSelect());
66+
boolean matches = (elementType instanceof JavaType.Class || elementType instanceof JavaType.Parameterized) &&
67+
((JavaType.FullyQualified) elementType).getOwningClass() == null // does not support inner class now
68+
&& LIST_TO_ARRAY.matches(typeCast.getExpression()) &&
69+
typeCast.getExpression() instanceof J.MethodInvocation &&
70+
ARRAYS_AS_LIST.matches(((J.MethodInvocation) typeCast.getExpression()).getSelect());
7171
if (!matches) {
7272
return typeCast;
7373
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.openrewrite.java.tree.TypeUtils;
3131

3232
@EqualsAndHashCode(callSuper = false)
33-
class JREThrowableFinalMethods extends Recipe {
33+
public class JREThrowableFinalMethods extends Recipe {
3434

3535
private final String methodPatternAddSuppressed;
3636
private final String methodPatternGetSuppressed;
@@ -56,9 +56,9 @@ public String getDisplayName() {
5656

5757
@Override
5858
public String getDescription() {
59-
return "The recipe renames `getSuppressed()` and `addSuppressed(Throwable exception)` methods in classes "
60-
+ "that extend `java.lang.Throwable` to `myGetSuppressed` and `myAddSuppressed(Throwable)`."
61-
+ "These methods were added to Throwable in Java 7 and are marked final which cannot be overridden.";
59+
return "The recipe renames `getSuppressed()` and `addSuppressed(Throwable exception)` methods in classes " +
60+
"that extend `java.lang.Throwable` to `myGetSuppressed` and `myAddSuppressed(Throwable)`." +
61+
"These methods were added to Throwable in Java 7 and are marked final which cannot be overridden.";
6262
}
6363

6464
@Override

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public J.ClassDeclaration visitClassDeclaration(J.ClassDeclaration classDeclarat
108108
}
109109

110110
List<Modifier> modifiers = new ArrayList<>(cd.getModifiers());
111-
modifiers.removeIf(modifier -> modifier.getType() == Modifier.Type.Private
112-
|| modifier.getType() == Modifier.Type.Protected
113-
|| modifier.getType() == Modifier.Type.Abstract);
111+
modifiers.removeIf(modifier -> modifier.getType() == Modifier.Type.Private ||
112+
modifier.getType() == Modifier.Type.Protected ||
113+
modifier.getType() == Modifier.Type.Abstract);
114114
modifiers.add(new J.Modifier(randomId(), Space.EMPTY, Markers.EMPTY, Modifier.Type.Public, emptyList()));
115115
return maybeAutoFormat(cd, cd.withModifiers(sortModifiers(modifiers)), ctx);
116116
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
@Value
3434
@EqualsAndHashCode(callSuper = false)
35-
class ReferenceCloneMethod extends Recipe {
35+
public class ReferenceCloneMethod extends Recipe {
3636
private static final MethodMatcher REFERENCE_CLONE = new MethodMatcher("java.lang.ref.Reference clone()", true);
3737

3838
@Override
@@ -57,8 +57,8 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
5757
@Override
5858
public J visitTypeCast(J.TypeCast typeCast, ExecutionContext ctx) {
5959
J j = super.visitTypeCast(typeCast, ctx);
60-
if (Boolean.TRUE.equals(getCursor().pollNearestMessage(REFERENCE_CLONE_REPLACED))
61-
&& j instanceof J.TypeCast) {
60+
if (Boolean.TRUE.equals(getCursor().pollNearestMessage(REFERENCE_CLONE_REPLACED)) &&
61+
j instanceof J.TypeCast) {
6262
J.TypeCast tc = (J.TypeCast) j;
6363
if (TypeUtils.isOfType(tc.getType(), tc.getExpression().getType())) {
6464
return tc.getExpression();

0 commit comments

Comments
 (0)