Skip to content

Commit 938454b

Browse files
authored
Merge branch 'main' into lredor/bug/908-newCasesDetected
2 parents f924041 + a5af8f1 commit 938454b

File tree

9 files changed

+131
-101
lines changed

9 files changed

+131
-101
lines changed

gradle/wrapper/gradle-wrapper.jar

176 Bytes
Binary file not shown.

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=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
3+
distributionSha256Sum=df67a32e86e3276d011735facb1535f64d0d88df84fa87521e90becc2d735444
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ fi
202202

203203

204204
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
205+
DEFAULT_JVM_OPTS=
206206

207207
# Collect all arguments for the java command:
208208
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,

gradlew.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ set APP_HOME=%DIRNAME%
3636
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
3737

3838
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39-
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
39+
set DEFAULT_JVM_OPTS=
4040

4141
@rem Find java.exe
4242
if defined JAVA_HOME goto findJavaFromJavaHome

src/main/resources/META-INF/rewrite/add-common-annotations-dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ recipeList:
3333
newGroupId: jakarta.annotation
3434
newArtifactId: jakarta.annotation-api
3535
newVersion: 1.3.x
36-
# set explicitly even if managed, as higher versions do not have the javax namespace
36+
# Set explicitly even if managed, as higher versions do not have the javax namespace
3737
overrideManagedVersion: true
3838
changeManagedDependency: false
3939
# Jakarta EE recommends `provided` scope

src/main/resources/META-INF/rewrite/jakarta-ee-10.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ tags:
2424
recipeList:
2525
- org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta
2626
- org.openrewrite.java.migrate.jakarta.MigrationToJakarta10Apis
27+
- org.openrewrite.java.migrate.jakarta.JettyUpgradeEE10
2728
- org.openrewrite.java.migrate.jakarta.Faces3xMigrationToFaces4x
2829
- org.openrewrite.java.migrate.jakarta.RemovedIsParmetersProvidedMethod
2930
- org.openrewrite.java.migrate.jakarta.RemovedSOAPElementFactory
@@ -523,3 +524,66 @@ recipeList:
523524
artifactId: yasson
524525
newVersion: 3.0.x
525526
---
527+
type: specs.openrewrite.org/v1beta/recipe
528+
name: org.openrewrite.java.migrate.jakarta.JettyUpgradeEE10
529+
displayName: Update Jetty EE9 to Jetty EE10
530+
description: Update Jetty dependencies from EE9 to EE10, changing the groupId and artifactIds as needed.
531+
recipeList:
532+
- org.openrewrite.java.dependencies.ChangeDependency:
533+
oldGroupId: org.eclipse.jetty.ee9.websocket
534+
oldArtifactId: jetty-ee9-websocket-jetty-server
535+
newGroupId: org.eclipse.jetty.ee10.websocket
536+
newArtifactId: jetty-ee10-websocket-jetty-server
537+
newVersion: 12.0.x
538+
- org.openrewrite.java.dependencies.ChangeDependency:
539+
oldGroupId: org.eclipse.jetty.ee9.websocket
540+
oldArtifactId: jetty-ee9-websocket-jetty-client
541+
newGroupId: org.eclipse.jetty.ee10.websocket
542+
newArtifactId: jetty-ee10-websocket-jetty-client
543+
newVersion: 12.0.x
544+
- org.openrewrite.java.dependencies.ChangeDependency:
545+
oldGroupId: org.eclipse.jetty.ee9
546+
oldArtifactId: jetty-ee9-apache-jsp
547+
newGroupId: org.eclipse.jetty.ee10
548+
newArtifactId: jetty-ee10-apache-jsp
549+
newVersion: 12.0.x
550+
- org.openrewrite.java.dependencies.ChangeDependency:
551+
oldGroupId: org.eclipse.jetty.ee9
552+
oldArtifactId: jetty-ee9-servlets
553+
newGroupId: org.eclipse.jetty.ee10
554+
newArtifactId: jetty-ee10-servlets
555+
newVersion: 12.0.x
556+
- org.openrewrite.java.dependencies.ChangeDependency:
557+
oldGroupId: org.eclipse.jetty.ee9
558+
oldArtifactId: jetty-ee9-servlet
559+
newGroupId: org.eclipse.jetty.ee10
560+
newArtifactId: jetty-ee10-servlet
561+
newVersion: 12.0.x
562+
- org.openrewrite.java.dependencies.ChangeDependency:
563+
oldGroupId: org.eclipse.jetty.ee9
564+
oldArtifactId: jetty-ee9-webapp
565+
newGroupId: org.eclipse.jetty.ee10
566+
newArtifactId: jetty-ee10-webapp
567+
newVersion: 12.0.x
568+
- org.openrewrite.java.dependencies.ChangeDependency:
569+
oldGroupId: org.eclipse.jetty.ee9
570+
oldArtifactId: jetty-ee9-security
571+
newGroupId: org.eclipse.jetty.ee10
572+
newArtifactId: jetty-ee10-security
573+
newVersion: 12.0.x
574+
- org.openrewrite.java.dependencies.ChangeDependency:
575+
oldGroupId: org.eclipse.jetty.ee9
576+
oldArtifactId: jetty-ee9-proxy
577+
newGroupId: org.eclipse.jetty.ee10
578+
newArtifactId: jetty-ee10-proxy
579+
newVersion: 12.0.x
580+
- org.openrewrite.java.dependencies.ChangeDependency:
581+
oldGroupId: org.eclipse.jetty.ee9
582+
oldArtifactId: jetty-ee9-annotations
583+
newGroupId: org.eclipse.jetty.ee10
584+
newArtifactId: jetty-ee10-annotations
585+
newVersion: 12.0.x
586+
- org.openrewrite.java.ChangeType:
587+
oldFullyQualifiedTypeName: org.eclipse.jetty.util.resource.ResourceCollection
588+
newFullyQualifiedTypeName: org.eclipse.jetty.util.resource.Resource
589+
---

src/main/resources/META-INF/rewrite/java-version-17.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ recipeList:
7272
artifactId: mapstruct*
7373
newVersion: 1.6.x
7474
- org.openrewrite.java.migrate.AddLombokMapstructBinding
75-
- org.openrewrite.java.migrate.UpdateJakartaAnnotationsIfForJavax
76-
- org.openrewrite.java.migrate.UpdateJakartaAnnotationsIfExistsForJakarta
7775

7876
---
7977
type: specs.openrewrite.org/v1beta/recipe
@@ -338,28 +336,4 @@ recipeList:
338336
groupId: org.projectlombok
339337
artifactId: lombok-mapstruct-binding
340338
version: 0.2.0
341-
---
342-
# The scanning phase comes before the editing phase, therefor we check if a javax.annotation dependency is on the classpath (with whatever version)
343-
type: specs.openrewrite.org/v1beta/recipe
344-
name: org.openrewrite.java.migrate.UpdateJakartaAnnotationsIfForJavax
345-
displayName: Update `jakarta.annotation-api` dependency if it exists
346-
description: Counteract the `jakarta.annotation-api` by updating to `jakarta` namespace
347-
preconditions:
348-
- org.openrewrite.java.dependencies.search.ModuleHasDependency:
349-
groupIdPattern: javax.annotation
350-
artifactIdPattern: javax.annotation-api
351-
recipeList:
352-
- org.openrewrite.java.migrate.jakarta.JavaxAnnotationMigrationToJakartaAnnotation
353339

354-
---
355-
type: specs.openrewrite.org/v1beta/recipe
356-
name: org.openrewrite.java.migrate.UpdateJakartaAnnotationsIfExistsForJakarta
357-
displayName: Update `jakarta.annotation-api` dependency if it exists
358-
description: Counteract the `jakarta.annotation-api` by updating to `jakarta` namespace
359-
preconditions:
360-
- org.openrewrite.java.dependencies.search.ModuleHasDependency:
361-
groupIdPattern: jakarta.annotation
362-
artifactIdPattern: jakarta.annotation-api
363-
version: 1.3.x
364-
recipeList:
365-
- org.openrewrite.java.migrate.jakarta.JavaxAnnotationMigrationToJakartaAnnotation

src/test/java/org/openrewrite/java/migrate/UpgradeToJava17Test.java

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -504,76 +504,6 @@ void test() throws Exception {
504504
);
505505
}
506506

507-
@Issue("https://github.com/openrewrite/rewrite-migrate-java/pull/816")
508-
@Test
509-
void javaxAnnotationApiToJakarta() {
510-
rewriteRun(
511-
spec -> spec.parser(JavaParser.fromJavaVersion().classpathFromResources(new InMemoryExecutionContext(), "javax.annotation-api-1.3.2")),
512-
version(
513-
mavenProject("project",
514-
//language=xml
515-
pomXml(
516-
"""
517-
<project>
518-
<modelVersion>4.0.0</modelVersion>
519-
<groupId>com.mycompany.app</groupId>
520-
<artifactId>my-app</artifactId>
521-
<version>1</version>
522-
<dependencies>
523-
<dependency>
524-
<groupId>javax.annotation</groupId>
525-
<artifactId>javax.annotation-api</artifactId>
526-
<version>1.3.2</version>
527-
</dependency>
528-
</dependencies>
529-
</project>
530-
""",
531-
"""
532-
<project>
533-
<modelVersion>4.0.0</modelVersion>
534-
<groupId>com.mycompany.app</groupId>
535-
<artifactId>my-app</artifactId>
536-
<version>1</version>
537-
<properties>
538-
<maven.compiler.release>17</maven.compiler.release>
539-
</properties>
540-
<dependencies>
541-
<dependency>
542-
<groupId>jakarta.annotation</groupId>
543-
<artifactId>jakarta.annotation-api</artifactId>
544-
<version>2.0.0</version>
545-
<scope>provided</scope>
546-
</dependency>
547-
</dependencies>
548-
</project>
549-
"""
550-
),
551-
//language=java
552-
srcMainJava(
553-
java(
554-
"""
555-
import javax.annotation.PostConstruct;
556-
557-
class A {
558-
@PostConstruct
559-
void init() {}
560-
}
561-
""",
562-
"""
563-
import jakarta.annotation.PostConstruct;
564-
565-
class A {
566-
@PostConstruct
567-
void init() {}
568-
}
569-
"""
570-
)
571-
)
572-
),
573-
8)
574-
);
575-
}
576-
577507
@Test
578508
void upgradeSpotbugsPluginVersion() {
579509
rewriteRun(
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
* <p>
4+
* Licensed under the Moderne Source Available License (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* <p>
8+
* https://docs.moderne.io/licensing/moderne-source-available-license
9+
* <p>
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.openrewrite.java.migrate.jakarta;
17+
18+
import org.junit.jupiter.api.Test;
19+
import org.openrewrite.DocumentExample;
20+
import org.openrewrite.test.RecipeSpec;
21+
import org.openrewrite.test.RewriteTest;
22+
23+
import static org.assertj.core.api.Assertions.assertThat;
24+
import static org.openrewrite.maven.Assertions.pomXml;
25+
26+
class JakartaEE10Test implements RewriteTest {
27+
28+
@Override
29+
public void defaults(RecipeSpec spec) {
30+
spec.recipeFromResources("org.openrewrite.java.migrate.jakarta.JakartaEE10");
31+
}
32+
33+
@DocumentExample
34+
@Test
35+
void chainedJettyUpgradeEE10() {
36+
rewriteRun(
37+
pomXml(
38+
"""
39+
<project>
40+
<modelVersion>4.0.0</modelVersion>
41+
<groupId>com.example</groupId>
42+
<artifactId>demo</artifactId>
43+
<version>0.0.1-SNAPSHOT</version>
44+
<dependencies>
45+
<dependency>
46+
<groupId>org.eclipse.jetty.websocket</groupId>
47+
<artifactId>websocket-server</artifactId>
48+
<version>9.4.58.v20250814</version>
49+
</dependency>
50+
</dependencies>
51+
</project>
52+
""",
53+
spec -> spec.after(pom ->
54+
assertThat(pom)
55+
.as("websocket dependencies").doesNotContain("org.eclipse.jetty.websocket", "websocket-server")
56+
.as("EE9 dependencies").doesNotContain("org.eclipse.jetty.ee9.websocket", "jetty-ee9-websocket-jetty-server")
57+
.as("EE10 dependencies").contains("org.eclipse.jetty.ee10.websocket", "jetty-ee10-websocket-jetty-server")
58+
.actual())
59+
)
60+
);
61+
}
62+
}

0 commit comments

Comments
 (0)