Skip to content

Commit dadcd4b

Browse files
1 parent f0c6879 commit dadcd4b

File tree

1 file changed

+85
-37
lines changed

1 file changed

+85
-37
lines changed

src/main/resources/META-INF/rewrite/examples.yml

Lines changed: 85 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,34 +1025,31 @@ recipeName: org.openrewrite.java.migrate.UpgradePluginsForJava11
10251025
examples:
10261026
- description: ''
10271027
sources:
1028-
- before: project
1029-
language: mavenProject
10301028
- before: |
10311029
<project>
10321030
<groupId>com.mycompany.app</groupId>
10331031
<artifactId>my-app</artifactId>
10341032
<version>1</version>
1033+
<properties>
1034+
<wro4j.version>1.8.0</wro4j.version>
1035+
</properties>
10351036
<build>
10361037
<plugins>
10371038
<plugin>
1038-
<groupId>org.codehaus.mojo</groupId>
1039-
<artifactId>jaxb2-maven-plugin</artifactId>
1040-
<version>2.3.1</version>
1039+
<groupId>ro.isdc.wro4j</groupId>
1040+
<artifactId>wro4j-maven-plugin</artifactId>
1041+
<version>${wro4j.version}</version>
10411042
</plugin>
10421043
</plugins>
10431044
</build>
10441045
</project>
1045-
path: pom.xml
1046-
language: xml
1047-
- description: ''
1048-
sources:
1049-
- before: |
1046+
after: |
10501047
<project>
10511048
<groupId>com.mycompany.app</groupId>
10521049
<artifactId>my-app</artifactId>
10531050
<version>1</version>
10541051
<properties>
1055-
<wro4j.version>1.8.0</wro4j.version>
1052+
<wro4j.version>1.10.1</wro4j.version>
10561053
</properties>
10571054
<build>
10581055
<plugins>
@@ -1064,20 +1061,23 @@ examples:
10641061
</plugins>
10651062
</build>
10661063
</project>
1067-
after: |
1064+
path: pom.xml
1065+
language: xml
1066+
- description: ''
1067+
sources:
1068+
- before: project
1069+
language: mavenProject
1070+
- before: |
10681071
<project>
10691072
<groupId>com.mycompany.app</groupId>
10701073
<artifactId>my-app</artifactId>
10711074
<version>1</version>
1072-
<properties>
1073-
<wro4j.version>1.10.1</wro4j.version>
1074-
</properties>
10751075
<build>
10761076
<plugins>
10771077
<plugin>
1078-
<groupId>ro.isdc.wro4j</groupId>
1079-
<artifactId>wro4j-maven-plugin</artifactId>
1080-
<version>${wro4j.version}</version>
1078+
<groupId>org.codehaus.mojo</groupId>
1079+
<artifactId>jaxb2-maven-plugin</artifactId>
1080+
<version>2.3.1</version>
10811081
</plugin>
10821082
</plugins>
10831083
</build>
@@ -3338,6 +3338,25 @@ examples:
33383338
type: specs.openrewrite.org/v1beta/example
33393339
recipeName: org.openrewrite.java.migrate.guava.NoGuava
33403340
examples:
3341+
- description: ''
3342+
sources:
3343+
- before: |
3344+
import com.google.common.base.MoreObjects;
3345+
3346+
class A {
3347+
Object foo(Object obj) {
3348+
return MoreObjects.firstNonNull(obj, "default");
3349+
}
3350+
}
3351+
after: |
3352+
import java.util.Objects;
3353+
3354+
class A {
3355+
Object foo(Object obj) {
3356+
return Objects.requireNonNullElse(obj, "default");
3357+
}
3358+
}
3359+
language: java
33413360
- description: ''
33423361
sources:
33433362
- before: |
@@ -3384,25 +3403,6 @@ examples:
33843403
}
33853404
}
33863405
language: java
3387-
- description: ''
3388-
sources:
3389-
- before: |
3390-
import com.google.common.base.MoreObjects;
3391-
3392-
class A {
3393-
Object foo(Object obj) {
3394-
return MoreObjects.firstNonNull(obj, "default");
3395-
}
3396-
}
3397-
after: |
3398-
import java.util.Objects;
3399-
3400-
class A {
3401-
Object foo(Object obj) {
3402-
return Objects.requireNonNullElse(obj, "default");
3403-
}
3404-
}
3405-
language: java
34063406
---
34073407
type: specs.openrewrite.org/v1beta/example
34083408
recipeName: org.openrewrite.java.migrate.guava.NoGuavaAtomicsNewReference
@@ -6314,6 +6314,33 @@ examples:
63146314
language: java
63156315
---
63166316
type: specs.openrewrite.org/v1beta/example
6317+
recipeName: org.openrewrite.java.migrate.lang.SwitchCaseReturnsToSwitchExpression
6318+
examples:
6319+
- description: ''
6320+
sources:
6321+
- before: |
6322+
class Test {
6323+
String doFormat(String str) {
6324+
switch (str) {
6325+
case "foo": return "Foo";
6326+
case "bar": return "Bar";
6327+
case null, default: return "Other";
6328+
}
6329+
}
6330+
}
6331+
after: |
6332+
class Test {
6333+
String doFormat(String str) {
6334+
return switch (str) {
6335+
case "foo" -> "Foo";
6336+
case "bar" -> "Bar";
6337+
case null, default -> "Other";
6338+
};
6339+
}
6340+
}
6341+
language: java
6342+
---
6343+
type: specs.openrewrite.org/v1beta/example
63176344
recipeName: org.openrewrite.java.migrate.lang.SwitchExpressionYieldToArrow
63186345
examples:
63196346
- description: ''
@@ -6717,6 +6744,27 @@ examples:
67176744
language: java
67186745
---
67196746
type: specs.openrewrite.org/v1beta/example
6747+
recipeName: org.openrewrite.java.migrate.lombok.AdoptLombokSetterMethodNames
6748+
examples:
6749+
- description: ''
6750+
sources:
6751+
- before: |
6752+
class A {
6753+
int foo = 9;
6754+
public void storeFoo(int foo) {
6755+
this.foo = foo;
6756+
}
6757+
}
6758+
after: |
6759+
class A {
6760+
int foo = 9;
6761+
public void setFoo(int foo) {
6762+
this.foo = foo;
6763+
}
6764+
}
6765+
language: java
6766+
---
6767+
type: specs.openrewrite.org/v1beta/example
67206768
recipeName: org.openrewrite.java.migrate.lombok.LombokBestPractices
67216769
examples:
67226770
- description: ''

0 commit comments

Comments
 (0)