diff --git a/src/test/java/org/openrewrite/java/migrate/BeansXmlNamespaceTest.java b/src/test/java/org/openrewrite/java/migrate/BeansXmlNamespaceTest.java
index 36c7f1b9cd..db35cbbc25 100644
--- a/src/test/java/org/openrewrite/java/migrate/BeansXmlNamespaceTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/BeansXmlNamespaceTest.java
@@ -61,17 +61,17 @@ void noSchemaCD12() {
xml(
"""
-
-
+
""",
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("beans.xml")
)
@@ -86,10 +86,10 @@ void fileNotNamedBeansXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-beans.xml")
)
@@ -102,10 +102,10 @@ void alreadyHasRightSchemaLocationSun() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("beans.xml")
)
@@ -118,9 +118,9 @@ void alreadyHasRightSchemaLocation() {
//language=xml
xml(
"""
-
""",
diff --git a/src/test/java/org/openrewrite/java/migrate/CastArraysAsListToListTest.java b/src/test/java/org/openrewrite/java/migrate/CastArraysAsListToListTest.java
index 5596c38bef..82be7ab2b1 100644
--- a/src/test/java/org/openrewrite/java/migrate/CastArraysAsListToListTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/CastArraysAsListToListTest.java
@@ -36,7 +36,7 @@ void positiveCases() {
java(
"""
import java.util.Arrays;
-
+
class Foo {
void bar() {
Integer[] array1 = (Integer[]) Arrays.asList(1, 2, 3).toArray();
@@ -47,7 +47,7 @@ void bar() {
""",
"""
import java.util.Arrays;
-
+
class Foo {
void bar() {
Integer[] array1 = Arrays.asList(1, 2, 3).toArray(new Integer[0]);
@@ -68,7 +68,7 @@ void negativeCases() {
"""
import java.util.Arrays;
import java.util.Collections;
-
+
class Foo {
void bar() {
Object[] array1 = (Object[]) Arrays.asList("a","b").toArray();
diff --git a/src/test/java/org/openrewrite/java/migrate/DeleteDeprecatedFinalizeTest.java b/src/test/java/org/openrewrite/java/migrate/DeleteDeprecatedFinalizeTest.java
index 5d26c8ee04..eb8d42da0b 100644
--- a/src/test/java/org/openrewrite/java/migrate/DeleteDeprecatedFinalizeTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/DeleteDeprecatedFinalizeTest.java
@@ -37,57 +37,59 @@ void deleteDeprecatedFinalize() {
//language=java
java(
"""
- package java.awt.color;
-
- import java.awt.color.ICC_Profile;
- import java.awt.image.ColorModel;
- import java.awt.image.IndexColorModel;
-
- public class Test {
- public static void main(String[] args) {
- byte ff = (byte) 0xff;
- byte[] r = { ff, 0, 0, ff, 0 };
- byte[] g = { 0, ff, 0, ff, 0 };
- byte[] b = { 0, 0, ff, ff, 0 };
-
- ICC_Profile profile = ICC_Profile.getInstance(ICC_Profile.CLASS_COLORSPACECONVERSION);
- // flag
- profile.finalize();
-
- ColorModel cm = new IndexColorModel(3, 5, r, g, b);
-
- // flag
- cm.finalize();
-
- IndexColorModel icm = new IndexColorModel(3, 5, r, g, b);
- // flag
- icm.finalize();
-
- }
- }
- """,
+ package java.awt.color;
+
+ import java.awt.color.ICC_Profile;
+ import java.awt.image.ColorModel;
+ import java.awt.image.IndexColorModel;
+
+ public class Test {
+ public static void main(String[] args) {
+ byte ff = (byte) 0xff;
+ byte[] r = { ff, 0, 0, ff, 0 };
+ byte[] g = { 0, ff, 0, ff, 0 };
+ byte[] b = { 0, 0, ff, ff, 0 };
+
+ ICC_Profile profile = ICC_Profile.getInstance(ICC_Profile.CLASS_COLORSPACECONVERSION);
+ // flag
+ profile.finalize();
+
+ ColorModel cm = new IndexColorModel(3, 5, r, g, b);
+
+ // flag
+ cm.finalize();
+
+ IndexColorModel icm = new IndexColorModel(3, 5, r, g, b);
+ // flag
+ icm.finalize();
+
+ }
+ }
+ """,
"""
- package java.awt.color;
-
- import java.awt.color.ICC_Profile;
- import java.awt.image.ColorModel;
- import java.awt.image.IndexColorModel;
-
- public class Test {
- public static void main(String[] args) {
- byte ff = (byte) 0xff;
- byte[] r = { ff, 0, 0, ff, 0 };
- byte[] g = { 0, ff, 0, ff, 0 };
- byte[] b = { 0, 0, ff, ff, 0 };
-
- ICC_Profile profile = ICC_Profile.getInstance(ICC_Profile.CLASS_COLORSPACECONVERSION);
-
- ColorModel cm = new IndexColorModel(3, 5, r, g, b);
-
- IndexColorModel icm = new IndexColorModel(3, 5, r, g, b);
-
- }
- }
- """));
+ package java.awt.color;
+
+ import java.awt.color.ICC_Profile;
+ import java.awt.image.ColorModel;
+ import java.awt.image.IndexColorModel;
+
+ public class Test {
+ public static void main(String[] args) {
+ byte ff = (byte) 0xff;
+ byte[] r = { ff, 0, 0, ff, 0 };
+ byte[] g = { 0, ff, 0, ff, 0 };
+ byte[] b = { 0, 0, ff, ff, 0 };
+
+ ICC_Profile profile = ICC_Profile.getInstance(ICC_Profile.CLASS_COLORSPACECONVERSION);
+
+ ColorModel cm = new IndexColorModel(3, 5, r, g, b);
+
+ IndexColorModel icm = new IndexColorModel(3, 5, r, g, b);
+
+ }
+ }
+ """
+ )
+ );
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/DeprecatedCountStackFramesMethodTest.java b/src/test/java/org/openrewrite/java/migrate/DeprecatedCountStackFramesMethodTest.java
index bc0ded3ce6..6edd776714 100644
--- a/src/test/java/org/openrewrite/java/migrate/DeprecatedCountStackFramesMethodTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/DeprecatedCountStackFramesMethodTest.java
@@ -36,7 +36,7 @@ void deprecatedCountStackFrameRemoveMethod() {
java(
"""
import java.lang.Thread;
-
+
public class Test {
public static void main(String args[]) {
Thread t1,t2 = new Thread();
@@ -46,7 +46,7 @@ public static void main(String args[]) {
""",
"""
import java.lang.Thread;
-
+
public class Test {
public static void main(String args[]) {
Thread t1,t2 = new Thread();
@@ -64,7 +64,7 @@ void deprecatedCountStackFrameNoRemoval() {
java(
"""
import java.lang.Thread;
-
+
public class Test {
public static void main(String args[]) {
Thread t1,t2 = new Thread();
diff --git a/src/test/java/org/openrewrite/java/migrate/DontOverfetchDtoTest.java b/src/test/java/org/openrewrite/java/migrate/DontOverfetchDtoTest.java
index 5f46deaaa6..9c54f80486 100644
--- a/src/test/java/org/openrewrite/java/migrate/DontOverfetchDtoTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/DontOverfetchDtoTest.java
@@ -49,7 +49,7 @@ public String getBreed() {
java(
"""
import animals.Dog;
-
+
class Test {
boolean test(Dog dog, int age) {
if(dog.getName() != null) {
diff --git a/src/test/java/org/openrewrite/java/migrate/IBMJDKtoOracleJDKTest.java b/src/test/java/org/openrewrite/java/migrate/IBMJDKtoOracleJDKTest.java
index 8cc32501c9..6cf6ceae1d 100644
--- a/src/test/java/org/openrewrite/java/migrate/IBMJDKtoOracleJDKTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/IBMJDKtoOracleJDKTest.java
@@ -28,12 +28,12 @@ class IBMJDKtoOracleJDKTest implements RewriteTest {
void Krb5LoginModuleTest() {
rewriteRun(
spec -> spec.parser(JavaParser.fromJavaVersion().dependsOn("""
- package com.ibm.security.auth.module;
- public class Krb5LoginModule {
- public void login() {
- }
- }
- """))
+ package com.ibm.security.auth.module;
+ public class Krb5LoginModule {
+ public void login() {
+ }
+ }
+ """))
.recipeFromResources("org.openrewrite.java.migrate.IBMJDKtoOracleJDK"),
//language=java
java(
diff --git a/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java b/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java
index 312376d442..fa48ebeae9 100644
--- a/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/IBMSemeruTest.java
@@ -46,7 +46,7 @@ void doNotUseSunNetSslInternalWwwProtocolHttpsHandler() {
java(
"""
import com.sun.net.ssl.internal.www.protocol.https.*; //do NOT flag this
-
+
class Foo{
void bar() {
com.sun.net.ssl.internal.www.protocol.https.Handler handler_1 = //flag
@@ -57,12 +57,12 @@ void bar() {
if (handler_1 instanceof com.sun.net.ssl.internal.www.protocol.https.Handler){ //flag
//do nothing
}
-
+
if (handler_1 instanceof Handler){ //flag
//do nothing
}
}
-
+
public static com.sun.net.ssl.internal.www.protocol.https.Handler testMethod(Handler handler){ //flag (2)
return handler;
}
@@ -71,7 +71,7 @@ public static com.sun.net.ssl.internal.www.protocol.https.Handler testMethod(Han
"""
import com.ibm.net.ssl.www2.protocol.https.Handler;
import com.sun.net.ssl.internal.www.protocol.https.*; //do NOT flag this
-
+
class Foo{
void bar() {
com.ibm.net.ssl.www2.protocol.https.Handler handler_1 = //flag
@@ -82,12 +82,12 @@ void bar() {
if (handler_1 instanceof com.ibm.net.ssl.www2.protocol.https.Handler){ //flag
//do nothing
}
-
+
if (handler_1 instanceof Handler){ //flag
//do nothing
}
}
-
+
public static com.ibm.net.ssl.www2.protocol.https.Handler testMethod(Handler handler){ //flag (2)
return handler;
}
@@ -105,7 +105,7 @@ void doNotUseSunNetSslInternalWwwProtocol() {
"""
class Foo{
private String flagMe = "com.sun.net.ssl.internal.www.protocol"; //flag this
-
+
void bar() {
System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); //flag this
String s1 = "com.sun.net.ssl"; //DO NOT FLAG
@@ -120,7 +120,7 @@ void bar() {
"""
class Foo{
private String flagMe = "com.ibm.net.ssl.www2.protocol"; //flag this
-
+
void bar() {
System.setProperty("java.protocol.handler.pkgs", "com.ibm.net.ssl.www2.protocol"); //flag this
String s1 = "com.sun.net.ssl"; //DO NOT FLAG
@@ -143,24 +143,24 @@ void doNotUseSunNetSslInternalSslProvider() {
java(
"""
import com.sun.net.ssl.internal.ssl.*; // do NOT flag, handled by other rule
-
+
class TestClass_2{
void bar() {
Provider provider_4 = new Provider(); // flag (2)
}
-
+
private void fdsa( Provider p1 ){} // flag
}
""",
"""
import com.ibm.jsse2.IBMJSSEProvider2;
import com.sun.net.ssl.internal.ssl.*; // do NOT flag, handled by other rule
-
+
class TestClass_2{
void bar() {
IBMJSSEProvider2 provider_4 = new IBMJSSEProvider2(); // flag (2)
}
-
+
private void fdsa( IBMJSSEProvider2 p1 ){} // flag
}
"""
@@ -187,7 +187,7 @@ void fullyQualifiedPackage() {
import com.sun.net.ssl.TrustManagerFactorySpi;
import com.sun.net.ssl.X509KeyManager;
import com.sun.net.ssl.X509TrustManager;
-
+
class TestFullyQualifiedPackage {
com.sun.net.ssl.HostnameVerifier hv;
com.sun.net.ssl.HttpsURLConnection huc;
@@ -202,7 +202,7 @@ class TestFullyQualifiedPackage {
com.sun.net.ssl.TrustManagerFactorySpi tmfs;
com.sun.net.ssl.X509KeyManager x509km;
com.sun.net.ssl.X509TrustManager xtm;
-
+
HostnameVerifier hv2;
HttpsURLConnection huc2;
KeyManager km2;
@@ -232,7 +232,7 @@ class TestFullyQualifiedPackage {
import javax.net.ssl.TrustManagerFactorySpi;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;
-
+
class TestFullyQualifiedPackage {
javax.net.ssl.HostnameVerifier hv;
javax.net.ssl.HttpsURLConnection huc;
@@ -247,7 +247,7 @@ class TestFullyQualifiedPackage {
javax.net.ssl.TrustManagerFactorySpi tmfs;
javax.net.ssl.X509KeyManager x509km;
javax.net.ssl.X509TrustManager xtm;
-
+
HostnameVerifier hv2;
HttpsURLConnection huc2;
KeyManager km2;
@@ -274,7 +274,7 @@ void hostnameVerifier() {
//language=java
java("""
import com.sun.net.ssl.HostnameVerifier;
-
+
class TestHostnameVerifier implements HostnameVerifier {
public boolean verify(String arg0, String arg1) {
return false;
@@ -283,7 +283,7 @@ public boolean verify(String arg0, String arg1) {
""",
"""
import javax.net.ssl.HostnameVerifier;
-
+
class TestHostnameVerifier implements HostnameVerifier {
public boolean verify(String arg0, String arg1) {
return false;
diff --git a/src/test/java/org/openrewrite/java/migrate/InternalBindPackagesTest.java b/src/test/java/org/openrewrite/java/migrate/InternalBindPackagesTest.java
index 3678b619c9..fc4b152bb7 100644
--- a/src/test/java/org/openrewrite/java/migrate/InternalBindPackagesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/InternalBindPackagesTest.java
@@ -59,7 +59,7 @@ void bar() {
java(
"""
import com.sun.xml.internal.bind.v2.ContextFactory;
-
+
class Foo2 {
void bar() {
ContextFactory factory = null;
@@ -69,7 +69,7 @@ void bar() {
""",
"""
import com.sun.xml.bind.v2.ContextFactory;
-
+
class Foo2 {
void bar() {
ContextFactory factory = null;
@@ -81,24 +81,24 @@ void bar() {
java(
"""
import com.sun.xml.internal.bind.v2.*;
-
+
class Foo3 {
void bar() {
ContextFactory factory = null;
factory.hashCode();
}
-
+
}
""",
"""
import com.sun.xml.bind.v2.*;
-
+
class Foo3 {
void bar() {
ContextFactory factory = null;
factory.hashCode();
}
-
+
}
"""
)
diff --git a/src/test/java/org/openrewrite/java/migrate/MXBeanRuleTest.java b/src/test/java/org/openrewrite/java/migrate/MXBeanRuleTest.java
index 695d681165..18f40f25ef 100644
--- a/src/test/java/org/openrewrite/java/migrate/MXBeanRuleTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/MXBeanRuleTest.java
@@ -38,11 +38,11 @@ void classAndNonPublicInterface() {
java(
"""
import javax.management.MXBean;
-
+
class TestClassAndNonPublicInterface {
class NonPublic implements NonPublicMBean {
}
-
+
@MXBean
private interface NonPublicMBean {
}
@@ -50,11 +50,11 @@ private interface NonPublicMBean {
""",
"""
import javax.management.MXBean;
-
+
class TestClassAndNonPublicInterface {
class NonPublic implements NonPublicMBean {
}
-
+
@MXBean
public interface NonPublicMBean {
}
@@ -71,14 +71,14 @@ void nonPublicInterfaceAnnotationMXBean() {
java(
"""
import javax.management.MXBean;
-
+
@MXBean
interface Foo {
}
""",
"""
import javax.management.MXBean;
-
+
@MXBean
public
interface Foo {
@@ -95,14 +95,14 @@ void nonPublicInterfaceAnnotationTrueMXBean() {
java(
"""
import javax.management.MXBean;
-
+
@MXBean(true)
interface Foo {
}
""",
"""
import javax.management.MXBean;
-
+
@MXBean(true)
public
interface Foo {
@@ -188,7 +188,7 @@ void annotationWithArgumentFalse() {
java(
"""
import javax.management.MXBean;
-
+
@MXBean(false)
interface Foo {
}
@@ -204,7 +204,7 @@ void annotationWithArgumentValueFalse() {
java(
"""
import javax.management.MXBean;
-
+
@MXBean(value=false)
interface Foo {
}
@@ -220,7 +220,7 @@ void annotationWithArgumentTrueButAlreadyPublic() {
java(
"""
import javax.management.MXBean;
-
+
@MXBean(true)
public interface Foo {
}
@@ -236,7 +236,7 @@ void annotatonWithArgumentValueTrueButAlreadyPublic() {
java(
"""
import javax.management.MXBean;
-
+
@MXBean(value=true)
public interface Foo {
}
diff --git a/src/test/java/org/openrewrite/java/migrate/RemovedModifierAndConstantBootstrapsConstructorsTest.java b/src/test/java/org/openrewrite/java/migrate/RemovedModifierAndConstantBootstrapsConstructorsTest.java
index 9909a42dfc..d9e80b0e52 100644
--- a/src/test/java/org/openrewrite/java/migrate/RemovedModifierAndConstantBootstrapsConstructorsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/RemovedModifierAndConstantBootstrapsConstructorsTest.java
@@ -22,7 +22,7 @@
import static org.openrewrite.java.Assertions.java;
-class RemovedModifierAndConstantBootstrapsConstructorsTest implements RewriteTest {
+class RemovedModifierAndConstantBootstrapsConstructorsTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
@@ -38,44 +38,44 @@ void moveToStaticTest() {
"""
import java.lang.invoke.ConstantBootstraps;
import java.lang.reflect.Modifier;
-
+
class RemovedModifierAndConstantBootstrapsConstructorsApp {
public void testModifier() throws Exception {
- Modifier modifier = new Modifier();
+ Modifier modifier = new Modifier();
modifier.classModifiers();
modifier.fieldModifiers();
modifier.isFinal(1);
modifier.isStatic(1);
- Modifier.isPublic(0);
- }
+ Modifier.isPublic(0);
+ }
public void testConstantBootstraps() throws Exception {
- ConstantBootstraps constantBootstraps = new ConstantBootstraps();
+ ConstantBootstraps constantBootstraps = new ConstantBootstraps();
constantBootstraps.enumConstant(null,null,null);
constantBootstraps.primitiveClass(null,null,null);
- ConstantBootstraps.nullConstant(null, null, null);
+ ConstantBootstraps.nullConstant(null, null, null);
}
- }
+ }
""",
"""
import java.lang.invoke.ConstantBootstraps;
import java.lang.reflect.Modifier;
-
+
class RemovedModifierAndConstantBootstrapsConstructorsApp {
public void testModifier() throws Exception {
- Modifier modifier = new Modifier();
+ Modifier modifier = new Modifier();
Modifier.classModifiers();
Modifier.fieldModifiers();
Modifier.isFinal(1);
Modifier.isStatic(1);
- Modifier.isPublic(0);
- }
+ Modifier.isPublic(0);
+ }
public void testConstantBootstraps() throws Exception {
- ConstantBootstraps constantBootstraps = new ConstantBootstraps();
+ ConstantBootstraps constantBootstraps = new ConstantBootstraps();
ConstantBootstraps.enumConstant(null,null,null);
ConstantBootstraps.primitiveClass(null,null,null);
- ConstantBootstraps.nullConstant(null, null, null);
+ ConstantBootstraps.nullConstant(null, null, null);
}
- }
+ }
"""
)
);
diff --git a/src/test/java/org/openrewrite/java/migrate/RemovedToolProviderConstructorTest.java b/src/test/java/org/openrewrite/java/migrate/RemovedToolProviderConstructorTest.java
index d359d61f6d..28558a072c 100644
--- a/src/test/java/org/openrewrite/java/migrate/RemovedToolProviderConstructorTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/RemovedToolProviderConstructorTest.java
@@ -22,7 +22,7 @@
import static org.openrewrite.java.Assertions.java;
-class RemovedToolProviderConstructorTest implements RewriteTest {
+class RemovedToolProviderConstructorTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
@@ -40,34 +40,34 @@ void moveToStaticTest() {
import javax.tools.JavaCompiler;
import javax.tools.DocumentationTool;
import java.lang.ClassLoader;
-
+
class RemovedToolProviderConstructorApp {
void test() throws Exception {
ToolProvider tp = null;
- JavaCompiler compiler = tp.getSystemJavaCompiler();
+ JavaCompiler compiler = tp.getSystemJavaCompiler();
DocumentationTool dT = tp.getSystemDocumentationTool();
- ClassLoader cl = tp.getSystemToolClassLoader();
- System.out.println(ToolProvider.getSystemJavaCompiler());
+ ClassLoader cl = tp.getSystemToolClassLoader();
+ System.out.println(ToolProvider.getSystemJavaCompiler());
tp.getSystemJavaCompiler().getSourceVersions();
}
- }
+ }
""",
"""
import javax.tools.ToolProvider;
import javax.tools.JavaCompiler;
import javax.tools.DocumentationTool;
import java.lang.ClassLoader;
-
+
class RemovedToolProviderConstructorApp {
void test() throws Exception {
ToolProvider tp = null;
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DocumentationTool dT = ToolProvider.getSystemDocumentationTool();
- ClassLoader cl = ToolProvider.getSystemToolClassLoader();
- System.out.println(ToolProvider.getSystemJavaCompiler());
+ ClassLoader cl = ToolProvider.getSystemToolClassLoader();
+ System.out.println(ToolProvider.getSystemJavaCompiler());
ToolProvider.getSystemJavaCompiler().getSourceVersions();
}
- }
+ }
"""
)
);
diff --git a/src/test/java/org/openrewrite/java/migrate/SunNetSslPackageUnavailableTest.java b/src/test/java/org/openrewrite/java/migrate/SunNetSslPackageUnavailableTest.java
index 488c436871..830d46e99b 100644
--- a/src/test/java/org/openrewrite/java/migrate/SunNetSslPackageUnavailableTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/SunNetSslPackageUnavailableTest.java
@@ -18,13 +18,11 @@
import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.InMemoryExecutionContext;
-import org.openrewrite.config.Environment;
import org.openrewrite.java.JavaParser;
-import org.openrewrite.java.migrate.jakarta.RemoveBeanIsNullable;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
-import static org.openrewrite.java.Assertions.*;
+import static org.openrewrite.java.Assertions.java;
class SunNetSslPackageUnavailableTest implements RewriteTest {
@@ -37,30 +35,30 @@ public void defaults(RecipeSpec spec) {
}
@Test
- void sunNetSslPackageUnavailableTest(){
+ @DocumentExample
+ void sunNetSslPackageUnavailableTest() {
rewriteRun(
- //language=java
- java(
- """
+ //language=java
+ java(
+ """
import com.sun.net.ssl.HttpsURLConnection;
-
+
class TestSunNetSsl {
void useThePackages() {
- HttpsURLConnection con;
+ HttpsURLConnection con;
}
}
""",
- """
+ """
import javax.net.ssl.HttpsURLConnection;
-
+
class TestSunNetSsl {
void useThePackages() {
- HttpsURLConnection con;
+ HttpsURLConnection con;
}
}
"""
- )
+ )
);
}
-
}
diff --git a/src/test/java/org/openrewrite/java/migrate/UpgradeJavaVersionTest.java b/src/test/java/org/openrewrite/java/migrate/UpgradeJavaVersionTest.java
index 5d15a8f033..6f8cf2dc73 100644
--- a/src/test/java/org/openrewrite/java/migrate/UpgradeJavaVersionTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/UpgradeJavaVersionTest.java
@@ -44,13 +44,13 @@ void mavenUpgradeFromJava8ToJava17ViaProperties() {
"""
4.0.0
-
+
1.8
1.8
1.8
-
+
com.mycompany.app
my-app
1
@@ -60,13 +60,13 @@ void mavenUpgradeFromJava8ToJava17ViaProperties() {
"""
4.0.0
-
+
17
17
17
-
+
com.mycompany.app
my-app
1
diff --git a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava17Test.java b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava17Test.java
index 2a4001a03f..efee952655 100644
--- a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava17Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava17Test.java
@@ -50,13 +50,13 @@ void upgradeFromJava8ToJava17() {
"""
4.0.0
-
+
1.8
1.8
1.8
-
+
com.mycompany.app
my-app
1
@@ -65,13 +65,13 @@ void upgradeFromJava8ToJava17() {
"""
4.0.0
-
+
17
17
17
-
+
com.mycompany.app
my-app
1
@@ -83,7 +83,7 @@ void upgradeFromJava8ToJava17() {
java(
"""
package com.abc;
-
+
class A {
public String test() {
return String.format("Hello %s", "world");
@@ -92,7 +92,7 @@ public String test() {
""",
"""
package com.abc;
-
+
class A {
public String test() {
return "Hello %s".formatted("world");
@@ -116,13 +116,13 @@ void referenceToJavaVersionProperty() {
"""
4.0.0
-
+
1.8
${java.version}
${java.version}
-
+
com.mycompany.app
my-app
1
@@ -131,13 +131,13 @@ void referenceToJavaVersionProperty() {
"""
4.0.0
-
+
17
${java.version}
${java.version}
-
+
com.mycompany.app
my-app
1
@@ -149,7 +149,7 @@ void referenceToJavaVersionProperty() {
//language=java
"""
package com.abc;
-
+
class A {
public String test() {
return String.format("Hello %s", "world");
@@ -159,7 +159,7 @@ public String test() {
//language=java
"""
package com.abc;
-
+
class A {
public String test() {
return "Hello %s".formatted("world");
@@ -186,9 +186,9 @@ void changeJavaxSecurityCertPackage() {
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-
+
import javax.security.cert.*;
-
+
class Test {
void foo() throws CertificateException, FileNotFoundException {
InputStream inStream = new FileInputStream("cert");
@@ -203,9 +203,9 @@ void foo() throws CertificateException, FileNotFoundException {
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-
+
import java.security.cert.*;
-
+
class Test {
void foo() throws CertificateException, FileNotFoundException {
InputStream inStream = new FileInputStream("cert");
@@ -228,16 +228,16 @@ void removedLegacySunJSSEProviderName() {
java(
"""
import javax.net.ssl.SSLContext;
-
+
class RemovedLegacySunJSSEProviderName {
String legacyProviderName = "com.sun.net.ssl.internal.ssl.Provider"; //flagged
String newProviderName = "SunJSSE"; //not flagged
-
+
void test() throws Exception {
SSLContext.getInstance("TLS", "com.sun.net.ssl.internal.ssl.Provider"); //flagged
SSLContext.getInstance("TLS", "SunJSSE"); //not flagged
}
-
+
void test2() throws Exception {
System.out.println("com.sun.net.ssl.internal.ssl.Provider"); //flagged
}
@@ -245,16 +245,16 @@ void test2() throws Exception {
""",
"""
import javax.net.ssl.SSLContext;
-
+
class RemovedLegacySunJSSEProviderName {
String legacyProviderName = "SunJSSE"; //flagged
String newProviderName = "SunJSSE"; //not flagged
-
+
void test() throws Exception {
SSLContext.getInstance("TLS", "SunJSSE"); //flagged
SSLContext.getInstance("TLS", "SunJSSE"); //not flagged
}
-
+
void test2() throws Exception {
System.out.println("SunJSSE"); //flagged
}
@@ -272,7 +272,7 @@ void replaceLogRecordSetThreadID() {
java(
"""
import java.util.logging.LogRecord;
-
+
class Foo {
void bar(LogRecord record) {
int threadID = record.getThreadID();
@@ -282,7 +282,7 @@ void bar(LogRecord record) {
""",
"""
import java.util.logging.LogRecord;
-
+
class Foo {
void bar(LogRecord record) {
long threadID = record.getLongThreadID();
@@ -406,39 +406,39 @@ void agentMainPreMainPublicApp() {
java(
"""
package com.test;
-
+
import java.lang.instrument.Instrumentation;
-
+
public class AgentMainPreMainPublicApp {
-
+
private static void premain(String agentArgs) {
//This should flag
}
-
+
public static void premain(String agentArgs, Instrumentation inst) {
//This shouldn't flag
}
-
+
public static void premain(String agentArgs, Instrumentation inst, String foo) {
//This shouldn't flag
}
-
+
private static void premain1(String agentArgs) {
//This shouldn't flag
}
-
+
protected void agentmain(String agentArgs) {
//This should flag
}
-
+
static void agentmain(String agentArgs, Instrumentation inst) {
//This should flag
}
-
+
private static void agentmain(String agentArgs, Instrumentation inst, String foo) {
//This shouldn't flag
}
-
+
private static void agentmain(String agentArgs, String inst) {
//This shouldn't flag
}
@@ -446,39 +446,39 @@ private static void agentmain(String agentArgs, String inst) {
""",
"""
package com.test;
-
+
import java.lang.instrument.Instrumentation;
-
+
public class AgentMainPreMainPublicApp {
-
+
public static void premain(String agentArgs) {
//This should flag
}
-
+
public static void premain(String agentArgs, Instrumentation inst) {
//This shouldn't flag
}
-
+
public static void premain(String agentArgs, Instrumentation inst, String foo) {
//This shouldn't flag
}
-
+
private static void premain1(String agentArgs) {
//This shouldn't flag
}
-
+
public void agentmain(String agentArgs) {
//This should flag
}
-
+
public static void agentmain(String agentArgs, Instrumentation inst) {
//This should flag
}
-
+
private static void agentmain(String agentArgs, Instrumentation inst, String foo) {
//This shouldn't flag
}
-
+
private static void agentmain(String agentArgs, String inst) {
//This shouldn't flag
}
@@ -534,38 +534,38 @@ void lombokBumpedGoingTo17() {
}
@Test
- void removedSSLSessionGetPeerCertificateChainMethodImplTest(){
+ void removedSSLSessionGetPeerCertificateChainMethodImplTest() {
rewriteRun(
//language=java
java(
"""
- import java.security.cert.Certificate;
- import javax.net.ssl.SSLContext;
- import javax.net.ssl.SSLEngine;
- import javax.net.ssl.SSLSession;
- class RemovedSSLSessionGetPeerCertificateChainMethodImplApp {
- void test() throws Exception {
- SSLEngine sslEngine = SSLContext.getDefault().createSSLEngine();
- SSLSession session = sslEngine.getHandshakeSession();
- session.getPeerCertificateChain(); //This should trigger
- Certificate[] certs = session.getPeerCertificates(); //This should not trigger
- }
- }
- """,
+ import java.security.cert.Certificate;
+ import javax.net.ssl.SSLContext;
+ import javax.net.ssl.SSLEngine;
+ import javax.net.ssl.SSLSession;
+ class RemovedSSLSessionGetPeerCertificateChainMethodImplApp {
+ void test() throws Exception {
+ SSLEngine sslEngine = SSLContext.getDefault().createSSLEngine();
+ SSLSession session = sslEngine.getHandshakeSession();
+ session.getPeerCertificateChain(); //This should trigger
+ Certificate[] certs = session.getPeerCertificates(); //This should not trigger
+ }
+ }
+ """,
"""
- import java.security.cert.Certificate;
- import javax.net.ssl.SSLContext;
- import javax.net.ssl.SSLEngine;
- import javax.net.ssl.SSLSession;
- class RemovedSSLSessionGetPeerCertificateChainMethodImplApp {
- void test() throws Exception {
- SSLEngine sslEngine = SSLContext.getDefault().createSSLEngine();
- SSLSession session = sslEngine.getHandshakeSession();
- session.getPeerCertificates(); //This should trigger
- Certificate[] certs = session.getPeerCertificates(); //This should not trigger
- }
- }
- """
+ import java.security.cert.Certificate;
+ import javax.net.ssl.SSLContext;
+ import javax.net.ssl.SSLEngine;
+ import javax.net.ssl.SSLSession;
+ class RemovedSSLSessionGetPeerCertificateChainMethodImplApp {
+ void test() throws Exception {
+ SSLEngine sslEngine = SSLContext.getDefault().createSSLEngine();
+ SSLSession session = sslEngine.getHandshakeSession();
+ session.getPeerCertificates(); //This should trigger
+ Certificate[] certs = session.getPeerCertificates(); //This should not trigger
+ }
+ }
+ """
)
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java
index c9a67a7729..790127bae7 100644
--- a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava6Test.java
@@ -37,97 +37,97 @@ void dataSource() {
rewriteRun(
//language=java
java(
- """
+ """
package com.test.withoutWrapperMethods;
-
+
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
-
+
import javax.sql.DataSource;
-
+
public class JRE6WrapperDataSource implements DataSource {
-
+
public Connection getConnection() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Connection getConnection(String username, String password)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public int getLoginTimeout() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
}
""",
"""
package com.test.withoutWrapperMethods;
-
+
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
-
+
import javax.sql.DataSource;
-
+
public class JRE6WrapperDataSource implements DataSource {
-
+
public Connection getConnection() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Connection getConnection(String username, String password)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public int getLoginTimeout() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public boolean isWrapperFor(Class> iface) throws java.sql.SQLException {
// TODO Auto-generated method stub
return iface != null && iface.isAssignableFrom(this.getClass());
}
-
+
public T unwrap(Class iface) throws java.sql.SQLException {
// TODO Auto-generated method stub
try {
@@ -139,7 +139,7 @@ public T unwrap(Class iface) throws java.sql.SQLException {
throw new java.sql.SQLException(e);
}
}
-
+
}
"""
)
diff --git a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava7Test.java b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava7Test.java
index 183bbbb4e7..07903498e1 100644
--- a/src/test/java/org/openrewrite/java/migrate/UpgradeToJava7Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/UpgradeToJava7Test.java
@@ -43,7 +43,7 @@ void callableStatement() {
java(
"""
package com.test.withoutV170Methods;
-
+
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
@@ -67,970 +67,970 @@ void callableStatement() {
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
-
+
public class JRE7JdbcCallableStatement implements CallableStatement {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void addBatch(String sql) throws SQLException {
-
+
}
-
+
public void cancel() throws SQLException {
-
+
}
-
+
public void clearBatch() throws SQLException {
-
+
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public boolean execute(String sql) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int autoGeneratedKeys)
throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, String[] columnNames)
throws SQLException {
return false;
}
-
+
public int[] executeBatch() throws SQLException {
return null;
}
-
+
public ResultSet executeQuery(String sql) throws SQLException {
return null;
}
-
+
public int executeUpdate(String sql) throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int autoGeneratedKeys)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int[] columnIndexes)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, String[] columnNames)
throws SQLException {
return 0;
}
-
+
public Connection getConnection() throws SQLException {
return null;
}
-
+
public int getFetchDirection() throws SQLException {
return 0;
}
-
+
public int getFetchSize() throws SQLException {
return 0;
}
-
+
public ResultSet getGeneratedKeys() throws SQLException {
return null;
}
-
+
public int getMaxFieldSize() throws SQLException {
return 0;
}
-
+
public int getMaxRows() throws SQLException {
return 0;
}
-
+
public boolean getMoreResults() throws SQLException {
return false;
}
-
+
public boolean getMoreResults(int current) throws SQLException {
return false;
}
-
+
public int getQueryTimeout() throws SQLException {
return 0;
}
-
+
public ResultSet getResultSet() throws SQLException {
return null;
}
-
+
public int getResultSetConcurrency() throws SQLException {
return 0;
}
-
+
public int getResultSetHoldability() throws SQLException {
return 0;
}
-
+
public int getResultSetType() throws SQLException {
return 0;
}
-
+
public int getUpdateCount() throws SQLException {
return 0;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public void setCursorName(String name) throws SQLException {
-
+
}
-
+
public void setEscapeProcessing(boolean enable) throws SQLException {
-
+
}
-
+
public void setFetchDirection(int direction) throws SQLException {
-
+
}
-
+
public void setFetchSize(int rows) throws SQLException {
-
+
}
-
+
public void setMaxFieldSize(int max) throws SQLException {
-
+
}
-
+
public void setMaxRows(int max) throws SQLException {
-
+
}
-
+
public void setQueryTimeout(int seconds) throws SQLException {
-
+
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public void setPoolable(boolean poolable) throws SQLException {
-
+
}
-
+
public boolean isPoolable() throws SQLException {
-
+
return false;
}
-
+
public void addBatch() throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void clearParameters() throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public boolean execute() throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public ResultSet executeQuery() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public int executeUpdate() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public ResultSetMetaData getMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public ParameterMetaData getParameterMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void setArray(int arg0, Array arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int arg0, InputStream arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int arg0, InputStream arg1, int arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int arg0, InputStream arg1, long arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBigDecimal(int arg0, BigDecimal arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int arg0, InputStream arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int arg0, InputStream arg1, int arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int arg0, InputStream arg1, long arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(int arg0, Blob arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(int arg0, InputStream arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(int arg0, InputStream arg1, long arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBoolean(int arg0, boolean arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setByte(int arg0, byte arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBytes(int arg0, byte[] arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int arg0, Reader arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int arg0, Reader arg1, int arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int arg0, Reader arg1, long arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(int arg0, Clob arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(int arg0, Reader arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(int arg0, Reader arg1, long arg2) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDate(int arg0, Date arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDate(int arg0, Date arg1, Calendar arg2) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDouble(int arg0, double arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setFloat(int arg0, float arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setInt(int arg0, int arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setLong(int arg0, long arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int arg0, Reader arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int arg0, Reader arg1, long arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(int arg0, NClob arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(int arg0, Reader arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(int arg0, Reader arg1, long arg2) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNString(int arg0, String arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNull(int arg0, int arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNull(int arg0, int arg1, String arg2) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(int arg0, Object arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(int arg0, Object arg1, int arg2) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(int arg0, Object arg1, int arg2, int arg3)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setRef(int arg0, Ref arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setRowId(int arg0, RowId arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setSQLXML(int arg0, SQLXML arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setShort(int arg0, short arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setString(int arg0, String arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTime(int arg0, Time arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTime(int arg0, Time arg1, Calendar arg2) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTimestamp(int arg0, Timestamp arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTimestamp(int arg0, Timestamp arg1, Calendar arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setURL(int arg0, URL arg1) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setUnicodeStream(int arg0, InputStream arg1, int arg2)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public Array getArray(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Array getArray(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public BigDecimal getBigDecimal(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public BigDecimal getBigDecimal(int parameterIndex, int scale)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Blob getBlob(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Blob getBlob(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public boolean getBoolean(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public boolean getBoolean(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public byte getByte(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public byte getByte(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public byte[] getBytes(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public byte[] getBytes(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Reader getCharacterStream(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Reader getCharacterStream(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Clob getClob(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Clob getClob(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(int parameterIndex, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(String parameterName, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public double getDouble(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public double getDouble(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public float getFloat(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public float getFloat(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public int getInt(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public int getInt(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public long getLong(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public long getLong(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public Reader getNCharacterStream(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Reader getNCharacterStream(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public NClob getNClob(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public NClob getNClob(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public String getNString(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public String getNString(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(int parameterIndex, Map> map)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(String parameterName, Map> map)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Ref getRef(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Ref getRef(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public RowId getRowId(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public RowId getRowId(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public SQLXML getSQLXML(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public SQLXML getSQLXML(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public short getShort(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public short getShort(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public String getString(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public String getString(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(int parameterIndex, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(String parameterName, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(int parameterIndex, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(String parameterName, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public URL getURL(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public URL getURL(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void registerOutParameter(int parameterIndex, int sqlType)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void registerOutParameter(String parameterName, int sqlType)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void registerOutParameter(int parameterIndex, int sqlType, int scale)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void registerOutParameter(int parameterIndex, int sqlType,
String typeName) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void registerOutParameter(String parameterName, int sqlType,
int scale) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void registerOutParameter(String parameterName, int sqlType,
String typeName) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(String parameterName, InputStream x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(String parameterName, InputStream x, int length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(String parameterName, InputStream x, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBigDecimal(String parameterName, BigDecimal x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(String parameterName, InputStream x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(String parameterName, InputStream x, int length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(String parameterName, InputStream x, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(String parameterName, Blob x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(String parameterName, InputStream inputStream)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(String parameterName, InputStream inputStream,
long length) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBoolean(String parameterName, boolean x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setByte(String parameterName, byte x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBytes(String parameterName, byte[] x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(String parameterName, Reader reader)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(String parameterName, Reader reader,
int length) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(String parameterName, Reader reader,
long length) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(String parameterName, Clob x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(String parameterName, Reader reader)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(String parameterName, Reader reader, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDate(String parameterName, Date x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDate(String parameterName, Date x, Calendar cal)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDouble(String parameterName, double x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setFloat(String parameterName, float x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setInt(String parameterName, int x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setLong(String parameterName, long x) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setNCharacterStream(String parameterName, Reader value)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(String parameterName, Reader value,
long length) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(String parameterName, NClob value) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(String parameterName, Reader reader)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(String parameterName, Reader reader, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNString(String parameterName, String value)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNull(String parameterName, int sqlType) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNull(String parameterName, int sqlType, String typeName)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(String parameterName, Object x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(String parameterName, Object x, int targetSqlType)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(String parameterName, Object x, int targetSqlType,
int scale) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setRowId(String parameterName, RowId x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setSQLXML(String parameterName, SQLXML xmlObject)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setShort(String parameterName, short x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setString(String parameterName, String x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTime(String parameterName, Time x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTime(String parameterName, Time x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTimestamp(String parameterName, Timestamp x)
throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setTimestamp(String parameterName, Timestamp x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setURL(String parameterName, URL val) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public boolean wasNull() throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
}
""",
"""
package com.test.withoutV170Methods;
-
+
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
@@ -1054,974 +1054,974 @@ public boolean wasNull() throws SQLException {
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
-
+
public class JRE7JdbcCallableStatement implements CallableStatement {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void addBatch(String sql) throws SQLException {
-
+
}
-
+
public void cancel() throws SQLException {
-
+
}
-
+
public void clearBatch() throws SQLException {
-
+
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public boolean execute(String sql) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int autoGeneratedKeys)
throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, String[] columnNames)
throws SQLException {
return false;
}
-
+
public int[] executeBatch() throws SQLException {
return null;
}
-
+
public ResultSet executeQuery(String sql) throws SQLException {
return null;
}
-
+
public int executeUpdate(String sql) throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int autoGeneratedKeys)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int[] columnIndexes)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, String[] columnNames)
throws SQLException {
return 0;
}
-
+
public Connection getConnection() throws SQLException {
return null;
}
-
+
public int getFetchDirection() throws SQLException {
return 0;
}
-
+
public int getFetchSize() throws SQLException {
return 0;
}
-
+
public ResultSet getGeneratedKeys() throws SQLException {
return null;
}
-
+
public int getMaxFieldSize() throws SQLException {
return 0;
}
-
+
public int getMaxRows() throws SQLException {
return 0;
}
-
+
public boolean getMoreResults() throws SQLException {
return false;
}
-
+
public boolean getMoreResults(int current) throws SQLException {
return false;
}
-
+
public int getQueryTimeout() throws SQLException {
return 0;
}
-
+
public ResultSet getResultSet() throws SQLException {
return null;
}
-
+
public int getResultSetConcurrency() throws SQLException {
return 0;
}
-
+
public int getResultSetHoldability() throws SQLException {
return 0;
}
-
+
public int getResultSetType() throws SQLException {
return 0;
}
-
+
public int getUpdateCount() throws SQLException {
return 0;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public void setCursorName(String name) throws SQLException {
-
+
}
-
+
public void setEscapeProcessing(boolean enable) throws SQLException {
-
+
}
-
+
public void setFetchDirection(int direction) throws SQLException {
-
+
}
-
+
public void setFetchSize(int rows) throws SQLException {
-
+
}
-
+
public void setMaxFieldSize(int max) throws SQLException {
-
+
}
-
+
public void setMaxRows(int max) throws SQLException {
-
+
}
-
+
public void setQueryTimeout(int seconds) throws SQLException {
-
+
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public void setPoolable(boolean poolable) throws SQLException {
-
+
}
-
+
public boolean isPoolable() throws SQLException {
-
+
return false;
}
-
+
public void addBatch() throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void clearParameters() throws SQLException {
// TODO Auto-generated method stub
}
-
+
public boolean execute() throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public ResultSet executeQuery() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public int executeUpdate() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public ResultSetMetaData getMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public ParameterMetaData getParameterMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void setArray(int arg0, Array arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int arg0, InputStream arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int arg0, InputStream arg1, int arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int arg0, InputStream arg1, long arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBigDecimal(int arg0, BigDecimal arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int arg0, InputStream arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int arg0, InputStream arg1, int arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int arg0, InputStream arg1, long arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(int arg0, Blob arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(int arg0, InputStream arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(int arg0, InputStream arg1, long arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBoolean(int arg0, boolean arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setByte(int arg0, byte arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBytes(int arg0, byte[] arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int arg0, Reader arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int arg0, Reader arg1, int arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int arg0, Reader arg1, long arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(int arg0, Clob arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(int arg0, Reader arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(int arg0, Reader arg1, long arg2) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDate(int arg0, Date arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDate(int arg0, Date arg1, Calendar arg2) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDouble(int arg0, double arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setFloat(int arg0, float arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setInt(int arg0, int arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setLong(int arg0, long arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int arg0, Reader arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int arg0, Reader arg1, long arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(int arg0, NClob arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(int arg0, Reader arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(int arg0, Reader arg1, long arg2) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNString(int arg0, String arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNull(int arg0, int arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNull(int arg0, int arg1, String arg2) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(int arg0, Object arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(int arg0, Object arg1, int arg2) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(int arg0, Object arg1, int arg2, int arg3)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setRef(int arg0, Ref arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setRowId(int arg0, RowId arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setSQLXML(int arg0, SQLXML arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setShort(int arg0, short arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setString(int arg0, String arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTime(int arg0, Time arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTime(int arg0, Time arg1, Calendar arg2) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTimestamp(int arg0, Timestamp arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTimestamp(int arg0, Timestamp arg1, Calendar arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setURL(int arg0, URL arg1) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setUnicodeStream(int arg0, InputStream arg1, int arg2)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public Array getArray(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Array getArray(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public BigDecimal getBigDecimal(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public BigDecimal getBigDecimal(int parameterIndex, int scale)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Blob getBlob(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Blob getBlob(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public boolean getBoolean(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public boolean getBoolean(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public byte getByte(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public byte getByte(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public byte[] getBytes(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public byte[] getBytes(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Reader getCharacterStream(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Reader getCharacterStream(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Clob getClob(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Clob getClob(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(int parameterIndex, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Date getDate(String parameterName, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public double getDouble(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public double getDouble(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public float getFloat(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public float getFloat(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public int getInt(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public int getInt(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public long getLong(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public long getLong(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public Reader getNCharacterStream(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Reader getNCharacterStream(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public NClob getNClob(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public NClob getNClob(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public String getNString(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public String getNString(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(int parameterIndex, Map> map)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Object getObject(String parameterName, Map> map)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Ref getRef(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Ref getRef(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public RowId getRowId(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public RowId getRowId(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public SQLXML getSQLXML(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public SQLXML getSQLXML(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public short getShort(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public short getShort(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public String getString(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public String getString(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(int parameterIndex, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Time getTime(String parameterName, Calendar cal) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(int parameterIndex, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Timestamp getTimestamp(String parameterName, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public URL getURL(int parameterIndex) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public URL getURL(String parameterName) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void registerOutParameter(int parameterIndex, int sqlType)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void registerOutParameter(String parameterName, int sqlType)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void registerOutParameter(int parameterIndex, int sqlType, int scale)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void registerOutParameter(int parameterIndex, int sqlType,
String typeName) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void registerOutParameter(String parameterName, int sqlType,
int scale) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void registerOutParameter(String parameterName, int sqlType,
String typeName) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(String parameterName, InputStream x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(String parameterName, InputStream x, int length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(String parameterName, InputStream x, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBigDecimal(String parameterName, BigDecimal x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(String parameterName, InputStream x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(String parameterName, InputStream x, int length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(String parameterName, InputStream x, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(String parameterName, Blob x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(String parameterName, InputStream inputStream)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(String parameterName, InputStream inputStream,
long length) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBoolean(String parameterName, boolean x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setByte(String parameterName, byte x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBytes(String parameterName, byte[] x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(String parameterName, Reader reader)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(String parameterName, Reader reader,
int length) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(String parameterName, Reader reader,
long length) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(String parameterName, Clob x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(String parameterName, Reader reader)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(String parameterName, Reader reader, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDate(String parameterName, Date x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDate(String parameterName, Date x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDouble(String parameterName, double x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setFloat(String parameterName, float x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setInt(String parameterName, int x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setLong(String parameterName, long x) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setNCharacterStream(String parameterName, Reader value)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(String parameterName, Reader value,
long length) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(String parameterName, NClob value) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(String parameterName, Reader reader)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(String parameterName, Reader reader, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNString(String parameterName, String value)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNull(String parameterName, int sqlType) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNull(String parameterName, int sqlType, String typeName)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(String parameterName, Object x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(String parameterName, Object x, int targetSqlType)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(String parameterName, Object x, int targetSqlType,
int scale) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setRowId(String parameterName, RowId x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setSQLXML(String parameterName, SQLXML xmlObject)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setShort(String parameterName, short x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setString(String parameterName, String x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTime(String parameterName, Time x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTime(String parameterName, Time x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTimestamp(String parameterName, Timestamp x)
throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setTimestamp(String parameterName, Timestamp x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public void setURL(String parameterName, URL val) throws SQLException {
// TODO Auto-generated method stub
-
+
}
-
+
public boolean wasNull() throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public void closeOnCompletion() {
// TODO Auto-generated method stub
}
-
+
public boolean isCloseOnCompletion() {
// TODO Auto-generated method stub
return false;
}
-
+
}
"""
)
@@ -2035,35 +2035,33 @@ void connectionPoolDataSource() {
java(
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
+
public class JRE7JdbcCollectionPoolDataSource implements ConnectionPoolDataSource {
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
}
-
+
public PooledConnection getPooledConnection() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public PooledConnection getPooledConnection(String arg0, String arg1)
throws SQLException {
// TODO Auto-generated method stub
@@ -2073,41 +2071,39 @@ public PooledConnection getPooledConnection(String arg0, String arg1)
""",
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
+
public class JRE7JdbcCollectionPoolDataSource implements ConnectionPoolDataSource {
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
}
-
+
public PooledConnection getPooledConnection() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public PooledConnection getPooledConnection(String arg0, String arg1)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public java.util.logging.Logger getParentLogger() {
// TODO Auto-generated method stub
return null;
@@ -2125,69 +2121,59 @@ void commonDataSource() {
java(
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.CommonDataSource;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
-
+
public class JRE7JdbcCommonDataSource implements CommonDataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
-
}
-
+
}
""",
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.CommonDataSource;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
-
+
public class JRE7JdbcCommonDataSource implements CommonDataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
-
}
-
+
public java.util.logging.Logger getParentLogger() {
// TODO Auto-generated method stub
return null;
}
-
+
}
"""
)
@@ -2201,60 +2187,56 @@ void commonDataSourceSub() {
java(
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.CommonDataSource;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
+
public class TestSubClass {
public class JRE7JdbcCommonDataSource implements CommonDataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
}
}
}
""",
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.CommonDataSource;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
+
public class TestSubClass {
public class JRE7JdbcCommonDataSource implements CommonDataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
}
-
+
public java.util.logging.Logger getParentLogger() {
// TODO Auto-generated method stub
return null;
@@ -2273,33 +2255,28 @@ void onAbstractClassWithMissingMethod() {
java(
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.CommonDataSource;
-
+
import java.io.PrintWriter;
import java.sql.SQLException;
-
-
+
public abstract class JRE7JdbcCommonDataSource implements CommonDataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
-
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
-
}
-
+
}
"""
)
@@ -2314,476 +2291,474 @@ void connection() {
java(
"""
package com.test.withoutV170Methods;
-
+
import java.sql.*;
import java.util.Map;
import java.util.Properties;
-
+
import javax.sql.*;
-
-
+
public class JRE7JdbcConnection implements java.sql.Connection {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public void commit() throws SQLException {
-
+
}
-
+
public Statement createStatement() throws SQLException {
return null;
}
-
+
public Statement createStatement(int resultSetType, int resultSetConcurrency)
throws SQLException {
return null;
}
-
+
public Statement createStatement(int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public boolean getAutoCommit() throws SQLException {
return false;
}
-
+
public String getCatalog() throws SQLException {
return null;
}
-
+
public int getHoldability() throws SQLException {
return 0;
}
-
+
public DatabaseMetaData getMetaData() throws SQLException {
return null;
}
-
+
public int getTransactionIsolation() throws SQLException {
return 0;
}
-
+
public Map> getTypeMap() throws SQLException {
return null;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public boolean isReadOnly() throws SQLException {
return false;
}
-
+
public String nativeSQL(String sql) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql) throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException {
return null;
}
-
+
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-
+
}
-
+
public void rollback() throws SQLException {
-
+
}
-
+
public void rollback(Savepoint savepoint) throws SQLException {
-
+
}
-
+
public void setAutoCommit(boolean autoCommit) throws SQLException {
-
+
}
-
+
public void setCatalog(String catalog) throws SQLException {
-
+
}
-
+
public void setHoldability(int holdability) throws SQLException {
-
+
}
-
+
public void setReadOnly(boolean readOnly) throws SQLException {
-
+
}
-
+
public Savepoint setSavepoint() throws SQLException {
return null;
}
-
+
public Savepoint setSavepoint(String name) throws SQLException {
return null;
}
-
+
public void setTransactionIsolation(int level) throws SQLException {
-
+
}
-
+
public void setTypeMap(Map> map) throws SQLException {
-
+
}
-
+
public Clob createClob() throws SQLException {
return null;
}
-
+
public Blob createBlob() throws SQLException {
\s
return null;
}
-
+
public NClob createNClob() throws SQLException {
return null;
}
-
+
public SQLXML createSQLXML() throws SQLException {
return null;
}
-
+
public boolean isValid(int timeout) throws SQLException {
return false;
}
-
+
public void setClientInfo(String name, String value) throws SQLClientInfoException {
-
+
}
-
+
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
-
+
}
-
+
public String getClientInfo(String name) throws SQLException {
return null;
}
-
+
public Properties getClientInfo() throws SQLException {
return null;
}
-
+
public Array createArrayOf(String typeName, Object[] elements)
throws SQLException {
return null;
}
-
+
public Struct createStruct(String typeName, Object[] attributes)
throws SQLException {
return null;
}
-
+
}
""",
"""
package com.test.withoutV170Methods;
-
+
import java.sql.*;
import java.util.Map;
import java.util.Properties;
-
+
import javax.sql.*;
-
-
+
public class JRE7JdbcConnection implements java.sql.Connection {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public void commit() throws SQLException {
-
+
}
-
+
public Statement createStatement() throws SQLException {
return null;
}
-
+
public Statement createStatement(int resultSetType, int resultSetConcurrency)
throws SQLException {
return null;
}
-
+
public Statement createStatement(int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public boolean getAutoCommit() throws SQLException {
return false;
}
-
+
public String getCatalog() throws SQLException {
return null;
}
-
+
public int getHoldability() throws SQLException {
return 0;
}
-
+
public DatabaseMetaData getMetaData() throws SQLException {
return null;
}
-
+
public int getTransactionIsolation() throws SQLException {
return 0;
}
-
+
public Map> getTypeMap() throws SQLException {
return null;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public boolean isReadOnly() throws SQLException {
return false;
}
-
+
public String nativeSQL(String sql) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql) throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException {
return null;
}
-
+
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-
+
}
-
+
public void rollback() throws SQLException {
-
+
}
-
+
public void rollback(Savepoint savepoint) throws SQLException {
-
+
}
-
+
public void setAutoCommit(boolean autoCommit) throws SQLException {
-
+
}
-
+
public void setCatalog(String catalog) throws SQLException {
-
+
}
-
+
public void setHoldability(int holdability) throws SQLException {
-
+
}
-
+
public void setReadOnly(boolean readOnly) throws SQLException {
-
+
}
-
+
public Savepoint setSavepoint() throws SQLException {
return null;
}
-
+
public Savepoint setSavepoint(String name) throws SQLException {
return null;
}
-
+
public void setTransactionIsolation(int level) throws SQLException {
-
+
}
-
+
public void setTypeMap(Map> map) throws SQLException {
-
+
}
-
+
public Clob createClob() throws SQLException {
return null;
}
-
+
public Blob createBlob() throws SQLException {
\s
return null;
}
-
+
public NClob createNClob() throws SQLException {
return null;
}
-
+
public SQLXML createSQLXML() throws SQLException {
return null;
}
-
+
public boolean isValid(int timeout) throws SQLException {
return false;
}
-
+
public void setClientInfo(String name, String value) throws SQLClientInfoException {
-
+
}
-
+
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
-
+
}
-
+
public String getClientInfo(String name) throws SQLException {
return null;
}
-
+
public Properties getClientInfo() throws SQLException {
return null;
}
-
+
public Array createArrayOf(String typeName, Object[] elements)
throws SQLException {
return null;
}
-
+
public Struct createStruct(String typeName, Object[] attributes)
throws SQLException {
return null;
}
-
+
public void abort(java.util.concurrent.Executor executor) {
// TODO Auto-generated method stub
}
-
+
public int getNetworkTimeout() {
// TODO Auto-generated method stub
return 0;
}
-
+
public java.lang.String getSchema() {
// TODO Auto-generated method stub
return null;
}
-
+
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) {
// TODO Auto-generated method stub
}
-
+
public void setSchema(java.lang.String schema) throws java.sql.SQLException {
// TODO Auto-generated method stub
}
-
+
}
"""
)
@@ -2797,245 +2772,244 @@ void connectionWithMethodsPresent() {
java(
"""
package com.test.withoutV170Methods;
-
+
import java.sql.*;
import java.util.Map;
import java.util.Properties;
-
+
import javax.sql.*;
-
-
+
public class JRE7JdbcConnection implements java.sql.Connection {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public void commit() throws SQLException {
-
+
}
-
+
public Statement createStatement() throws SQLException {
return null;
}
-
+
public Statement createStatement(int resultSetType, int resultSetConcurrency)
throws SQLException {
return null;
}
-
+
public Statement createStatement(int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public boolean getAutoCommit() throws SQLException {
return false;
}
-
+
public String getCatalog() throws SQLException {
return null;
}
-
+
public int getHoldability() throws SQLException {
return 0;
}
-
+
public DatabaseMetaData getMetaData() throws SQLException {
return null;
}
-
+
public int getTransactionIsolation() throws SQLException {
return 0;
}
-
+
public Map> getTypeMap() throws SQLException {
return null;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public boolean isReadOnly() throws SQLException {
return false;
}
-
+
public String nativeSQL(String sql) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException {
return null;
}
-
+
public CallableStatement prepareCall(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql) throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
return null;
}
-
+
public PreparedStatement prepareStatement(String sql, String[] columnNames)
throws SQLException {
return null;
}
-
+
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-
+
}
-
+
public void rollback() throws SQLException {
-
+
}
-
+
public void rollback(Savepoint savepoint) throws SQLException {
-
+
}
-
+
public void setAutoCommit(boolean autoCommit) throws SQLException {
-
+
}
-
+
public void setCatalog(String catalog) throws SQLException {
-
+
}
-
+
public void setHoldability(int holdability) throws SQLException {
-
+
}
-
+
public void setReadOnly(boolean readOnly) throws SQLException {
-
+
}
-
+
public Savepoint setSavepoint() throws SQLException {
return null;
}
-
+
public Savepoint setSavepoint(String name) throws SQLException {
return null;
}
-
+
public void setTransactionIsolation(int level) throws SQLException {
-
+
}
-
+
public void setTypeMap(Map> map) throws SQLException {
-
+
}
-
+
public Clob createClob() throws SQLException {
return null;
}
-
+
public Blob createBlob() throws SQLException {
-
+
return null;
}
-
+
public NClob createNClob() throws SQLException {
return null;
}
-
+
public SQLXML createSQLXML() throws SQLException {
return null;
}
-
+
public boolean isValid(int timeout) throws SQLException {
return false;
}
-
+
public void setClientInfo(String name, String value) throws SQLClientInfoException {
-
+
}
-
+
public void setClientInfo(Properties properties)
throws SQLClientInfoException {
-
+
}
-
+
public String getClientInfo(String name) throws SQLException {
return null;
}
-
+
public Properties getClientInfo() throws SQLException {
return null;
}
-
+
public Array createArrayOf(String typeName, Object[] elements)
throws SQLException {
return null;
}
-
+
public Struct createStruct(String typeName, Object[] attributes)
throws SQLException {
return null;
}
-
+
public void abort(java.util.concurrent.Executor executor) {
}
-
+
public int getNetworkTimeout() {
return 0;
}
-
+
public java.lang.String getSchema() {
return null;
}
-
+
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) {
}
-
+
public void setSchema(java.lang.String schema) throws java.sql.SQLException {
}
-
+
}
"""
)
@@ -3049,107 +3023,107 @@ void dataSource() {
java(
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.DataSource;
-
+
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
-
+
public class JRE7JdbcDataSource implements DataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
+
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
+
}
-
+
public boolean isWrapperFor(Class> arg0) throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public T unwrap(Class arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Connection getConnection() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Connection getConnection(String arg0, String arg1)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
}
""",
"""
package com.test.withoutV170Methods;
-
+
import javax.sql.DataSource;
-
+
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
-
+
public class JRE7JdbcDataSource implements DataSource {
-
+
public int getLoginTimeout() throws SQLException {
return 0;
}
-
+
public PrintWriter getLogWriter() throws SQLException {
return null;
}
-
+
public void setLoginTimeout(int seconds) throws SQLException {
-
+
}
-
+
public void setLogWriter(PrintWriter out) throws SQLException {
-
+
}
-
+
public boolean isWrapperFor(Class> arg0) throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public T unwrap(Class arg0) throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Connection getConnection() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public Connection getConnection(String arg0, String arg1)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public java.util.logging.Logger getParentLogger() {
// TODO Auto-generated method stub
return null;
}
-
+
}
"""
)
@@ -3163,85 +3137,79 @@ void jre7JdbcDriver() {
java(
"""
package com.test.withoutV170Methods;
-
+
import java.sql.Connection;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Properties;
-
+
public class JRE7JdbcDriver implements java.sql.Driver {
-
+
public boolean acceptsURL(String url) throws SQLException {
return false;
}
-
+
public Connection connect(String url, Properties info) throws SQLException {
return null;
}
-
+
public int getMajorVersion() {
return 0;
}
-
+
public int getMinorVersion() {
return 0;
}
-
+
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException {
return null;
}
-
+
public boolean jdbcCompliant() {
return false;
}
-
-
-
}
""",
"""
package com.test.withoutV170Methods;
-
+
import java.sql.Connection;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Properties;
-
+
public class JRE7JdbcDriver implements java.sql.Driver {
-
+
public boolean acceptsURL(String url) throws SQLException {
return false;
}
-
+
public Connection connect(String url, Properties info) throws SQLException {
return null;
}
-
+
public int getMajorVersion() {
return 0;
}
-
+
public int getMinorVersion() {
return 0;
}
-
+
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException {
return null;
}
-
+
public boolean jdbcCompliant() {
return false;
}
-
+
public java.util.logging.Logger getParentLogger() {
// TODO Auto-generated method stub
return null;
}
-
-
-
}
"""
)
@@ -3255,7 +3223,7 @@ void preparedStatement() {
java(
"""
package com.test.withoutV170Methods;
-
+
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
@@ -3280,436 +3248,436 @@ void preparedStatement() {
import java.util.Calendar;
public class JRE7JdbcPreparedStatement implements PreparedStatement {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void addBatch(String sql) throws SQLException {
-
+
}
-
+
public void cancel() throws SQLException {
-
+
}
-
+
public void clearBatch() throws SQLException {
-
+
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public boolean execute(String sql) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int autoGeneratedKeys)
throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, String[] columnNames)
throws SQLException {
return false;
}
-
+
public int[] executeBatch() throws SQLException {
return null;
}
-
+
public ResultSet executeQuery(String sql) throws SQLException {
return null;
}
-
+
public int executeUpdate(String sql) throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int autoGeneratedKeys)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int[] columnIndexes)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, String[] columnNames)
throws SQLException {
return 0;
}
-
+
public Connection getConnection() throws SQLException {
return null;
}
-
+
public int getFetchDirection() throws SQLException {
return 0;
}
-
+
public int getFetchSize() throws SQLException {
return 0;
}
-
+
public ResultSet getGeneratedKeys() throws SQLException {
return null;
}
-
+
public int getMaxFieldSize() throws SQLException {
return 0;
}
-
+
public int getMaxRows() throws SQLException {
return 0;
}
-
+
public boolean getMoreResults() throws SQLException {
return false;
}
-
+
public boolean getMoreResults(int current) throws SQLException {
return false;
}
-
+
public int getQueryTimeout() throws SQLException {
return 0;
}
-
+
public ResultSet getResultSet() throws SQLException {
return null;
}
-
+
public int getResultSetConcurrency() throws SQLException {
return 0;
}
-
+
public int getResultSetHoldability() throws SQLException {
return 0;
}
-
+
public int getResultSetType() throws SQLException {
return 0;
}
-
+
public int getUpdateCount() throws SQLException {
return 0;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public void setCursorName(String name) throws SQLException {
-
+
}
-
+
public void setEscapeProcessing(boolean enable) throws SQLException {
-
+
}
-
+
public void setFetchDirection(int direction) throws SQLException {
-
+
}
-
+
public void setFetchSize(int rows) throws SQLException {
-
+
}
-
+
public void setMaxFieldSize(int max) throws SQLException {
-
+
}
-
+
public void setMaxRows(int max) throws SQLException {
-
+
}
-
+
public void setQueryTimeout(int seconds) throws SQLException {
-
+
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public void setPoolable(boolean poolable) throws SQLException {
-
+
}
-
+
public boolean isPoolable() throws SQLException {
-
+
return false;
}
-
+
public void addBatch() throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void clearParameters() throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public boolean execute() throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public ResultSet executeQuery() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public int executeUpdate() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public ResultSetMetaData getMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public ParameterMetaData getParameterMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void setArray(int parameterIndex, Array x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int parameterIndex, InputStream x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int parameterIndex, InputStream x, int length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int parameterIndex, InputStream x, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBigDecimal(int parameterIndex, BigDecimal x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int parameterIndex, InputStream x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int parameterIndex, InputStream x, int length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int parameterIndex, InputStream x, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(int parameterIndex, Blob x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(int parameterIndex, InputStream inputStream)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBlob(int parameterIndex, InputStream inputStream, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setByte(int parameterIndex, byte x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int parameterIndex, Reader reader)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int parameterIndex, Reader reader, int length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int parameterIndex, Reader reader,
long length) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(int parameterIndex, Clob x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(int parameterIndex, Reader reader) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setClob(int parameterIndex, Reader reader, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDate(int parameterIndex, Date x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDate(int parameterIndex, Date x, Calendar cal)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setDouble(int parameterIndex, double x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setFloat(int parameterIndex, float x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setInt(int parameterIndex, int x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setLong(int parameterIndex, long x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int parameterIndex, Reader value)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int parameterIndex, Reader value,
long length) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(int parameterIndex, NClob value) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNClob(int parameterIndex, Reader reader, long length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNString(int parameterIndex, String value)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNull(int parameterIndex, int sqlType) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setNull(int parameterIndex, int sqlType, String typeName)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(int parameterIndex, Object x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(int parameterIndex, Object x, int targetSqlType)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setObject(int parameterIndex, Object x, int targetSqlType,
int scaleOrLength) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setRef(int parameterIndex, Ref x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setRowId(int parameterIndex, RowId x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setSQLXML(int parameterIndex, SQLXML xmlObject)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setShort(int parameterIndex, short x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setString(int parameterIndex, String x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTime(int parameterIndex, Time x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTime(int parameterIndex, Time x, Calendar cal)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTimestamp(int parameterIndex, Timestamp x)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setURL(int parameterIndex, URL x) throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
-
+
public void setUnicodeStream(int parameterIndex, InputStream x, int length)
throws SQLException {
- // TODO Auto-generated method stub
+ // TODO Auto-generated method stub
}
}
""",
"""
package com.test.withoutV170Methods;
-
+
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
@@ -3732,438 +3700,438 @@ public void setUnicodeStream(int parameterIndex, InputStream x, int length)
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
-
+
public class JRE7JdbcPreparedStatement implements PreparedStatement {
-
+
public T unwrap(Class iface) throws SQLException {
return null;
}
-
+
public boolean isWrapperFor(Class> iface) throws SQLException {
return false;
}
-
+
public void addBatch(String sql) throws SQLException {
-
+
}
-
+
public void cancel() throws SQLException {
-
+
}
-
+
public void clearBatch() throws SQLException {
-
+
}
-
+
public void clearWarnings() throws SQLException {
-
+
}
-
+
public void close() throws SQLException {
-
+
}
-
+
public boolean execute(String sql) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int autoGeneratedKeys)
throws SQLException {
return false;
}
-
+
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
return false;
}
-
+
public boolean execute(String sql, String[] columnNames)
throws SQLException {
return false;
}
-
+
public int[] executeBatch() throws SQLException {
return null;
}
-
+
public ResultSet executeQuery(String sql) throws SQLException {
return null;
}
-
+
public int executeUpdate(String sql) throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int autoGeneratedKeys)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, int[] columnIndexes)
throws SQLException {
return 0;
}
-
+
public int executeUpdate(String sql, String[] columnNames)
throws SQLException {
return 0;
}
-
+
public Connection getConnection() throws SQLException {
return null;
}
-
+
public int getFetchDirection() throws SQLException {
return 0;
}
-
+
public int getFetchSize() throws SQLException {
return 0;
}
-
+
public ResultSet getGeneratedKeys() throws SQLException {
return null;
}
-
+
public int getMaxFieldSize() throws SQLException {
return 0;
}
-
+
public int getMaxRows() throws SQLException {
return 0;
}
-
+
public boolean getMoreResults() throws SQLException {
return false;
}
-
+
public boolean getMoreResults(int current) throws SQLException {
return false;
}
-
+
public int getQueryTimeout() throws SQLException {
return 0;
}
-
+
public ResultSet getResultSet() throws SQLException {
return null;
}
-
+
public int getResultSetConcurrency() throws SQLException {
return 0;
}
-
+
public int getResultSetHoldability() throws SQLException {
return 0;
}
-
+
public int getResultSetType() throws SQLException {
return 0;
}
-
+
public int getUpdateCount() throws SQLException {
return 0;
}
-
+
public SQLWarning getWarnings() throws SQLException {
return null;
}
-
+
public void setCursorName(String name) throws SQLException {
-
+
}
-
+
public void setEscapeProcessing(boolean enable) throws SQLException {
-
+
}
-
+
public void setFetchDirection(int direction) throws SQLException {
-
+
}
-
+
public void setFetchSize(int rows) throws SQLException {
-
+
}
-
+
public void setMaxFieldSize(int max) throws SQLException {
-
+
}
-
+
public void setMaxRows(int max) throws SQLException {
-
+
}
-
+
public void setQueryTimeout(int seconds) throws SQLException {
-
+
}
-
+
public boolean isClosed() throws SQLException {
return false;
}
-
+
public void setPoolable(boolean poolable) throws SQLException {
-
+
}
-
+
public boolean isPoolable() throws SQLException {
-
+
return false;
}
-
+
public void addBatch() throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void clearParameters() throws SQLException {
// TODO Auto-generated method stub
}
-
+
public boolean execute() throws SQLException {
// TODO Auto-generated method stub
return false;
}
-
+
public ResultSet executeQuery() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public int executeUpdate() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
-
+
public ResultSetMetaData getMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public ParameterMetaData getParameterMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
-
+
public void setArray(int parameterIndex, Array x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int parameterIndex, InputStream x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int parameterIndex, InputStream x, int length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setAsciiStream(int parameterIndex, InputStream x, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBigDecimal(int parameterIndex, BigDecimal x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int parameterIndex, InputStream x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int parameterIndex, InputStream x, int length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBinaryStream(int parameterIndex, InputStream x, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(int parameterIndex, Blob x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(int parameterIndex, InputStream inputStream)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBlob(int parameterIndex, InputStream inputStream, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setByte(int parameterIndex, byte x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int parameterIndex, Reader reader)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int parameterIndex, Reader reader, int length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setCharacterStream(int parameterIndex, Reader reader,
long length) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(int parameterIndex, Clob x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(int parameterIndex, Reader reader) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setClob(int parameterIndex, Reader reader, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDate(int parameterIndex, Date x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDate(int parameterIndex, Date x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setDouble(int parameterIndex, double x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setFloat(int parameterIndex, float x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setInt(int parameterIndex, int x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setLong(int parameterIndex, long x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int parameterIndex, Reader value)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNCharacterStream(int parameterIndex, Reader value,
long length) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(int parameterIndex, NClob value) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNClob(int parameterIndex, Reader reader, long length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNString(int parameterIndex, String value)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNull(int parameterIndex, int sqlType) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setNull(int parameterIndex, int sqlType, String typeName)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(int parameterIndex, Object x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(int parameterIndex, Object x, int targetSqlType)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setObject(int parameterIndex, Object x, int targetSqlType,
int scaleOrLength) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setRef(int parameterIndex, Ref x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setRowId(int parameterIndex, RowId x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setSQLXML(int parameterIndex, SQLXML xmlObject)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setShort(int parameterIndex, short x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setString(int parameterIndex, String x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTime(int parameterIndex, Time x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTime(int parameterIndex, Time x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTimestamp(int parameterIndex, Timestamp x)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setURL(int parameterIndex, URL x) throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void setUnicodeStream(int parameterIndex, InputStream x, int length)
throws SQLException {
// TODO Auto-generated method stub
}
-
+
public void closeOnCompletion() {
// TODO Auto-generated method stub
}
-
+
public boolean isCloseOnCompletion() {
// TODO Auto-generated method stub
return false;
diff --git a/src/test/java/org/openrewrite/java/migrate/UseJavaUtilBase64Test.java b/src/test/java/org/openrewrite/java/migrate/UseJavaUtilBase64Test.java
index 718693604b..be78c34e24 100644
--- a/src/test/java/org/openrewrite/java/migrate/UseJavaUtilBase64Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/UseJavaUtilBase64Test.java
@@ -34,7 +34,7 @@ public void defaults(RecipeSpec spec) {
.dependsOn(
"""
package test.sun.misc;
-
+
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.OutputStream;
@@ -42,7 +42,7 @@ public void defaults(RecipeSpec spec) {
import java.io.PrintStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-
+
@SuppressWarnings("RedundantThrows")
class CharacterEncoder {
public void encode(InputStream inStream, OutputStream outStream) throws IOException {
@@ -50,31 +50,31 @@ public void encode(InputStream inStream, OutputStream outStream) throws IOExcept
public void encode(byte[] aBuffer, OutputStream aStream) throws IOException {
}
-
+
public String encode(byte[] aBuffer) {
return "";
}
public void encode(ByteBuffer aBuffer, OutputStream aStream) throws IOException {
}
-
+
public String encode(ByteBuffer aBuffer) {
return "";
}
-
+
public void encodeBuffer(InputStream inStream, OutputStream outStream) throws IOException {
}
-
+
public void encodeBuffer(byte[] aBuffer, OutputStream aStream) throws IOException {
}
-
+
public String encodeBuffer(byte[] aBuffer) {
return "";
}
-
+
public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream) throws IOException {
}
-
+
public String encodeBuffer(ByteBuffer aBuffer) {
return "";
}
@@ -82,7 +82,7 @@ public String encodeBuffer(ByteBuffer aBuffer) {
""",
"""
package test.sun.misc;
-
+
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.OutputStream;
@@ -90,25 +90,25 @@ public String encodeBuffer(ByteBuffer aBuffer) {
import java.io.PrintStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-
+
@SuppressWarnings("RedundantThrows")
class CharacterDecoder {
public void decode(InputStream inStream, OutputStream outStream) throws IOException {
}
-
+
public void decode(String inString, OutputStream outStream) throws IOException {
}
-
+
public void decodeBuffer(InputStream inStream, OutputStream outStream) throws IOException {
}
-
+
public void decodeBuffer(String inString, OutputStream outStream) throws IOException {
}
-
+
public byte[] decodeBuffer(String inString) throws IOException {
return new byte[0];
}
-
+
public byte[] decodeBuffer(InputStream inStream) throws IOException {
return new byte[0];
}
@@ -136,7 +136,7 @@ void encodeDecode() {
java(
"""
package test.sun.misc;
-
+
import test.sun.misc.BASE64Encoder;
import test.sun.misc.BASE64Decoder;
import java.io.IOException;
@@ -156,9 +156,9 @@ void test(byte[] bBytes) {
""",
"""
package test.sun.misc;
-
+
import java.util.Base64;
-
+
class Test {
void test(byte[] bBytes) {
Base64.Encoder encoder = Base64.getEncoder();
@@ -182,7 +182,7 @@ void mime() {
java(
"""
package test.sun.misc;
-
+
import test.sun.misc.BASE64Encoder;
import test.sun.misc.BASE64Decoder;
import java.io.IOException;
@@ -202,9 +202,9 @@ void test(byte[] bBytes) {
""",
"""
package test.sun.misc;
-
+
import java.util.Base64;
-
+
class Test {
void test(byte[] bBytes) {
Base64.Encoder encoder = Base64.getMimeEncoder();
@@ -226,25 +226,25 @@ void otherBase64() {
java(
"""
package test.sun.misc;
-
+
public class App {
public static void main(String[] args) {
String encode = new BASE64Encoder().encode(new byte[16]);
}
}
-
+
class Base64 {
}
""",
"""
/*~~(Already using a class named Base64 other than java.util.Base64. Manual intervention required.)~~>*/package test.sun.misc;
-
+
public class App {
public static void main(String[] args) {
String encode = new BASE64Encoder().encode(new byte[16]);
}
}
-
+
class Base64 {
}
"""
diff --git a/src/test/java/org/openrewrite/java/migrate/concurrent/JavaConcurrentAPIsTest.java b/src/test/java/org/openrewrite/java/migrate/concurrent/JavaConcurrentAPIsTest.java
index 2305b50016..435b80f88c 100644
--- a/src/test/java/org/openrewrite/java/migrate/concurrent/JavaConcurrentAPIsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/concurrent/JavaConcurrentAPIsTest.java
@@ -58,8 +58,8 @@ public boolean method() {
}
}
"""
-)
-);
+ )
+ );
}
@Test
@@ -85,8 +85,8 @@ public boolean method() {
}
}
"""
-)
-);
+ )
+ );
}
@Test
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaCreateTempDirTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaCreateTempDirTest.java
index e059e43781..7c9b42663d 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaCreateTempDirTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaCreateTempDirTest.java
@@ -42,7 +42,7 @@ void inMethodThrowingException() {
import java.io.File;
import java.io.IOException;
import com.google.common.io.Files;
-
+
class A {
void doSomething() throws IOException {
File dir = Files.createTempDir();
@@ -58,7 +58,7 @@ void doSomethingElse() throws Exception {
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-
+
class A {
void doSomething() throws IOException {
File dir = Files.createTempDirectory(null).toFile();
@@ -82,7 +82,7 @@ void tempDirIsFieldVar() {
"""
import java.io.File;
import com.google.common.io.Files;
-
+
class A {
File gDir = Files.createTempDir();
}
@@ -100,7 +100,7 @@ void tempDirIsStaticBlock() {
import java.io.File;
import java.io.IOException;
import com.google.common.io.Files;
-
+
class A {
public void doSomething() {
try {
@@ -122,7 +122,7 @@ public void doSomethingElse() {
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
-
+
class A {
public void doSomething() {
try {
@@ -152,7 +152,7 @@ void tempDirIsInMethodNotThrowingIOException() {
"""
import java.io.File;
import com.google.common.io.Files;
-
+
class A {
void doSomething() {
File gDir = Files.createTempDir();
@@ -171,7 +171,7 @@ void guavaCreateTempDirIsMethodArgument() {
"""
import java.io.File;
import com.google.common.io.Files;
-
+
class Test {
void someTest() {
doSomething(Files.createTempDir(), "some text");
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaDirectExecutorTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaDirectExecutorTest.java
index 52c1563d96..12969e3424 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaDirectExecutorTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaDirectExecutorTest.java
@@ -52,7 +52,7 @@ class Test {
Executor executor = Runnable::run;
}
"""
-)
-);
+ )
+ );
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableListOfTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableListOfTest.java
index 3555d1c8c1..085eccbc3b 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableListOfTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableListOfTest.java
@@ -39,7 +39,7 @@ void doNotChangeReturnsImmutableList() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
ImmutableList getList() {
return ImmutableList.of();
@@ -58,10 +58,10 @@ void doNotChangeFieldAssignmentToImmutableList() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
ImmutableList m;
-
+
{
this.m = ImmutableList.of();
}
@@ -78,10 +78,10 @@ void doNotChangeAssignsToImmutableList() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
ImmutableList m;
-
+
void init() {
m = ImmutableList.of();
}
@@ -98,7 +98,7 @@ void doNotChangeNewClass() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
public class A {
ImmutableList immutableList;
public A(ImmutableList immutableList) {
@@ -111,7 +111,7 @@ public A(ImmutableList immutableList) {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
A a = new A(ImmutableList.of());
}
@@ -129,7 +129,7 @@ void doNotChangeMethodInvocation() {
//language=java
"""
import com.google.common.collect.ImmutableList;
-
+
public class A {
ImmutableList immutableList;
public void method(ImmutableList immutableList) {
@@ -143,7 +143,7 @@ public void method(ImmutableList immutableList) {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
void method() {
A a = new A();
@@ -164,14 +164,14 @@ void replaceArguments() {
"""
import java.util.List;
import com.google.common.collect.ImmutableList;
-
+
class Test {
List m = ImmutableList.of("A", "B", "C", "D");
}
""",
"""
import java.util.List;
-
+
class Test {
List m = List.of("A", "B", "C", "D");
}
@@ -191,7 +191,7 @@ void fieldAssignmentToList() {
"""
import java.util.List;
import com.google.common.collect.ImmutableList;
-
+
class Test {
List m;
{
@@ -201,7 +201,7 @@ class Test {
""",
"""
import java.util.List;
-
+
class Test {
List m;
{
@@ -224,14 +224,14 @@ void assignmentToList() {
"""
import java.util.List;
import com.google.common.collect.ImmutableList;
-
+
class Test {
List m = ImmutableList.of();
}
""",
"""
import java.util.List;
-
+
class Test {
List m = List.of();
}
@@ -251,7 +251,7 @@ void returnsList() {
"""
import java.util.List;
import com.google.common.collect.ImmutableList;
-
+
class Test {
List list() {
return ImmutableList.of();
@@ -260,7 +260,7 @@ List list() {
""",
"""
import java.util.List;
-
+
class Test {
List list() {
return List.of();
@@ -280,7 +280,7 @@ void newClassWithListArgument() {
java(
"""
import java.util.List;
-
+
public class A {
List list;
public A(List list) {
@@ -294,14 +294,14 @@ public A(List list) {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
A a = new A(ImmutableList.of());
}
""",
"""
import java.util.List;
-
+
class Test {
A a = new A(List.of());
}
@@ -319,7 +319,7 @@ void methodInvocationWithListArgument() {
java(
"""
import java.util.List;
-
+
public class A {
List list;
public void method(List list) {
@@ -333,7 +333,7 @@ public void method(List list) {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
void method() {
A a = new A();
@@ -343,7 +343,7 @@ void method() {
""",
"""
import java.util.List;
-
+
class Test {
void method() {
A a = new A();
@@ -367,7 +367,7 @@ void listOfInts() {
"""
import java.util.List;
import com.google.common.collect.ImmutableList;
-
+
class Test {
List list() {
return ImmutableList.of(1, 2, 3);
@@ -376,7 +376,7 @@ List list() {
""",
"""
import java.util.List;
-
+
class Test {
List list() {
return List.of(1, 2, 3);
@@ -398,7 +398,7 @@ void insideAnonymousArrayInitializer() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class A {
Object[] o = new Object[] {
ImmutableList.of(1, 2, 3)
@@ -407,7 +407,7 @@ class A {
""",
"""
import java.util.List;
-
+
class A {
Object[] o = new Object[] {
List.of(1, 2, 3)
@@ -429,14 +429,14 @@ void assignToMoreGeneralType() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class A {
Object o = ImmutableList.of(1, 2, 3);
}
""",
"""
import java.util.List;
-
+
class A {
Object o = List.of(1, 2, 3);
}
@@ -457,7 +457,7 @@ void doNotChangeNestedLists() {
"""
import com.google.common.collect.ImmutableList;
import java.util.List;
-
+
class A {
Object o = List.of(ImmutableList.of(1, 2), ImmutableList.of(2, 3));
}
@@ -477,7 +477,7 @@ void doNotchangeAssignToImmutableList() {
java(
"""
import com.google.common.collect.ImmutableList;
-
+
class Test {
ImmutableList l = ImmutableList.of();
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableMapOfTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableMapOfTest.java
index f70f62f92c..4166a18f68 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableMapOfTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableMapOfTest.java
@@ -57,10 +57,10 @@ void doNotChangeFieldAssignmentToImmutableMap() {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class Test {
ImmutableMap m;
-
+
{
this.m = ImmutableMap.of();
}
@@ -77,10 +77,10 @@ void doNotChangeAssignsToImmutableMap() {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class Test {
ImmutableMap m;
-
+
void init() {
m = ImmutableMap.of();
}
@@ -97,7 +97,7 @@ void doNotChangeNewClass() {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
public class A {
ImmutableMap immutableMap;
public A(ImmutableMap immutableMap) {
@@ -109,7 +109,7 @@ public A(ImmutableMap immutableMap) {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class Test {
A a = new A(ImmutableMap.of());
}
@@ -125,7 +125,7 @@ void doNotChangeMethodInvocation() {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
public class A {
ImmutableMap immutableMap;
public void method(ImmutableMap immutableMap) {
@@ -158,14 +158,14 @@ void replaceArguments() {
"""
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
Map m = ImmutableMap.of("A", "B", "C", "D");
}
""",
"""
import java.util.Map;
-
+
class Test {
Map m = Map.of("A", "B", "C", "D");
}
@@ -185,7 +185,7 @@ void fieldAssignmentToMap() {
"""
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
Map m;
{
@@ -195,7 +195,7 @@ class Test {
""",
"""
import java.util.Map;
-
+
class Test {
Map m;
{
@@ -218,14 +218,14 @@ void assignmentToMap() {
"""
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
Map m = ImmutableMap.of();
}
""",
"""
import java.util.Map;
-
+
class Test {
Map m = Map.of();
}
@@ -245,7 +245,7 @@ void returnsMap() {
"""
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
Map map() {
return ImmutableMap.of();
@@ -254,7 +254,7 @@ Map map() {
""",
"""
import java.util.Map;
-
+
class Test {
Map map() {
return Map.of();
@@ -277,7 +277,7 @@ void mapOfInts() {
"""
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
Map map() {
return ImmutableMap.of(1, 1, 2, 2, 3, 3);
@@ -286,7 +286,7 @@ Map map() {
""",
"""
import java.util.Map;
-
+
class Test {
Map map() {
return Map.of(1, 1, 2, 2, 3, 3);
@@ -306,7 +306,7 @@ void newClassWithMapArgument() {
java(
"""
import java.util.Map;
-
+
public class A {
Map map;
public A(Map map) {
@@ -319,14 +319,14 @@ public A(Map map) {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class Test {
A a = new A(ImmutableMap.of());
}
""",
"""
import java.util.Map;
-
+
class Test {
A a = new A(Map.of());
}
@@ -344,7 +344,7 @@ void methodInvocationWithMapArgument() {
java(
"""
import java.util.Map;
-
+
public class A {
Map map;
public void method(Map map) {
@@ -357,7 +357,7 @@ public void method(Map map) {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class Test {
void method() {
A a = new A();
@@ -367,7 +367,7 @@ void method() {
""",
"""
import java.util.Map;
-
+
class Test {
void method() {
A a = new A();
@@ -391,7 +391,7 @@ void variableIsMap() {
import java.util.HashMap;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
Map> map = new HashMap<>();
void setMap(String value) {
@@ -404,7 +404,7 @@ void setMap(String value) {
"""
import java.util.HashMap;
import java.util.Map;
-
+
class Test {
Map> map = new HashMap<>();
void setMap(String value) {
@@ -429,7 +429,7 @@ void insideAnonymousArrayInitializer() {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class A {
Object[] o = new Object[] {
ImmutableMap.of(1, 1, 2, 2, 3, 3)
@@ -438,7 +438,7 @@ class A {
""",
"""
import java.util.Map;
-
+
class A {
Object[] o = new Object[] {
Map.of(1, 1, 2, 2, 3, 3)
@@ -460,14 +460,14 @@ void assignToMoreGeneralType() {
java(
"""
import com.google.common.collect.ImmutableMap;
-
+
class A {
Object o = ImmutableMap.of(1, 1, 2, 2, 3, 3);
}
""",
"""
import java.util.Map;
-
+
class A {
Object o = Map.of(1, 1, 2, 2, 3, 3);
}
@@ -488,7 +488,7 @@ void doNotChangeNestedMaps() {
"""
import com.google.common.collect.ImmutableMap;
import java.util.Map;
-
+
class A {
Object o = Map.of(1, ImmutableMap.of(2, 3));
}
@@ -509,7 +509,7 @@ void doNotchangeAssignToImmutableMap() {
"""
import java.util.Map;
import com.google.common.collect.ImmutableMap;
-
+
class Test {
ImmutableMap m = ImmutableMap.of();
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableSetOfTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableSetOfTest.java
index c33f5dd68e..5f5fafb4ee 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableSetOfTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaImmutableSetOfTest.java
@@ -39,7 +39,7 @@ void doNotChangeReturnsImmutableSet() {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
ImmutableSet getSet() {
return ImmutableSet.of();
@@ -57,10 +57,10 @@ void doNotChangeFieldAssignmentToImmutableSet() {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
ImmutableSet m;
-
+
{
this.m = ImmutableSet.of();
}
@@ -77,10 +77,10 @@ void doNotChangeAssignsToImmutableSet() {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
ImmutableSet m;
-
+
void init() {
m = ImmutableSet.of();
}
@@ -100,7 +100,7 @@ void doNotChangeNewClass() {
//language=java
"""
import com.google.common.collect.ImmutableSet;
-
+
public class A {
ImmutableSet immutableSet;
public A(ImmutableSet immutableSet) {
@@ -113,7 +113,7 @@ public A(ImmutableSet immutableSet) {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
A a = new A(ImmutableSet.of());
}
@@ -132,7 +132,7 @@ void doNotChangeMethodInvocation() {
//language=java
"""
import com.google.common.collect.ImmutableSet;
-
+
public class A {
ImmutableSet immutableSet;
public void method(ImmutableSet immutableSet) {
@@ -145,7 +145,7 @@ public void method(ImmutableSet immutableSet) {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
void method() {
A a = new A();
@@ -166,14 +166,14 @@ void replaceArguments() {
"""
import java.util.Set;
import com.google.common.collect.ImmutableSet;
-
+
class Test {
Set m = ImmutableSet.of("A", "B", "C", "D");
}
""",
"""
import java.util.Set;
-
+
class Test {
Set m = Set.of("A", "B", "C", "D");
}
@@ -193,7 +193,7 @@ void fieldAssignmentToSet() {
"""
import java.util.Set;
import com.google.common.collect.ImmutableSet;
-
+
class Test {
Set m;
{
@@ -203,7 +203,7 @@ class Test {
""",
"""
import java.util.Set;
-
+
class Test {
Set m;
{
@@ -226,14 +226,14 @@ void assignmentToSet() {
"""
import java.util.Set;
import com.google.common.collect.ImmutableSet;
-
+
class Test {
Set m = ImmutableSet.of();
}
""",
"""
import java.util.Set;
-
+
class Test {
Set m = Set.of();
}
@@ -253,7 +253,7 @@ void returnsSet() {
"""
import java.util.Set;
import com.google.common.collect.ImmutableSet;
-
+
class Test {
Set set() {
return ImmutableSet.of();
@@ -262,7 +262,7 @@ Set set() {
""",
"""
import java.util.Set;
-
+
class Test {
Set set() {
return Set.of();
@@ -285,7 +285,7 @@ void setOfInts() {
"""
import java.util.Set;
import com.google.common.collect.ImmutableSet;
-
+
class Test {
Set set() {
return ImmutableSet.of(1, 2, 3);
@@ -294,7 +294,7 @@ Set set() {
""",
"""
import java.util.Set;
-
+
class Test {
Set set() {
return Set.of(1, 2, 3);
@@ -314,7 +314,7 @@ void newClassWithSetArgument() {
java(
"""
import java.util.Set;
-
+
public class A {
Set set;
public A(Set set) {
@@ -328,14 +328,14 @@ public A(Set set) {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
A a = new A(ImmutableSet.of());
}
""",
"""
import java.util.Set;
-
+
class Test {
A a = new A(Set.of());
}
@@ -353,7 +353,7 @@ void methodInvocationWithSetArgument() {
java(
"""
import java.util.Set;
-
+
public class A {
Set set;
public void method(Set set) {
@@ -366,7 +366,7 @@ public void method(Set set) {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
void method() {
A a = new A();
@@ -376,7 +376,7 @@ void method() {
""",
"""
import java.util.Set;
-
+
class Test {
void method() {
A a = new A();
@@ -399,7 +399,7 @@ void insideAnonymousArrayInitializer() {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class A {
Object[] o = new Object[] {
ImmutableSet.of(1, 2, 3)
@@ -408,7 +408,7 @@ class A {
""",
"""
import java.util.Set;
-
+
class A {
Object[] o = new Object[] {
Set.of(1, 2, 3)
@@ -430,14 +430,14 @@ void assignToMoreGeneralType() {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class A {
Object o = ImmutableSet.of(1, 2, 3);
}
""",
"""
import java.util.Set;
-
+
class A {
Object o = Set.of(1, 2, 3);
}
@@ -458,7 +458,7 @@ void doNotChangeNestedSets() {
"""
import com.google.common.collect.ImmutableSet;
import java.util.Set;
-
+
class A {
Object o = Set.of(ImmutableSet.of(1, 2));
}
@@ -478,7 +478,7 @@ void doNotchangeAssignToImmutableSet() {
java(
"""
import com.google.common.collect.ImmutableSet;
-
+
class Test {
ImmutableSetp m = ImmutableSet.of();
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaJava21Test.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaJava21Test.java
index 8aae8c28a0..84d0dc3ea7 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaJava21Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaJava21Test.java
@@ -44,7 +44,7 @@ void preferMathClampForDouble() {
java(
"""
import com.google.common.primitives.Doubles;
-
+
class Test {
public double testMethod() {
return Doubles.constrainToRange(20D, 10D, 100D);
@@ -71,7 +71,7 @@ void preferMathClampForLongs() {
java(
"""
import com.google.common.primitives.Longs;
-
+
class Test {
public long testMethod() {
return Longs.constrainToRange(20L, 10L, 100L);
@@ -98,7 +98,7 @@ void preferMathClampForFloats() {
java(
"""
import com.google.common.primitives.Floats;
-
+
class Test {
public float testMethod() {
return Floats.constrainToRange(20F, 10F, 100F);
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewCopyOnWriteArrayListTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewCopyOnWriteArrayListTest.java
index d4c809bafe..43ee7da979 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewCopyOnWriteArrayListTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewCopyOnWriteArrayListTest.java
@@ -40,9 +40,9 @@ void replaceWithNewCopyOnWriteArrayList() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.List;
-
+
class Test {
List cardinalsWorldSeries = Lists.newCopyOnWriteArrayList();
}
@@ -50,13 +50,13 @@ class Test {
"""
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-
+
class Test {
List cardinalsWorldSeries = new CopyOnWriteArrayList<>();
}
"""
-)
-);
+ )
+ );
}
@Test
@@ -66,10 +66,10 @@ void replaceWithNewCopyOnWriteArrayListCollection() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Collections;
import java.util.List;
-
+
class Test {
List l = Collections.emptyList();
List cardinalsWorldSeries = Lists.newCopyOnWriteArrayList(l);
@@ -79,7 +79,7 @@ class Test {
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-
+
class Test {
List l = Collections.emptyList();
List cardinalsWorldSeries = new CopyOnWriteArrayList<>(l);
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewLinkedListTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewLinkedListTest.java
index 5bb4c98c10..85a57b20d9 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewLinkedListTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaListsNewLinkedListTest.java
@@ -40,9 +40,9 @@ void replaceWithNewLinkedList() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.List;
-
+
class Test {
List cardinalsWorldSeries = Lists.newLinkedList();
}
@@ -50,7 +50,7 @@ class Test {
"""
import java.util.LinkedList;
import java.util.List;
-
+
class Test {
List cardinalsWorldSeries = new LinkedList<>();
}
@@ -66,11 +66,11 @@ void replaceWithNewLinkedListCollection() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-
+
class Test {
List l = Collections.emptyList();
List cardinalsWorldSeries = Lists.newLinkedList(l);
@@ -80,7 +80,7 @@ class Test {
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-
+
class Test {
List l = Collections.emptyList();
List cardinalsWorldSeries = new LinkedList<>(l);
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaMapsNewLinkedHashMapTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaMapsNewLinkedHashMapTest.java
index 6717af8180..d94d05980e 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaMapsNewLinkedHashMapTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaMapsNewLinkedHashMapTest.java
@@ -41,9 +41,9 @@ void replaceWithNewLinkedHashMap() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Map;
-
+
class Test {
Map cardinalsWorldSeries = Maps.newLinkedHashMap();
}
@@ -51,7 +51,7 @@ class Test {
"""
import java.util.LinkedHashMap;
import java.util.Map;
-
+
class Test {
Map cardinalsWorldSeries = new LinkedHashMap<>();
}
@@ -67,10 +67,10 @@ void replaceWithNewLinkedHashMapWithMap() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Collections;
import java.util.Map;
-
+
class Test {
Map m = Collections.emptyMap();
Map cardinalsWorldSeries = Maps.newLinkedHashMap(m);
@@ -80,7 +80,7 @@ class Test {
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
-
+
class Test {
Map m = Collections.emptyMap();
Map cardinalsWorldSeries = new LinkedHashMap<>(m);
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewConcurrentHashSetTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewConcurrentHashSetTest.java
index f8584c99fb..b2202ddd31 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewConcurrentHashSetTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewConcurrentHashSetTest.java
@@ -40,9 +40,9 @@ void replaceWithNewConcurrentHashSet() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = Sets.newConcurrentHashSet();
}
@@ -51,7 +51,7 @@ class Test {
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-
+
class Test {
Set cardinalsWorldSeries = Collections.newSetFromMap(new ConcurrentHashMap<>());
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewHashSetTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewHashSetTest.java
index 4ae8102488..87ed0e8f60 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewHashSetTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewHashSetTest.java
@@ -40,9 +40,9 @@ void replaceWithNewHashSet() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = Sets.newHashSet();
}
@@ -50,7 +50,7 @@ class Test {
"""
import java.util.HashSet;
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = new HashSet<>();
}
@@ -66,11 +66,11 @@ void replaceWithNewHashSetCollection() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Collections;
import java.util.List;
import java.util.Set;
-
+
class Test {
List l = Collections.emptyList();
Set cardinalsWorldSeries = Sets.newHashSet(l);
@@ -81,7 +81,7 @@ class Test {
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
+
class Test {
List l = Collections.emptyList();
Set cardinalsWorldSeries = new HashSet<>(l);
@@ -98,9 +98,9 @@ void replaceWithNewHashSetVarargs() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = Sets.newHashSet(2006, 2011);
}
@@ -109,7 +109,7 @@ class Test {
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = new HashSet<>(Arrays.asList(2006, 2011));
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewLinkedHashSetTest.java b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewLinkedHashSetTest.java
index 58fefa0ec1..58406aa707 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewLinkedHashSetTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/NoGuavaSetsNewLinkedHashSetTest.java
@@ -40,9 +40,9 @@ void replaceWithNewLinkedHashSet() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = Sets.newLinkedHashSet();
}
@@ -50,7 +50,7 @@ class Test {
"""
import java.util.LinkedHashSet;
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = new LinkedHashSet<>();
}
@@ -66,10 +66,10 @@ void replaceWithNewLinkedHashSetCollection() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Collections;
import java.util.Set;
-
+
class Test {
Set l = Collections.emptySet();
Set cardinalsWorldSeries = Sets.newLinkedHashSet(l);
@@ -79,7 +79,7 @@ class Test {
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
-
+
class Test {
Set l = Collections.emptySet();
Set cardinalsWorldSeries = new LinkedHashSet<>(l);
@@ -96,9 +96,9 @@ void replaceWithNewLinkedHashSetWithCapacity() {
java(
"""
import com.google.common.collect.*;
-
+
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = Sets.newLinkedHashSetWithExpectedSize(2);
}
@@ -106,7 +106,7 @@ class Test {
"""
import java.util.LinkedHashSet;
import java.util.Set;
-
+
class Test {
Set cardinalsWorldSeries = new LinkedHashSet<>(2);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaStringJoinTest.java b/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaStringJoinTest.java
index d93729c768..3c6fe1dfd6 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaStringJoinTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaStringJoinTest.java
@@ -39,7 +39,7 @@ void joinStrings() {
java(
"""
import com.google.common.base.Joiner;
-
+
class Test {
String s = Joiner.on(", ").join("a", "b");
}
@@ -60,7 +60,7 @@ void joinStringArray() {
java(
"""
import com.google.common.base.Joiner;
-
+
class Test {
String s = Joiner.on(", ").join(new String[] {"a"});
}
@@ -82,7 +82,7 @@ void joinIterables() {
"""
import com.google.common.base.Joiner;
import java.util.Set;
-
+
class Test {
String s = Joiner.on(", ").join(Set.of("a"));
}
@@ -105,15 +105,15 @@ void joinMixedCharSequences() {
java(
"""
import com.google.common.base.Joiner;
-
+
class Test {
String s = Joiner.on(", ").join("a", new StringBuilder("b"));
}
""",
- """
- class Test {
- String s = String.join(", ", "a", new StringBuilder("b"));
- }
+ """
+ class Test {
+ String s = String.join(", ", "a", new StringBuilder("b"));
+ }
"""
)
);
@@ -127,7 +127,7 @@ void joinEmptyIterables() {
"""
import com.google.common.base.Joiner;
import java.util.HashSet;
-
+
class Test {
String s = Joiner.on(", ").join(new HashSet());
}
@@ -150,7 +150,7 @@ void joinMethodOnSeparateLine() {
java(
"""
import com.google.common.base.Joiner;
-
+
class Test {
String s = Joiner.on(", ")
.join("a", "b");
@@ -173,7 +173,7 @@ void dontEditJoinersNotSupportedByString() {
"""
import com.google.common.base.Joiner;
import java.util.Set;
-
+
class Test {
String s1 = Joiner.on(", ").join("a", 1);
String s2 = Joiner.on(", ").skipNulls().join("a", "b");
@@ -193,7 +193,7 @@ void dontEditJoinerInstanceCaller() {
java(
"""
import com.google.common.base.Joiner;
-
+
class Test {
Joiner j = Joiner.on(", ");
String s1 = j.join("a", "b");
diff --git a/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaUtilOptionalTest.java b/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaUtilOptionalTest.java
index bd45de16a9..5b89c22a71 100644
--- a/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaUtilOptionalTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/guava/PreferJavaUtilOptionalTest.java
@@ -46,23 +46,23 @@ public void defaults(RecipeSpec spec) {
void absentToEmpty() {
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Optional foo() {
- return Optional.absent();
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- Optional foo() {
- return Optional.empty();
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Optional foo() {
+ return Optional.absent();
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ Optional foo() {
+ return Optional.empty();
+ }
+ }
+ """));
}
@Test
@@ -70,69 +70,69 @@ void orNullToOrElseNull() {
// Comparison to java.util.Optional: this method is equivalent to Java 8's Optional.orElse(null).
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- String foo(Optional optional) {
- return optional.orNull();
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- String foo(Optional optional) {
- return optional.orElse(null);
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ String foo(Optional optional) {
+ return optional.orNull();
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ String foo(Optional optional) {
+ return optional.orElse(null);
+ }
+ }
+ """));
}
@Test
void orToOrElse() {
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Optional foo(Optional optional) {
- return optional.or("other");
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- Optional foo(Optional optional) {
- return optional.orElse("other");
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Optional foo(Optional optional) {
+ return optional.or("other");
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ Optional foo(Optional optional) {
+ return optional.orElse("other");
+ }
+ }
+ """));
}
@Test
void orSupplierToOrElseGetWithLambda() {
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Optional foo(Optional optional) {
- return optional.or(() -> "other");
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- Optional foo(Optional optional) {
- return optional.orElseGet(() -> "other");
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Optional foo(Optional optional) {
+ return optional.or(() -> "other");
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ Optional foo(Optional optional) {
+ return optional.orElseGet(() -> "other");
+ }
+ }
+ """));
}
@Test
@@ -140,7 +140,7 @@ void orSupplierToOrElseGetWithSupplierArgument() {
//language=java
rewriteRun(
java(
- """
+ """
import com.google.common.base.Optional;
import com.google.common.base.Supplier;
@@ -165,69 +165,69 @@ String foo(Optional optional, Supplier supplier) {
void transformToMap() {
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Optional foo(Optional optional) {
- return optional.transform(String::toUpperCase);
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- Optional foo(Optional optional) {
- return optional.map(String::toUpperCase);
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Optional foo(Optional optional) {
+ return optional.transform(String::toUpperCase);
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ Optional foo(Optional optional) {
+ return optional.map(String::toUpperCase);
+ }
+ }
+ """));
}
@Test
void removeFromJavaUtil() {
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Optional foo(java.util.Optional optional) {
- return Optional.fromJavaUtil(optional);
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- Optional foo(java.util.Optional optional) {
- return optional;
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Optional foo(java.util.Optional optional) {
+ return Optional.fromJavaUtil(optional);
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ Optional foo(java.util.Optional optional) {
+ return optional;
+ }
+ }
+ """));
}
@Test
void removeToJavaUtil() {
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- boolean foo() {
- return Optional.absent().toJavaUtil().isEmpty();
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- boolean foo() {
- return Optional.empty().isEmpty();
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ boolean foo() {
+ return Optional.absent().toJavaUtil().isEmpty();
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ boolean foo() {
+ return Optional.empty().isEmpty();
+ }
+ }
+ """));
}
@Test
@@ -237,7 +237,7 @@ void orOptionalToOrSupplier() {
rewriteRun(
spec -> spec.allSources(s -> s.markers(javaVersion(9))),
java(
- """
+ """
import com.google.common.base.Optional;
class A {
@@ -267,31 +267,31 @@ void getCatchIllegalStateExceptionToNoSuchElementException() {
// Sure hope no one actually does this, but you never know.
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- String foo(Optional optional) {
- try {
- return optional.get();
- } catch (IllegalStateException e) {
- return "";
- }
- }
- }
- """, """
- import java.util.Optional;
-
- class A {
- String foo(Optional optional) {
- try {
- return optional.get();
- } catch (NoSuchElementException e) {
- return "";
- }
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ String foo(Optional optional) {
+ try {
+ return optional.get();
+ } catch (IllegalStateException e) {
+ return "";
+ }
+ }
+ }
+ """, """
+ import java.util.Optional;
+
+ class A {
+ String foo(Optional optional) {
+ try {
+ return optional.get();
+ } catch (NoSuchElementException e) {
+ return "";
+ }
+ }
+ }
+ """));
}
@Test
@@ -300,25 +300,25 @@ void asSetToStreamCollectToSet() {
// Comparison to java.util.Optional: this method has no equivalent in Java 8's Optional class. However, some use cases can be written with calls to optional.stream().
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Set foo(Optional optional) {
- return optional.asSet();
- }
- }
- """, """
- import java.util.Optional;
- import java.util.Set;
- import java.util.stream.Collectors;
-
- class A {
- Set foo(Optional optional) {
- return optional.stream().collect(Collectors.toSet());
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Set foo(Optional optional) {
+ return optional.asSet();
+ }
+ }
+ """, """
+ import java.util.Optional;
+ import java.util.Set;
+ import java.util.stream.Collectors;
+
+ class A {
+ Set foo(Optional optional) {
+ return optional.stream().collect(Collectors.toSet());
+ }
+ }
+ """));
}
@Test
@@ -327,24 +327,24 @@ void presentInstances() {
// Comparison to java.util.Optional: this method has no equivalent in Java 8's Optional class; use optionals.stream().filter(Optional::isPresent).map(Optional::get) instead.
//language=java
rewriteRun(java(
- """
- import com.google.common.base.Optional;
-
- class A {
- Iterable foo(Iterable> optionals) {
- return Optional.presentInstances(optionals);
- }
- }
- """, """
- import java.util.Optional;
- import java.util.stream.Collectors;
-
- class A {
- Iterable foo(Iterable> optionals) {
- return optionals.stream().flatMap(Optional::stream).collect(Collectors.toList());
- }
- }
- """));
+ """
+ import com.google.common.base.Optional;
+
+ class A {
+ Iterable foo(Iterable> optionals) {
+ return Optional.presentInstances(optionals);
+ }
+ }
+ """, """
+ import java.util.Optional;
+ import java.util.stream.Collectors;
+
+ class A {
+ Iterable foo(Iterable> optionals) {
+ return optionals.stream().flatMap(Optional::stream).collect(Collectors.toList());
+ }
+ }
+ """));
}
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/io/ReplaceFileInOrOutputStreamFinalizeWithCloseTest.java b/src/test/java/org/openrewrite/java/migrate/io/ReplaceFileInOrOutputStreamFinalizeWithCloseTest.java
index 4f53a3c291..74e00aafbd 100644
--- a/src/test/java/org/openrewrite/java/migrate/io/ReplaceFileInOrOutputStreamFinalizeWithCloseTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/io/ReplaceFileInOrOutputStreamFinalizeWithCloseTest.java
@@ -207,7 +207,7 @@ class FooBar {
public void test() throws IOException {
FileOutputStream obj = new FileOutputStream("foo");
obj.finalize();
- }
+ }
}
""",
"""
diff --git a/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoTest.java b/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoTest.java
index 4a22697a2a..4a21220ab1 100644
--- a/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jacoco/UpgradeJaCoCoTest.java
@@ -90,7 +90,7 @@ void pluginAndDepWithProperty() {
0.8.1
-
+
com.mycompany.app
my-app
1
@@ -119,7 +119,7 @@ void pluginAndDepWithProperty() {
%s
-
+
com.mycompany.app
my-app
1
@@ -239,7 +239,7 @@ void pluginAndDepAndDepMgmtWithProperty() {
0.8.1
-
+
com.mycompany.app
my-app
1
@@ -278,7 +278,7 @@ void pluginAndDepAndDepMgmtWithProperty() {
%s
-
+
com.mycompany.app
my-app
1
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/BeanValidationMessagesTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/BeanValidationMessagesTest.java
index 88ad832627..e4cf58654f 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/BeanValidationMessagesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/BeanValidationMessagesTest.java
@@ -34,11 +34,11 @@ public void defaults(RecipeSpec spec) {
.dependsOn(
"""
package javax.validation.constraints;
-
+
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
+
@Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(value=RUNTIME)
public @interface NotNull {
@@ -47,11 +47,11 @@ public void defaults(RecipeSpec spec) {
""",
"""
package jakarta.validation.constraints;
-
+
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
+
@Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})
@Retention(value=RUNTIME)
public @interface NotNull {
@@ -71,7 +71,7 @@ void replaceMessage() {
java(
"""
import javax.validation.constraints.*;
-
+
class Test {
@NotNull(message = "Resource Code {javax.validation.constraints.NotNull.message}")
private String resourceCode;
@@ -79,7 +79,7 @@ class Test {
""",
"""
import javax.validation.constraints.*;
-
+
class Test {
@NotNull(message = "Resource Code {jakarta.validation.constraints.NotNull.message}")
private String resourceCode;
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/FacesManagedBeansRemovedTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/FacesManagedBeansRemovedTest.java
index 3ca5275621..ffed8c4ca7 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/FacesManagedBeansRemovedTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/FacesManagedBeansRemovedTest.java
@@ -20,7 +20,6 @@
import org.openrewrite.InMemoryExecutionContext;
import org.openrewrite.config.Environment;
import org.openrewrite.java.JavaParser;
-import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
import static org.openrewrite.java.Assertions.java;
@@ -36,43 +35,43 @@ void updateFacesManagedBeanFromEE8() {
.recipe(Environment.builder().scanRuntimeClasspath("org.openrewrite.java.migrate.jakarta")
.build()
.activateRecipes("org.openrewrite.java.migrate.jakarta.FacesManagedBeansRemoved"))
-,
- //language=java
+ ,
+ //language=java
java(
"""
- import javax.faces.bean.ApplicationScoped;
- import javax.faces.bean.RequestScoped;
- import javax.faces.bean.SessionScoped;
- import javax.faces.bean.ManagedProperty;
- import javax.faces.bean.NoneScoped;
- import javax.faces.bean.ViewScoped;
+ import javax.faces.bean.ApplicationScoped;
+ import javax.faces.bean.RequestScoped;
+ import javax.faces.bean.SessionScoped;
+ import javax.faces.bean.ManagedProperty;
+ import javax.faces.bean.NoneScoped;
+ import javax.faces.bean.ViewScoped;
- @ApplicationScoped
- @RequestScoped
- @SessionScoped
- @ManagedProperty
- @NoneScoped
- @ViewScoped
- public class ApplicationBean2 {
- }
- """,
+ @ApplicationScoped
+ @RequestScoped
+ @SessionScoped
+ @ManagedProperty
+ @NoneScoped
+ @ViewScoped
+ public class ApplicationBean2 {
+ }
+ """,
"""
- import jakarta.enterprise.context.ApplicationScoped;
- import jakarta.enterprise.context.Dependent;
- import jakarta.enterprise.context.RequestScoped;
- import jakarta.enterprise.context.SessionScoped;
- import jakarta.faces.annotation.ManagedProperty;
- import jakarta.faces.view.ViewScoped;
+ import jakarta.enterprise.context.ApplicationScoped;
+ import jakarta.enterprise.context.Dependent;
+ import jakarta.enterprise.context.RequestScoped;
+ import jakarta.enterprise.context.SessionScoped;
+ import jakarta.faces.annotation.ManagedProperty;
+ import jakarta.faces.view.ViewScoped;
- @ApplicationScoped
- @RequestScoped
- @SessionScoped
- @ManagedProperty
- @Dependent
- @ViewScoped
- public class ApplicationBean2 {
- }
- """
+ @ApplicationScoped
+ @RequestScoped
+ @SessionScoped
+ @ManagedProperty
+ @Dependent
+ @ViewScoped
+ public class ApplicationBean2 {
+ }
+ """
)
);
}
@@ -89,39 +88,39 @@ void updateFacesManagedBeanFromEE9() {
//language=java
java(
"""
- import jakarta.faces.bean.ApplicationScoped;
- import jakarta.faces.bean.RequestScoped;
- import jakarta.faces.bean.SessionScoped;
- import jakarta.faces.bean.ManagedProperty;
- import jakarta.faces.bean.NoneScoped;
- import jakarta.faces.bean.ViewScoped;
+ import jakarta.faces.bean.ApplicationScoped;
+ import jakarta.faces.bean.RequestScoped;
+ import jakarta.faces.bean.SessionScoped;
+ import jakarta.faces.bean.ManagedProperty;
+ import jakarta.faces.bean.NoneScoped;
+ import jakarta.faces.bean.ViewScoped;
- @ApplicationScoped
- @RequestScoped
- @SessionScoped
- @ManagedProperty
- @NoneScoped
- @ViewScoped
- public class ApplicationBean2 {
- }
- """,
+ @ApplicationScoped
+ @RequestScoped
+ @SessionScoped
+ @ManagedProperty
+ @NoneScoped
+ @ViewScoped
+ public class ApplicationBean2 {
+ }
+ """,
"""
- import jakarta.enterprise.context.ApplicationScoped;
- import jakarta.enterprise.context.Dependent;
- import jakarta.enterprise.context.RequestScoped;
- import jakarta.enterprise.context.SessionScoped;
- import jakarta.faces.annotation.ManagedProperty;
- import jakarta.faces.view.ViewScoped;
+ import jakarta.enterprise.context.ApplicationScoped;
+ import jakarta.enterprise.context.Dependent;
+ import jakarta.enterprise.context.RequestScoped;
+ import jakarta.enterprise.context.SessionScoped;
+ import jakarta.faces.annotation.ManagedProperty;
+ import jakarta.faces.view.ViewScoped;
- @ApplicationScoped
- @RequestScoped
- @SessionScoped
- @ManagedProperty
- @Dependent
- @ViewScoped
- public class ApplicationBean2 {
- }
- """
+ @ApplicationScoped
+ @RequestScoped
+ @SessionScoped
+ @ManagedProperty
+ @Dependent
+ @ViewScoped
+ public class ApplicationBean2 {
+ }
+ """
)
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java
index af6f5a32a1..868a9e0d8e 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JacksonJavaxtoJakartaTest.java
@@ -138,7 +138,7 @@ void migrateJacksonDependencies() {
- """
+ """
)
);
}
@@ -249,7 +249,7 @@ void migrateJacksonManagedDependencies() {
- """
+ """
)
);
}
@@ -267,11 +267,11 @@ void changeJsonpModuleType() {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jsr353.JSR353Module;
-
+
public class JacksonTest {
ObjectMapper mapper = JsonMapper.builder().addModule(new JSR353Module()).build();
ObjectMapper mapper2 = JsonMapper.builder().addModule(getModule()).build();
-
+
private JSR353Module getModule() {
return new JSR353Module();
}
@@ -281,11 +281,11 @@ private JSR353Module getModule() {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jsonp.JSONPModule;
-
+
public class JacksonTest {
ObjectMapper mapper = JsonMapper.builder().addModule(new JSONPModule()).build();
ObjectMapper mapper2 = JsonMapper.builder().addModule(getModule()).build();
-
+
private JSONPModule getModule() {
return new JSONPModule();
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeanValidationXmlToJakartaBeanValidationTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeanValidationXmlToJakartaBeanValidationTest.java
index c65c1bdd05..a7363cf819 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeanValidationXmlToJakartaBeanValidationTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeanValidationXmlToJakartaBeanValidationTest.java
@@ -45,16 +45,16 @@ void migrateJCP() {
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/validation/configuration
http://xmlns.jcp.org/xml/ns/validation/configuration/validation-configuration2.0.xsd"
version="2.0">
-
+
javax.acme.ValidationProvider
-
+
javax.acme.MessageInterpolator
javax.acme.TraversableResolver
javax.acme.ConstraintValidatorFactory
javax.acme.ParameterNameProvider
-
+
CONSTRUCTORS
@@ -62,12 +62,12 @@ void migrateJCP() {
GETTER_METHODS
-
+
META-INF/validation/constraints-car.xml
-
+
false
- """,
+ """,
"""
-
+
jakarta.acme.ValidationProvider
-
+
jakarta.acme.MessageInterpolator
jakarta.acme.TraversableResolver
jakarta.acme.ConstraintValidatorFactory
jakarta.acme.ParameterNameProvider
-
+
CONSTRUCTORS
@@ -92,12 +92,12 @@ void migrateJCP() {
GETTER_METHODS
-
+
META-INF/validation/constraints-car.xml
-
+
false
- """,
+ """,
sourceSpecs -> sourceSpecs.path("validation.xml")
)
);
@@ -111,10 +111,10 @@ void fileNotWebXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-validation.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeansXmlToJakartaBeansXmlTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeansXmlToJakartaBeansXmlTest.java
index 46d956bcc5..2a89eb1de4 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeansXmlToJakartaBeansXmlTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxBeansXmlToJakartaBeansXmlTest.java
@@ -69,17 +69,17 @@ void noSchemaCD12() {
xml(
"""
-
-
+
""",
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("beans.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxEjbJarXmlToJakartaEjbJarXmlTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxEjbJarXmlToJakartaEjbJarXmlTest.java
index 40e3353def..dea71c816b 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxEjbJarXmlToJakartaEjbJarXmlTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxEjbJarXmlToJakartaEjbJarXmlTest.java
@@ -81,7 +81,7 @@ void migrateJCP() {
- """,
+ """,
"""
- """,
+ """,
sourceSpecs -> sourceSpecs.path("ejb-jar.xml")
)
);
@@ -140,10 +140,10 @@ void fileNotWebXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-ejb-jar.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesConfigXmlToJakartaFacesConfigXmlTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesConfigXmlToJakartaFacesConfigXmlTest.java
index 04f18dc7da..e6082a47eb 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesConfigXmlToJakartaFacesConfigXmlTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesConfigXmlToJakartaFacesConfigXmlTest.java
@@ -120,10 +120,10 @@ void fileNotFacesConfigXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-faces-config.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesTagLibraryXmlToJakartaFacesTagLibraryXmlTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesTagLibraryXmlToJakartaFacesTagLibraryXmlTest.java
index 447775dc6a..bae412d982 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesTagLibraryXmlToJakartaFacesTagLibraryXmlTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxFacesTagLibraryXmlToJakartaFacesTagLibraryXmlTest.java
@@ -112,10 +112,10 @@ void fileNotTagLibraryXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-faces-taglib.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebFragmentXmlToJakartaWebFragmentXmlTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebFragmentXmlToJakartaWebFragmentXmlTest.java
index 2b0c02838e..2516d00d7b 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebFragmentXmlToJakartaWebFragmentXmlTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebFragmentXmlToJakartaWebFragmentXmlTest.java
@@ -46,7 +46,7 @@ void migrateSun() {
javax.faces.UploadedFileCleanerListener
-
+
""",
"""
@@ -57,7 +57,7 @@ void migrateSun() {
jakarta.faces.UploadedFileCleanerListener
-
+
""",
sourceSpecs -> sourceSpecs.path("web-fragment.xml")
)
@@ -78,7 +78,7 @@ void migrateJCP() {
javax.faces.UploadedFileCleanerListener
-
+
""",
"""
@@ -89,7 +89,7 @@ void migrateJCP() {
jakarta.faces.UploadedFileCleanerListener
-
+
""",
sourceSpecs -> sourceSpecs.path("web-fragment.xml")
)
@@ -112,7 +112,7 @@ void migrateWithDatasource() {
javax.sql.DataSource
CONTAINER
-
+
""",
"""
@@ -125,7 +125,7 @@ void migrateWithDatasource() {
javax.sql.DataSource
CONTAINER
-
+
""",
sourceSpecs -> sourceSpecs.path("web-fragment.xml")
)
@@ -140,10 +140,10 @@ void fileNotWebFragmentXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-web-fragment.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebXmlToJakartaWebXmlTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebXmlToJakartaWebXmlTest.java
index 92b4ab88c7..e17735dc0d 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebXmlToJakartaWebXmlTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JavaxWebXmlToJakartaWebXmlTest.java
@@ -47,8 +47,8 @@ void migrateSun() {
javax.faces.PROJECT_STAGE
Production
-
- """,
+
+ """,
"""
jakarta.faces.PROJECT_STAGE
Production
-
- """,
+
+ """,
sourceSpecs -> sourceSpecs.path("web.xml")
)
);
@@ -81,8 +81,8 @@ void migrateJCP() {
javax.faces.PROJECT_STAGE
Production
-
- """,
+
+ """,
"""
jakarta.faces.PROJECT_STAGE
Production
-
- """,
+
+ """,
sourceSpecs -> sourceSpecs.path("web.xml")
)
);
@@ -121,8 +121,8 @@ void migrateWithSQLDataSource() {
javax.sql.DataSource
CONTAINER
-
- """,
+
+ """,
"""
javax.sql.DataSource
CONTAINER
-
- """,
+
+ """,
sourceSpecs -> sourceSpecs.path("web.xml")
)
);
}
+
@Nested
class NoChanges {
@Test
@@ -152,10 +153,10 @@ void fileNotWebXml() {
//language=xml
xml(
"""
-
-
+
""",
sourceSpecs -> sourceSpecs.path("not-web.xml")
)
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/JohnzonJavaxtoJakartaTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/JohnzonJavaxtoJakartaTest.java
index 296477a504..20240531c6 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/JohnzonJavaxtoJakartaTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/JohnzonJavaxtoJakartaTest.java
@@ -65,23 +65,23 @@ void migrateJohnzonDependencies() {
.matcher(actual);
assertThat(version.find()).isTrue();
return """
-
- com.example.ehcache
- johnzon-legacy
- 1.0.0
-
- %s
-
-
-
- org.apache.johnzon
- johnzon-core
- ${johnzon.version}
- jakarta
-
-
-
- """.formatted(version.group(1));
+
+ com.example.ehcache
+ johnzon-legacy
+ 1.0.0
+
+ %s
+
+
+
+ org.apache.johnzon
+ johnzon-core
+ ${johnzon.version}
+ jakarta
+
+
+
+ """.formatted(version.group(1));
})
)
);
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovalsServletJakarta10Test.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovalsServletJakarta10Test.java
index 2067641519..275c666121 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovalsServletJakarta10Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovalsServletJakarta10Test.java
@@ -56,41 +56,41 @@ void servletReplacements() {
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionContext;
import jakarta.servlet.http.HttpUtils;
-
+
class TestJakarta extends HttpServlet implements SingleThreadModel {
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
req.isRequestedSessionIdFromUrl();
-
+
res.encodeUrl("");
res.encodeRedirectUrl("");
-
+
res.setStatus(0, "");
-
+
res.setStatus(0);
-
+
HttpServletRequestWrapper reqWrapper = new HttpServletRequestWrapper(req);
reqWrapper.isRequestedSessionIdFromUrl();
-
+
HttpServletResponseWrapper resWrapper = new HttpServletResponseWrapper(res);
-
+
resWrapper.encodeUrl("");
resWrapper.encodeRedirectUrl("");
-
+
resWrapper.setStatus(0, "");
-
+
HttpSession httpSession = req.getSession();
httpSession.getSessionContext();
httpSession.getValue("");
httpSession.getValueNames();
httpSession.putValue("", null);
httpSession.removeValue("");
-
+
ServletContext servletContext = getServletContext();
-
+
servletContext.getServlet("");
servletContext.getServlets();
servletContext.getServletNames();
-
+
servletContext.log(null, "");
}
}
@@ -110,41 +110,41 @@ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws Ser
import jakarta.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSessionContext;
import jakarta.servlet.http.HttpUtils;
-
+
class TestJakarta extends HttpServlet implements SingleThreadModel {
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
req.isRequestedSessionIdFromURL();
-
+
res.encodeURL("");
res.encodeRedirectURL("");
-
+
res.setStatus(0);
-
+
res.setStatus(0);
-
+
HttpServletRequestWrapper reqWrapper = new HttpServletRequestWrapper(req);
reqWrapper.isRequestedSessionIdFromURL();
-
+
HttpServletResponseWrapper resWrapper = new HttpServletResponseWrapper(res);
-
+
resWrapper.encodeURL("");
resWrapper.encodeRedirectURL("");
-
+
resWrapper.setStatus(0);
-
+
HttpSession httpSession = req.getSession();
httpSession.getSessionContext();
httpSession.getAttribute("");
httpSession.getAttributeNames();
httpSession.setAttribute("", null);
httpSession.removeAttribute("");
-
+
ServletContext servletContext = getServletContext();
-
+
servletContext.getServlet("");
servletContext.getServlets();
servletContext.getServletNames();
-
+
servletContext.log("", null);
}
}
@@ -162,7 +162,7 @@ void unavailableException() {
import jakarta.servlet.UnavailableException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
-
+
class Test {
void doGet(HttpServletRequest req, HttpServletResponse res) throws Exception {
jakarta.servlet.Servlet servlet ;
@@ -176,7 +176,7 @@ void doGet(HttpServletRequest req, HttpServletResponse res) throws Exception {
import jakarta.servlet.UnavailableException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
-
+
class Test {
void doGet(HttpServletRequest req, HttpServletResponse res) throws Exception {
jakarta.servlet.Servlet servlet ;
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemoveBeanIsNullableTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemoveBeanIsNullableTest.java
index e8781077c5..ed7b15d88d 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemoveBeanIsNullableTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemoveBeanIsNullableTest.java
@@ -40,7 +40,7 @@ void removeBeanIsNullable() {
java(
"""
import jakarta.enterprise.inject.spi.Bean;
-
+
class Test {
void test(Bean> bean) {
if (bean.isNullable()) {
@@ -53,7 +53,7 @@ void test(Bean> bean) {
""",
"""
import jakarta.enterprise.inject.spi.Bean;
-
+
class Test {
void test(Bean> bean) {
System.out.println("not null");
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedIsParmetersProvidedMethodTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedIsParmetersProvidedMethodTest.java
index 96b46ecacb..0572a28d7a 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedIsParmetersProvidedMethodTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedIsParmetersProvidedMethodTest.java
@@ -43,30 +43,30 @@ void removedIsParametersProvidedMethod() {
rewriteRun(
//language=java
java(
- """
- package com.test;
-
- import jakarta.el.MethodExpression;
-
- public class Test {
- void test(MethodExpression methodExpression){
- if(methodExpression.isParmetersProvided()){
- System.out.println("test");
- }
- }
- }
- """, """
- package com.test;
-
- import jakarta.el.MethodExpression;
-
- public class Test {
- void test(MethodExpression methodExpression){
- if(methodExpression.isParametersProvided()){
- System.out.println("test");
- }
- }
- }
- """));
+ """
+ package com.test;
+
+ import jakarta.el.MethodExpression;
+
+ public class Test {
+ void test(MethodExpression methodExpression){
+ if(methodExpression.isParmetersProvided()){
+ System.out.println("test");
+ }
+ }
+ }
+ """, """
+ package com.test;
+
+ import jakarta.el.MethodExpression;
+
+ public class Test {
+ void test(MethodExpression methodExpression){
+ if(methodExpression.isParametersProvided()){
+ System.out.println("test");
+ }
+ }
+ }
+ """));
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesExpressionLanguageClassesTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesExpressionLanguageClassesTest.java
index 5e08fa0344..49de1f0d32 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesExpressionLanguageClassesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesExpressionLanguageClassesTest.java
@@ -30,7 +30,7 @@ class RemovedJakartaFacesExpressionLanguageClassesTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion()
- .classpathFromResources(new InMemoryExecutionContext(), "jakarta.el-api-4.0.0","jakarta.faces-2.3.19", "jakarta.faces-3.0.3"))
+ .classpathFromResources(new InMemoryExecutionContext(), "jakarta.el-api-4.0.0", "jakarta.faces-2.3.19", "jakarta.faces-3.0.3"))
.recipe(Environment.builder()
.scanRuntimeClasspath("org.openrewrite.java.migrate.jakarta").build().activateRecipes("org.openrewrite.java.migrate.jakarta.RemovedJakartaFacesExpressionLanguageClasses"));
}
@@ -41,37 +41,37 @@ void removedExpressionLanguageTestJakarta_1() {
rewriteRun(
//language=java
java(
- """
- package com.test;
-
- import jakarta.faces.el.MethodBinding;
- import jakarta.faces.el.PropertyResolver;
- import jakarta.faces.el.ValueBinding;
-
- public class Test {
-
- public void testJakarta() {
- MethodBinding methodBinding = null;
- PropertyResolver propertyResolver = null;
- ValueBinding valueBinding = null;
- }
- }
- """, """
- package com.test;
-
- import jakarta.el.ELResolver;
- import jakarta.el.MethodExpression;
- import jakarta.el.ValueExpression;
-
- public class Test {
-
- public void testJakarta() {
- MethodExpression methodBinding = null;
- ELResolver propertyResolver = null;
- ValueExpression valueBinding = null;
- }
- }
- """));
+ """
+ package com.test;
+
+ import jakarta.faces.el.MethodBinding;
+ import jakarta.faces.el.PropertyResolver;
+ import jakarta.faces.el.ValueBinding;
+
+ public class Test {
+
+ public void testJakarta() {
+ MethodBinding methodBinding = null;
+ PropertyResolver propertyResolver = null;
+ ValueBinding valueBinding = null;
+ }
+ }
+ """, """
+ package com.test;
+
+ import jakarta.el.ELResolver;
+ import jakarta.el.MethodExpression;
+ import jakarta.el.ValueExpression;
+
+ public class Test {
+
+ public void testJakarta() {
+ MethodExpression methodBinding = null;
+ ELResolver propertyResolver = null;
+ ValueExpression valueBinding = null;
+ }
+ }
+ """));
}
@Test
@@ -80,33 +80,33 @@ void removedExpressionLanguageTestJakarta_2() {
//language=java
java("""
package com.test;
-
+
import jakarta.faces.el.VariableResolver;
import jakarta.faces.el.EvaluationException;
import jakarta.faces.el.MethodNotFoundException;
import jakarta.faces.el.PropertyNotFoundException;
import jakarta.faces.el.ReferenceSyntaxException;
-
+
public class Test {
-
- public void testJakarta_1() {
+
+ public void testJakarta_1() {
VariableResolver variableResolver = null;
EvaluationException evaluationException = null;
MethodNotFoundException methodNotFoundException = null;
PropertyNotFoundException propertyNotFoundException = null;
- ReferenceSyntaxException referenceSyntaxException = null;
+ ReferenceSyntaxException referenceSyntaxException = null;
}
- }
- """, """
+ }
+ """, """
package com.test;
-
+
import jakarta.el.ELException;
import jakarta.el.ELResolver;
import jakarta.el.MethodNotFoundException;
import jakarta.el.PropertyNotFoundException;
-
+
public class Test {
-
+
public void testJakarta_1() {
ELResolver variableResolver = null;
ELException evaluationException = null;
@@ -117,42 +117,43 @@ public void testJakarta_1() {
}
"""));
}
+
@Test
void removedExpressionLanguageTestJavax_1() {
rewriteRun(
//language=java
java(
- """
- package com.test;
-
- import javax.faces.el.MethodBinding;
- import javax.faces.el.PropertyResolver;
- import javax.faces.el.ValueBinding;
-
- public class Test {
-
- public void testJavax() {
- MethodBinding methodBinding = null;
- PropertyResolver propertyResolver = null;
- ValueBinding valueBinding = null;
- }
- }
- """, """
- package com.test;
-
- import jakarta.el.ELResolver;
- import jakarta.el.MethodExpression;
- import jakarta.el.ValueExpression;
-
- public class Test {
-
- public void testJavax() {
- MethodExpression methodBinding = null;
- ELResolver propertyResolver = null;
- ValueExpression valueBinding = null;
- }
- }
- """));
+ """
+ package com.test;
+
+ import javax.faces.el.MethodBinding;
+ import javax.faces.el.PropertyResolver;
+ import javax.faces.el.ValueBinding;
+
+ public class Test {
+
+ public void testJavax() {
+ MethodBinding methodBinding = null;
+ PropertyResolver propertyResolver = null;
+ ValueBinding valueBinding = null;
+ }
+ }
+ """, """
+ package com.test;
+
+ import jakarta.el.ELResolver;
+ import jakarta.el.MethodExpression;
+ import jakarta.el.ValueExpression;
+
+ public class Test {
+
+ public void testJavax() {
+ MethodExpression methodBinding = null;
+ ELResolver propertyResolver = null;
+ ValueExpression valueBinding = null;
+ }
+ }
+ """));
}
@Test
@@ -161,33 +162,33 @@ void removedExpressionLanguageTestJavax_2() {
//language=java
java("""
package com.test;
-
+
import javax.faces.el.VariableResolver;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodNotFoundException;
import javax.faces.el.PropertyNotFoundException;
import javax.faces.el.ReferenceSyntaxException;
-
+
public class Test {
-
- public void testJavax_1() {
+
+ public void testJavax_1() {
VariableResolver variableResolver = null;
EvaluationException evaluationException = null;
MethodNotFoundException methodNotFoundException = null;
PropertyNotFoundException propertyNotFoundException = null;
- ReferenceSyntaxException referenceSyntaxException = null;
+ ReferenceSyntaxException referenceSyntaxException = null;
}
- }
- """, """
+ }
+ """, """
package com.test;
-
+
import jakarta.el.ELException;
import jakarta.el.ELResolver;
import jakarta.el.MethodNotFoundException;
import jakarta.el.PropertyNotFoundException;
-
+
public class Test {
-
+
public void testJavax_1() {
ELResolver variableResolver = null;
ELException evaluationException = null;
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesResourceResolverTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesResourceResolverTest.java
index 0b59754951..417a8fceab 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesResourceResolverTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedJakartaFacesResourceResolverTest.java
@@ -29,7 +29,7 @@ class RemovedJakartaFacesResourceResolverTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.parser(JavaParser.fromJavaVersion().
- classpathFromResources(new InMemoryExecutionContext(), "jakarta.faces-api-4.0.0-M6", "jakarta.faces-2.3.19", "jakarta.faces-3.0.3")).
+ classpathFromResources(new InMemoryExecutionContext(), "jakarta.faces-api-4.0.0-M6", "jakarta.faces-2.3.19", "jakarta.faces-3.0.3")).
recipe(Environment.builder().scanRuntimeClasspath("org.openrewrite.java.migrate.jakarta")
.build()
.activateRecipes("org.openrewrite.java.migrate.jakarta.RemovedJakartaFacesResourceResolver"));
@@ -41,82 +41,82 @@ void removedJakartaFacesResourceResolver_1() {
rewriteRun(
//language=java
java(
- """
- package com.test;
- import java.net.URL;
-
- import jakarta.faces.application.StateManager;
- import jakarta.faces.component.UIViewRoot;
- import jakarta.faces.context.FacesContext;
- import jakarta.faces.view.facelets.ResourceResolver;
-
- public class ResourceResolverParent extends ResourceResolver {
-
- @Override
- public URL resolveUrl(String arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- }
- """, """
- package com.test;
- import java.net.URL;
-
- import jakarta.faces.application.ResourceHandler;
- import jakarta.faces.application.StateManager;
- import jakarta.faces.component.UIViewRoot;
- import jakarta.faces.context.FacesContext;
-
- public class ResourceResolverParent extends ResourceHandler {
-
- @Override
- public URL resolveUrl(String arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- }
- """));
+ """
+ package com.test;
+ import java.net.URL;
+
+ import jakarta.faces.application.StateManager;
+ import jakarta.faces.component.UIViewRoot;
+ import jakarta.faces.context.FacesContext;
+ import jakarta.faces.view.facelets.ResourceResolver;
+
+ public class ResourceResolverParent extends ResourceResolver {
+
+ @Override
+ public URL resolveUrl(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+ """, """
+ package com.test;
+ import java.net.URL;
+
+ import jakarta.faces.application.ResourceHandler;
+ import jakarta.faces.application.StateManager;
+ import jakarta.faces.component.UIViewRoot;
+ import jakarta.faces.context.FacesContext;
+
+ public class ResourceResolverParent extends ResourceHandler {
+
+ @Override
+ public URL resolveUrl(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+ """));
}
void removedJavaxFacesResourceResolver_1() {
rewriteRun(
//language=java
java(
- """
- package com.test;
- import java.net.URL;
-
- import javax.faces.application.StateManager;
- import javax.faces.component.UIViewRoot;
- import javax.faces.context.FacesContext;
- import javax.faces.view.facelets.ResourceResolver;
-
- public class ResourceResolverParent extends ResourceResolver {
-
- @Override
- public URL resolveUrl(String arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- }
- """, """
- package com.test;
- import java.net.URL;
-
- import jakarta.faces.application.ResourceHandler;
- import jakarta.faces.application.StateManager;
- import jakarta.faces.component.UIViewRoot;
- import jakarta.faces.context.FacesContext;
-
- public class ResourceResolverParent extends ResourceHandler {
-
- @Override
- public URL resolveUrl(String arg0) {
- // TODO Auto-generated method stub
- return null;
- }
- }
- """));
+ """
+ package com.test;
+ import java.net.URL;
+
+ import javax.faces.application.StateManager;
+ import javax.faces.component.UIViewRoot;
+ import javax.faces.context.FacesContext;
+ import javax.faces.view.facelets.ResourceResolver;
+
+ public class ResourceResolverParent extends ResourceResolver {
+
+ @Override
+ public URL resolveUrl(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+ """, """
+ package com.test;
+ import java.net.URL;
+
+ import jakarta.faces.application.ResourceHandler;
+ import jakarta.faces.application.StateManager;
+ import jakarta.faces.component.UIViewRoot;
+ import jakarta.faces.context.FacesContext;
+
+ public class ResourceResolverParent extends ResourceHandler {
+
+ @Override
+ public URL resolveUrl(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+ """));
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedSOAPElementFactoryTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedSOAPElementFactoryTest.java
index 33e0d69a31..6f7d503888 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedSOAPElementFactoryTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedSOAPElementFactoryTest.java
@@ -43,45 +43,45 @@ void removeSOAPElementFactory() {
rewriteRun(
//language=java
java(
- """
- package com.test;
-
- import jakarta.xml.soap.Name;
- import jakarta.xml.soap.SOAPElementFactory;
- import jakarta.xml.soap.SOAPEnvelope;
-
- public class Test {
- void test(SOAPEnvelope envelope) {
- String str1 = "test";
- String str2 = "t2";
- String str3 = "t3";
- Name n = envelope.createName("GetLastTradePrice", "WOMBAT", "http://www.abc.org/trader");
- SOAPElementFactory sfe = SOAPElementFactory.newInstance();
- sfe.create(str1);
- sfe.create(str1, str2, str3);
- sfe.create(n);
- }
- }
- """, """
- package com.test;
-
- import jakarta.xml.soap.Name;
- import jakarta.xml.soap.SOAPEnvelope;
- import jakarta.xml.soap.SOAPFactory;
+ """
+ package com.test;
- public class Test {
- void test(SOAPEnvelope envelope) {
- String str1 = "test";
- String str2 = "t2";
- String str3 = "t3";
- Name n = envelope.createName("GetLastTradePrice", "WOMBAT", "http://www.abc.org/trader");
- SOAPFactory sfe = SOAPFactory.newInstance();
- sfe.createElement(str1);
- sfe.createElement(str1, str2, str3);
- sfe.createElement(n);
- }
- }
- """));
+ import jakarta.xml.soap.Name;
+ import jakarta.xml.soap.SOAPElementFactory;
+ import jakarta.xml.soap.SOAPEnvelope;
+
+ public class Test {
+ void test(SOAPEnvelope envelope) {
+ String str1 = "test";
+ String str2 = "t2";
+ String str3 = "t3";
+ Name n = envelope.createName("GetLastTradePrice", "WOMBAT", "http://www.abc.org/trader");
+ SOAPElementFactory sfe = SOAPElementFactory.newInstance();
+ sfe.create(str1);
+ sfe.create(str1, str2, str3);
+ sfe.create(n);
+ }
+ }
+ """, """
+ package com.test;
+
+ import jakarta.xml.soap.Name;
+ import jakarta.xml.soap.SOAPEnvelope;
+ import jakarta.xml.soap.SOAPFactory;
+
+ public class Test {
+ void test(SOAPEnvelope envelope) {
+ String str1 = "test";
+ String str2 = "t2";
+ String str3 = "t3";
+ Name n = envelope.createName("GetLastTradePrice", "WOMBAT", "http://www.abc.org/trader");
+ SOAPFactory sfe = SOAPFactory.newInstance();
+ sfe.createElement(str1);
+ sfe.createElement(str1, str2, str3);
+ sfe.createElement(n);
+ }
+ }
+ """));
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedStateManagerMethodsTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedStateManagerMethodsTest.java
index 89394c5b12..fd13bbdb14 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedStateManagerMethodsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedStateManagerMethodsTest.java
@@ -42,13 +42,13 @@ void stateManagerReplacement() {
rewriteRun(
//language=java
java(
- """
+ """
import jakarta.faces.application.StateManager;
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.FacesContext;
-
+
class StateManagerParent extends StateManager {
-
+
@Override
public UIViewRoot restoreView(FacesContext arg0, String arg1, String arg2) {
UIViewRoot uv = null;
@@ -57,16 +57,16 @@ public UIViewRoot restoreView(FacesContext arg0, String arg1, String arg2) {
super.restoreComponentState(arg0, uv, arg2);
super.restoreTreeStructure(arg0, arg1, arg2);
return null;
- }
+ }
}
""",
"""
import jakarta.faces.component.UIViewRoot;
import jakarta.faces.context.FacesContext;
import jakarta.faces.view.StateManagementStrategy;
-
+
class StateManagerParent extends StateManagementStrategy {
-
+
@Override
public UIViewRoot restoreView(FacesContext arg0, String arg1, String arg2) {
UIViewRoot uv = null;
@@ -75,7 +75,7 @@ public UIViewRoot restoreView(FacesContext arg0, String arg1, String arg2) {
super.restoreView(arg0, uv, arg2);
super.restoreView(arg0, arg1, arg2);
return null;
- }
+ }
}
"""
)
@@ -87,15 +87,15 @@ void stateManagerRemove() {
rewriteRun(
//language=java
java(
- """
- import jakarta.faces.application.StateManager;
+ """
+ import jakarta.faces.application.StateManager;
import jakarta.faces.context.FacesContext;
import java.io.IOException;
-
+
class StateMgrTest {
-
+
public void test() throws IOException {
-
+
StateManager st = null;
FacesContext fc = null;
String var1 = null;
@@ -109,15 +109,15 @@ public void test() throws IOException {
}
""",
"""
- import jakarta.faces.context.FacesContext;
+ import jakarta.faces.context.FacesContext;
import jakarta.faces.view.StateManagementStrategy;
-
+
import java.io.IOException;
-
+
class StateMgrTest {
-
+
public void test() throws IOException {
-
+
StateManagementStrategy st = null;
FacesContext fc = null;
String var1 = null;
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedUIComponentConstantTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedUIComponentConstantTest.java
index 415de5b5e5..d3d776fe36 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedUIComponentConstantTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/RemovedUIComponentConstantTest.java
@@ -43,29 +43,29 @@ void removedUIComponentConstant_1() {
//language=java
java(
"""
- import jakarta.faces.component.UIComponent;
-
- class Bar {
- void foo() {
- String str = UIComponent.CURRENT_COMPONENT;
- String str2 = UIComponent.CURRENT_COMPOSITE_COMPONENT;
- System.out.println(str);
- System.out.println(str2);
- }
- }
- """,
- """
- import jakarta.faces.component.UIComponent;
-
- class Bar {
- void foo() {
- String str = UIComponent.getCurrentComponent();
- String str2 = UIComponent.getCurrentCompositeComponent();
- System.out.println(str);
- System.out.println(str2);
- }
- }
+ import jakarta.faces.component.UIComponent;
+
+ class Bar {
+ void foo() {
+ String str = UIComponent.CURRENT_COMPONENT;
+ String str2 = UIComponent.CURRENT_COMPOSITE_COMPONENT;
+ System.out.println(str);
+ System.out.println(str2);
+ }
+ }
+ """,
"""
+ import jakarta.faces.component.UIComponent;
+
+ class Bar {
+ void foo() {
+ String str = UIComponent.getCurrentComponent();
+ String str2 = UIComponent.getCurrentCompositeComponent();
+ System.out.println(str);
+ System.out.println(str2);
+ }
+ }
+ """
)
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/ServletCookieBehaviorChangeRFC6265Test.java b/src/test/java/org/openrewrite/java/migrate/jakarta/ServletCookieBehaviorChangeRFC6265Test.java
index c7dff30cf1..ca7759b79b 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/ServletCookieBehaviorChangeRFC6265Test.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/ServletCookieBehaviorChangeRFC6265Test.java
@@ -41,47 +41,47 @@ void removeMethodsJakarta() {
rewriteRun(
//language=java
java(
- """
- package com.test;
- import jakarta.servlet.ServletContext;
- import jakarta.servlet.SessionCookieConfig;
- import jakarta.servlet.http.HttpServlet;
-
- import jakarta.servlet.http.Cookie;
-
- public class TestJakarta extends HttpServlet {
-
- public void test() {
- Cookie cookie = new Cookie("test", "cookie");
- cookie.setComment("comment");
- cookie.getComment();
- cookie.setVersion(1);
- cookie.getVersion();
-
- ServletContext servletContext = getServletContext();
- SessionCookieConfig config = servletContext.getSessionCookieConfig();
- config.getComment();
- config.setComment("comment");
- }
- }
- """, """
- package com.test;
- import jakarta.servlet.ServletContext;
- import jakarta.servlet.SessionCookieConfig;
- import jakarta.servlet.http.HttpServlet;
-
- import jakarta.servlet.http.Cookie;
-
- public class TestJakarta extends HttpServlet {
-
- public void test() {
- Cookie cookie = new Cookie("test", "cookie");
-
- ServletContext servletContext = getServletContext();
- SessionCookieConfig config = servletContext.getSessionCookieConfig();
- }
- }
- """));
+ """
+ package com.test;
+ import jakarta.servlet.ServletContext;
+ import jakarta.servlet.SessionCookieConfig;
+ import jakarta.servlet.http.HttpServlet;
+
+ import jakarta.servlet.http.Cookie;
+
+ public class TestJakarta extends HttpServlet {
+
+ public void test() {
+ Cookie cookie = new Cookie("test", "cookie");
+ cookie.setComment("comment");
+ cookie.getComment();
+ cookie.setVersion(1);
+ cookie.getVersion();
+
+ ServletContext servletContext = getServletContext();
+ SessionCookieConfig config = servletContext.getSessionCookieConfig();
+ config.getComment();
+ config.setComment("comment");
+ }
+ }
+ """, """
+ package com.test;
+ import jakarta.servlet.ServletContext;
+ import jakarta.servlet.SessionCookieConfig;
+ import jakarta.servlet.http.HttpServlet;
+
+ import jakarta.servlet.http.Cookie;
+
+ public class TestJakarta extends HttpServlet {
+
+ public void test() {
+ Cookie cookie = new Cookie("test", "cookie");
+
+ ServletContext servletContext = getServletContext();
+ SessionCookieConfig config = servletContext.getSessionCookieConfig();
+ }
+ }
+ """));
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateAddAnnotatedTypesTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateAddAnnotatedTypesTest.java
index 25323adec9..63445450df 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateAddAnnotatedTypesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateAddAnnotatedTypesTest.java
@@ -43,7 +43,7 @@ void addAnnotatedType() {
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
-
+
class Foo {
void bar(BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
AnnotatedType producerType = beanManager.createAnnotatedType(String.class);
@@ -57,7 +57,7 @@ void bar(BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
-
+
class Foo {
void bar(BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
AnnotatedType producerType = beanManager.createAnnotatedType(String.class);
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateBeanManagerMethodsTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateBeanManagerMethodsTest.java
index 2613bb7081..6a88944aca 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateBeanManagerMethodsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/UpdateBeanManagerMethodsTest.java
@@ -45,7 +45,7 @@ void fireEvent() {
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
import java.util.Set;
-
+
class Foo {
void bar(BeanManager beanManager, BeforeBeanDiscovery beforeBeanDiscovery) {
beanManager.fireEvent(beforeBeanDiscovery);
@@ -56,7 +56,7 @@ void bar(BeanManager beanManager, BeforeBeanDiscovery beforeBeanDiscovery) {
import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
import java.util.Set;
-
+
class Foo {
void bar(BeanManager beanManager, BeforeBeanDiscovery beforeBeanDiscovery) {
beanManager.getEvent().fire(beforeBeanDiscovery);
@@ -75,7 +75,7 @@ void createInjectionTarget() {
"""
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.BeanManager;
-
+
class Foo {
void bar(BeanManager beanManager) {
AnnotatedType producerType = beanManager.createAnnotatedType(String.class);
@@ -86,7 +86,7 @@ void bar(BeanManager beanManager) {
"""
import jakarta.enterprise.inject.spi.AnnotatedType;
import jakarta.enterprise.inject.spi.BeanManager;
-
+
class Foo {
void bar(BeanManager beanManager) {
AnnotatedType producerType = beanManager.createAnnotatedType(String.class);
diff --git a/src/test/java/org/openrewrite/java/migrate/jakarta/WsWsocServerContainerDeprecationTest.java b/src/test/java/org/openrewrite/java/migrate/jakarta/WsWsocServerContainerDeprecationTest.java
index f6e566628c..f0336a71f6 100644
--- a/src/test/java/org/openrewrite/java/migrate/jakarta/WsWsocServerContainerDeprecationTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/jakarta/WsWsocServerContainerDeprecationTest.java
@@ -46,10 +46,10 @@ void deprecateWsWsocServerContainer() {
"""
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+
import com.ibm.websphere.wsoc.ServerEndpointConfig;
import com.ibm.websphere.wsoc.WsWsocServerContainer;
-
+
class Test {
void doX(HttpServletRequest req, HttpServletResponse res, ServerEndpointConfig sConfig, java.util.Map map){
WsWsocServerContainer.doUpgrade(req, res, sConfig, map);
@@ -59,10 +59,10 @@ void doX(HttpServletRequest req, HttpServletResponse res, ServerEndpointConfig s
"""
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+
import com.ibm.websphere.wsoc.ServerEndpointConfig;
import jakarta.websocket.server.ServerContainer;
-
+
class Test {
void doX(HttpServletRequest req, HttpServletResponse res, ServerEndpointConfig sConfig, java.util.Map map){
ServerContainer.upgradeHttpToWebSocket(req, res, sConfig, map);
diff --git a/src/test/java/org/openrewrite/java/migrate/javaee/AddTableGeneratorTest.java b/src/test/java/org/openrewrite/java/migrate/javaee/AddTableGeneratorTest.java
index 0a8bab3a8e..0be48c4cb6 100644
--- a/src/test/java/org/openrewrite/java/migrate/javaee/AddTableGeneratorTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javaee/AddTableGeneratorTest.java
@@ -45,18 +45,18 @@ void generatedValueExample() {
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;
-
+
@Entity
public class GeneratedValueExample {
// flag it
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
-
+
// flag it. Does not require @Id
@GeneratedValue
private int id2;
-
+
// flag it even though it has a TableGenerator since GeneratedValue is default
// A second TableGenerator will be created.
@TableGenerator(name = "SOME_TABLE", table = "SOME_TABLE", pkColumnName = "ID", valueColumnName = "SEQUENCE_VALUE", pkColumnValue = "0")
@@ -69,7 +69,7 @@ public class GeneratedValueExample {
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;
-
+
@Entity
public class GeneratedValueExample {
// flag it
@@ -77,12 +77,12 @@ public class GeneratedValueExample {
@javax.persistence.TableGenerator(name = "OPENJPA_SEQUENCE_TABLE", table = "OPENJPA_SEQUENCE_TABLE", pkColumnName = "ID", valueColumnName = "SEQUENCE_VALUE", pkColumnValue = "0")
@GeneratedValue(strategy = javax.persistence.GenerationType.TABLE, generator = "OPENJPA_SEQUENCE_TABLE")
private int id;
-
+
// flag it. Does not require @Id
@GeneratedValue(strategy = javax.persistence.GenerationType.TABLE, generator = "OPENJPA_SEQUENCE_TABLE")
@javax.persistence.TableGenerator(name = "OPENJPA_SEQUENCE_TABLE", table = "OPENJPA_SEQUENCE_TABLE", pkColumnName = "ID", valueColumnName = "SEQUENCE_VALUE", pkColumnValue = "0")
private int id2;
-
+
// flag it even though it has a TableGenerator since GeneratedValue is default
// A second TableGenerator will be created.
@TableGenerator(name = "SOME_TABLE", table = "SOME_TABLE", pkColumnName = "ID", valueColumnName = "SEQUENCE_VALUE", pkColumnValue = "0")
@@ -104,7 +104,7 @@ void generatedValueName() {
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-
+
@Entity
class GeneratedValueName {
@Id
@@ -116,7 +116,7 @@ class GeneratedValueName {
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-
+
@Entity
class GeneratedValueName {
@Id
@@ -140,7 +140,7 @@ void generatedValueQuickFixApplied() {
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.TableGenerator;
-
+
@Entity
class GeneratedValueQuickFixApplied {
// not flagged since GeneratedValue is not default or AUTO
@@ -164,7 +164,7 @@ void generatedValueStrategySpaces() {
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-
+
@Entity
class GeneratedValueStrategySpaces {
@Id
@@ -177,7 +177,7 @@ class GeneratedValueStrategySpaces {
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
-
+
@Entity
class GeneratedValueStrategySpaces {
@Id
diff --git a/src/test/java/org/openrewrite/java/migrate/javaee/ApacheDefaultProviderTest.java b/src/test/java/org/openrewrite/java/migrate/javaee/ApacheDefaultProviderTest.java
index 0626a00646..59597c12d9 100644
--- a/src/test/java/org/openrewrite/java/migrate/javaee/ApacheDefaultProviderTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javaee/ApacheDefaultProviderTest.java
@@ -62,7 +62,7 @@ void apacheDefaultProvider() {
org.hibernate.validator.HibernateValidator
org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator
org.hibernate.validator.engine.resolver.DefaultTraversableResolver
- org.hibernate.validator.engine.ConstraintValidatorFactoryImpl
+ org.hibernate.validator.engine.ConstraintValidatorFactoryImpl
"""
)
diff --git a/src/test/java/org/openrewrite/java/migrate/javaee/HttpSessionInvalidateTest.java b/src/test/java/org/openrewrite/java/migrate/javaee/HttpSessionInvalidateTest.java
index fb0eeb071c..7618573ce3 100644
--- a/src/test/java/org/openrewrite/java/migrate/javaee/HttpSessionInvalidateTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javaee/HttpSessionInvalidateTest.java
@@ -41,7 +41,7 @@ void noChangeNeeded() {
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-
+
class Foo {
void logOut(HttpServletRequest req, HttpServletResponse res) {
HttpSession session = req.getSession();
@@ -62,7 +62,7 @@ void noChangeCannotFindServletRequest() {
"""
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-
+
class Foo {
void logOut(HttpSession session, HttpServletResponse res) {
session.invalidate();
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/AddColumnAnnotationTest.java b/src/test/java/org/openrewrite/java/migrate/javax/AddColumnAnnotationTest.java
index cc0673747b..470fc023e7 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/AddColumnAnnotationTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/AddColumnAnnotationTest.java
@@ -331,7 +331,7 @@ public class ElementCollectionEntity {
class InnerClass {
@Id
private int id2;
-
+
@ElementCollection
private List listofStrings2;
}
@@ -353,7 +353,7 @@ public class ElementCollectionEntity {
@Column(name = "element")
@ElementCollection
private List listofStrings;
-
+
class InnerClass {
@Id
private int id2;
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/AddCommonAnnotationsDependenciesTest.java b/src/test/java/org/openrewrite/java/migrate/javax/AddCommonAnnotationsDependenciesTest.java
index e6575b925d..fad8df675a 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/AddCommonAnnotationsDependenciesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/AddCommonAnnotationsDependenciesTest.java
@@ -28,8 +28,8 @@ class AddCommonAnnotationsDependenciesTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipeFromResource(
- "/META-INF/rewrite/add-common-annotations-dependencies.yml",
- "org.openrewrite.java.migrate.javax.AddCommonAnnotationsDependencies")
+ "/META-INF/rewrite/add-common-annotations-dependencies.yml",
+ "org.openrewrite.java.migrate.javax.AddCommonAnnotationsDependencies")
.allSources(src -> src.markers(javaVersion(8)));
}
@@ -43,7 +43,7 @@ void addDependencyIfAnnotationJsr250Present() {
java(
"""
import javax.annotation.Generated;
-
+
@Generated("Hello")
class A {
}
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/AddDefaultConstructorToEntityClassTest.java b/src/test/java/org/openrewrite/java/migrate/javax/AddDefaultConstructorToEntityClassTest.java
index 3fb3302f12..238e984d56 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/AddDefaultConstructorToEntityClassTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/AddDefaultConstructorToEntityClassTest.java
@@ -96,7 +96,7 @@ public MissingNoArgConstructorEntity(int id) {
@MappedSuperclass
public class MissingNoArgConstructorEntity {
-
+
public MissingNoArgConstructorEntity() {
}
@Id
@@ -174,7 +174,7 @@ public class MissingNoArgConstructorEntity {
public MissingNoArgConstructorEntity(int id) {
this.id = id;
}
-
+
public void doNothing() {
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/AddJaxbDependenciesTest.java b/src/test/java/org/openrewrite/java/migrate/javax/AddJaxbDependenciesTest.java
index a40a42c4b9..1b5628ea47 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/AddJaxbDependenciesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/AddJaxbDependenciesTest.java
@@ -49,7 +49,7 @@ public void defaults(RecipeSpec spec) {
// language=java
private static final String CLASS_USING_XML_BIND = """
import javax.xml.bind.annotation.XmlElement;
-
+
public class Test {
@XmlElement
private String name;
@@ -68,11 +68,11 @@ void addJaxbRuntimeOnce() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
}
@@ -87,14 +87,14 @@ void addJaxbRuntimeOnce() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.bind:jakarta.xml.bind-api:%s"
-
+
runtimeOnly "org.glassfish.jaxb:jaxb-runtime:%s"
}
""".formatted(bindApiVersion, runtimeVersion);
@@ -160,16 +160,16 @@ void renameRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.3"
-
+
compileOnly "com.sun.xml.bind:jaxb-impl:2.3.3"
-
+
testImplementation "com.sun.xml.bind:jaxb-impl:2.3.3"
}
""",
@@ -183,18 +183,18 @@ void renameRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.bind:jakarta.xml.bind-api:%s"
-
+
runtimeOnly "org.glassfish.jaxb:jaxb-runtime:%s"
-
+
compileOnly "org.glassfish.jaxb:jaxb-runtime:%s"
-
+
testImplementation "org.glassfish.jaxb:jaxb-runtime:%s"
}
""".formatted(bindApiVersion, runtimeVersion, runtimeVersion, runtimeVersion);
@@ -266,16 +266,16 @@ void renameAndUpdateApiAndRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "javax.xml.bind:jaxb-api:2.3.1"
-
+
compileOnly "org.glassfish.jaxb:jaxb-runtime:2.3.1"
-
+
testImplementation "org.glassfish.jaxb:jaxb-runtime:2.3.1"
}
""",
@@ -289,18 +289,18 @@ void renameAndUpdateApiAndRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.bind:jakarta.xml.bind-api:%s"
-
+
runtimeOnly "org.glassfish.jaxb:jaxb-runtime:%s"
-
+
compileOnly "org.glassfish.jaxb:jaxb-runtime:%s"
-
+
testImplementation "org.glassfish.jaxb:jaxb-runtime:%s"
}
""".formatted(bindApiVersion, runtimeVersion, runtimeVersion, runtimeVersion);
@@ -451,11 +451,11 @@ void dontAddWhenJacksonPresent() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
api("com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.16.0")
}
@@ -497,7 +497,7 @@ void dontAddWhenTransientPresent() {
repositories {
mavenCentral()
}
-
+
dependencies {
implementation("jakarta.xml.bind:jakarta.xml.bind-api:2.3.3")
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.7.3'
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/AddJaxwsDependenciesTest.java b/src/test/java/org/openrewrite/java/migrate/javax/AddJaxwsDependenciesTest.java
index db0c7da210..8e67902617 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/AddJaxwsDependenciesTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/AddJaxwsDependenciesTest.java
@@ -48,11 +48,11 @@ void addJaxwsRuntimeOnce() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.ws:jakarta.xml.ws-api:2.3.2"
}
@@ -68,16 +68,16 @@ void addJaxwsRuntimeOnce() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
compileOnly "com.sun.xml.ws:jaxws-rt:%s"
-
+
implementation "jakarta.xml.ws:jakarta.xml.ws-api:%s"
-
+
testImplementation "com.sun.xml.ws:jaxws-rt:%s"
}
""".formatted(rtVersion, wsApiVersion, rtVersion);
@@ -141,16 +141,16 @@ void removeReferenceImplementationRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
compileOnly "com.sun.xml.ws:jaxws-ri:2.3.2"
-
+
implementation "javax.xml.ws:jaxws-api:2.3.1"
-
+
testImplementation "com.sun.xml.ws:jaxws-ri:2.3.2"
}
""",
@@ -165,14 +165,14 @@ void removeReferenceImplementationRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "com.sun.xml.ws:jaxws-rt:%s"
-
+
implementation "jakarta.xml.ws:jakarta.xml.ws-api:%s"
}
""".formatted(rtVersion, wsApiVersion);
@@ -242,16 +242,16 @@ void renameAndUpdateApiAndRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
compileOnly "com.sun.xml.ws:jaxws-ri:2.3.2"
-
+
implementation "jakarta.xml.ws:jakarta.xml.ws-api:2.3.2"
-
+
testImplementation "com.sun.xml.ws:jaxws-ri:2.3.2"
}
""",
@@ -266,14 +266,14 @@ void renameAndUpdateApiAndRuntime() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "com.sun.xml.ws:jaxws-rt:%s"
-
+
implementation "jakarta.xml.ws:jakarta.xml.ws-api:%s"
}
""".formatted(rtVersion, wsApiVersion);
@@ -343,11 +343,11 @@ void renameAndUpdateApiAndAddRuntimeManagedDependencies() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
implementation "jakarta.xml.ws:jakarta.xml.ws-api:2.3.2"
}
@@ -363,16 +363,16 @@ void renameAndUpdateApiAndAddRuntimeManagedDependencies() {
plugins {
id "java-library"
}
-
+
repositories {
mavenCentral()
}
-
+
dependencies {
compileOnly "com.sun.xml.ws:jaxws-rt:%s"
-
+
implementation "jakarta.xml.ws:jakarta.xml.ws-api:%s"
-
+
testImplementation "com.sun.xml.ws:jaxws-rt:%s"
}
""".formatted(rtVersion, wsApiVersion, rtVersion);
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/AddTransientAnnotationToPrivateAccessorTest.java b/src/test/java/org/openrewrite/java/migrate/javax/AddTransientAnnotationToPrivateAccessorTest.java
index f23c51be6e..d7caac22cb 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/AddTransientAnnotationToPrivateAccessorTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/AddTransientAnnotationToPrivateAccessorTest.java
@@ -429,7 +429,7 @@ private int getNonPersistentField() {
}
}
""",
- """
+ """
package entities;
import javax.persistence.Entity;
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/JavaxLangModelUtilTest.java b/src/test/java/org/openrewrite/java/migrate/javax/JavaxLangModelUtilTest.java
index 4c2af9ca99..8b4e537bbb 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/JavaxLangModelUtilTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/JavaxLangModelUtilTest.java
@@ -42,12 +42,12 @@ void abstractAnnotationValueVisitor6() {
java(
"""
import javax.lang.model.util.AbstractAnnotationValueVisitor6;
-
+
abstract class Test extends AbstractAnnotationValueVisitor6 {}
""",
"""
import javax.lang.model.util.AbstractAnnotationValueVisitor9;
-
+
abstract class Test extends AbstractAnnotationValueVisitor9 {}
"""
)
@@ -61,12 +61,12 @@ void abstractElementVisitor6() {
java(
"""
import javax.lang.model.util.AbstractElementVisitor6;
-
+
abstract class Test extends AbstractElementVisitor6 {}
""",
"""
import javax.lang.model.util.AbstractElementVisitor9;
-
+
abstract class Test extends AbstractElementVisitor9 {}
"""
)
@@ -80,12 +80,12 @@ void abstractTypeVisitor6() {
java(
"""
import javax.lang.model.util.AbstractTypeVisitor6;
-
+
abstract class Test extends AbstractTypeVisitor6 {}
""",
"""
import javax.lang.model.util.AbstractTypeVisitor9;
-
+
abstract class Test extends AbstractTypeVisitor9 {}
"""
)
@@ -99,12 +99,12 @@ void elementKindVisitor6() {
java(
"""
import javax.lang.model.util.ElementKindVisitor6;
-
+
public class Test extends ElementKindVisitor6 {}
""",
"""
import javax.lang.model.util.ElementKindVisitor9;
-
+
public class Test extends ElementKindVisitor9 {}
"""
)
@@ -118,12 +118,12 @@ void elementScanner6() {
java(
"""
import javax.lang.model.util.ElementScanner6;
-
+
public class Test extends ElementScanner6 {}
""",
"""
import javax.lang.model.util.ElementScanner9;
-
+
public class Test extends ElementScanner9 {}
"""
)
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/JavaxXmlStreamAPIsTest.java b/src/test/java/org/openrewrite/java/migrate/javax/JavaxXmlStreamAPIsTest.java
index 2fc4b3856d..49b98a3f0b 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/JavaxXmlStreamAPIsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/JavaxXmlStreamAPIsTest.java
@@ -26,7 +26,7 @@ class JavaxXmlStreamAPIsTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
- spec.recipeFromResource("/META-INF/rewrite/javax-xml-stream.yml","org.openrewrite.java.migrate.javax.JavaxXmlStreamAPIs");
+ spec.recipeFromResource("/META-INF/rewrite/javax-xml-stream.yml", "org.openrewrite.java.migrate.javax.JavaxXmlStreamAPIs");
}
@DocumentExample
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/RemoveTemporalAnnotationTest.java b/src/test/java/org/openrewrite/java/migrate/javax/RemoveTemporalAnnotationTest.java
index 4cab77463d..bfb98f000f 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/RemoveTemporalAnnotationTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/RemoveTemporalAnnotationTest.java
@@ -108,7 +108,7 @@ public class TemporalDates {
@Temporal(TemporalType.DATE)
private java.sql.Timestamp timestampTimestamp;
-
+
@Temporal(TemporalType.TIME)
private java.sql.Timestamp timestampTimestamp;
}
diff --git a/src/test/java/org/openrewrite/java/migrate/javax/UseJoinColumnForMappingTest.java b/src/test/java/org/openrewrite/java/migrate/javax/UseJoinColumnForMappingTest.java
index 8c9cf9e498..ef1396ecf2 100644
--- a/src/test/java/org/openrewrite/java/migrate/javax/UseJoinColumnForMappingTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/javax/UseJoinColumnForMappingTest.java
@@ -223,6 +223,7 @@ public class TransactionEntity {
)
);
}
+
@Test
void useJoinColumnForOneToOneNoAttr() {
//language=java
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/UseTextBlocksTest.java b/src/test/java/org/openrewrite/java/migrate/lang/UseTextBlocksTest.java
index be71703025..6df193c50e 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/UseTextBlocksTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/UseTextBlocksTest.java
@@ -180,7 +180,7 @@ class Test {
String query = \"""
SELECT * FROM
my_table
- \""" +
+ \""" +
"WHERE something = 1;";
}
"""
@@ -463,9 +463,9 @@ public static void main(String[] args) {
}
@Disabled("""
- This test is to demonstrate that the text block conversion is correct.
- In this test, s1, s2, and s3 are equivalent, and we translate s1 to s2.
- """)
+ This test is to demonstrate that the text block conversion is correct.
+ In this test, s1, s2, and s3 are equivalent, and we translate s1 to s2.
+ """)
@Test
void textBlockDemo() {
String s1 = "\n========================================================="
@@ -477,26 +477,26 @@ void textBlockDemo() {
+ "\n "
+ "\n=========================================================";
String s2 = """
-
- =========================================================
- \s
- Welcome to Spring Integration! \s
- \s
- For more information please visit: \s
- https://www.springsource.org/spring-integration \s
- \s
- =========================================================\
- """;
+
+ =========================================================
+ \s
+ Welcome to Spring Integration! \s
+ \s
+ For more information please visit: \s
+ https://www.springsource.org/spring-integration \s
+ \s
+ =========================================================\
+ """;
String s3 = """
- \n=========================================================\
- \n \
- \n Welcome to Spring Integration! \
- \n \
- \n For more information please visit: \
- \n https://www.springsource.org/spring-integration \
- \n \
- \n=========================================================\
- """;
+ \n=========================================================\
+ \n \
+ \n Welcome to Spring Integration! \
+ \n \
+ \n For more information please visit: \
+ \n https://www.springsource.org/spring-integration \
+ \n \
+ \n=========================================================\
+ """;
assertThat(s1).isEqualTo(s2).isEqualTo(s3);
}
@@ -551,7 +551,7 @@ void consecutiveNewLines() {
"""
class Test {
String s1 = "line1\\n\\n" +
- "line3\\n\\n\\n" +
+ "line3\\n\\n\\n" +
"line6\\n";
}
""",
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/UseVarKeywordTest.java b/src/test/java/org/openrewrite/java/migrate/lang/UseVarKeywordTest.java
index 0a8a690dd5..16cdd5a4b0 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/UseVarKeywordTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/UseVarKeywordTest.java
@@ -49,7 +49,7 @@ void assignNull() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String str = null;
@@ -67,7 +67,7 @@ void assignNothing() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String str;
@@ -85,7 +85,7 @@ void multipleVariables() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String str1, str2 = "Hello World!";
@@ -103,7 +103,7 @@ void simpleAssigment() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String str1;
@@ -122,7 +122,7 @@ void varUsage() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
var str1 = "Hello World!";
@@ -140,7 +140,7 @@ void withTernary() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String o = true ? "isTrue" : "Test";
@@ -164,7 +164,7 @@ void inMethodBody() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
Object o = new Object();
@@ -173,7 +173,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var o = new Object();
@@ -191,7 +191,7 @@ void reassignment() {
java(
"""
package com.example.app;
-
+
class A {
Object o = new Object();
void m() {
@@ -201,7 +201,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
Object o = new Object();
void m() {
@@ -221,7 +221,7 @@ void withTernary() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String o = true ? "isTrue" : "Test";
@@ -230,7 +230,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var o = true ? "isTrue" : "Test";
@@ -248,7 +248,7 @@ void inStaticInitializer() {
java(
"""
package com.example.app;
-
+
class A {
static {
Object o = new Object();
@@ -257,7 +257,7 @@ class A {
""",
"""
package com.example.app;
-
+
class A {
static {
var o = new Object();
@@ -275,7 +275,7 @@ void inInstanceInitializer() {
java(
"""
package com.example.app;
-
+
class A {
{
Object o = new Object();
@@ -284,7 +284,7 @@ class A {
""",
"""
package com.example.app;
-
+
class A {
{
var o = new Object();
@@ -305,7 +305,7 @@ void asParameter() {
java(
"""
package com.example.app;
-
+
class A {
Object m(Object o) {
return o;
@@ -323,7 +323,7 @@ void asField() {
java(
"""
package com.example.app;
-
+
class A {
Object o = new Object();
Object m() {
@@ -348,7 +348,7 @@ void forShort() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
short mask = 0x7fff;
@@ -366,7 +366,7 @@ void forByte() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
byte flags = 0;
@@ -388,7 +388,7 @@ void forString() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
String str = "I am a value";
@@ -397,7 +397,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var str = "I am a value";
@@ -415,7 +415,7 @@ void forBoolean() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
boolean b = true;
@@ -424,7 +424,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var b = true;
@@ -442,7 +442,7 @@ void forChar() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
char ch = '\ufffd';
@@ -451,7 +451,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var ch = '\ufffd';
@@ -469,7 +469,7 @@ void forDouble() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
double d = 2.0;
@@ -478,7 +478,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var d = 2.0;
@@ -496,7 +496,7 @@ void forFloat() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
float f = 2.0F;
@@ -505,7 +505,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var f = 2.0F;
@@ -523,7 +523,7 @@ void forLong() {
version(
java("""
package com.example.app;
-
+
class A {
void m() {
long l = 2;
@@ -532,7 +532,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var l = 2L;
@@ -551,7 +551,7 @@ void forDoubleWithTypNotation() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
double d = 2.0D;
@@ -560,7 +560,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var d = 2.0D;
@@ -578,7 +578,7 @@ void forFloatWithTypNotation() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
float f = 2.0F;
@@ -587,7 +587,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var f = 2.0F;
@@ -605,7 +605,7 @@ void forLongWithTypNotation() {
java(
"""
package com.example.app;
-
+
class A {
void m() {
long l = 2L;
@@ -614,7 +614,7 @@ void m() {
""",
"""
package com.example.app;
-
+
class A {
void m() {
var l = 2L;
@@ -638,9 +638,9 @@ void forEmptyFactoryMethod() {
java(
"""
package com.example.app;
-
+
import java.util.List;
-
+
class A {
void m() {
List strs = List.of();
@@ -658,10 +658,10 @@ void forEmptyDiamondOperators() {
java(
"""
package com.example.app;
-
+
import java.util.ArrayList;
import java.util.List;
-
+
class A {
void m() {
List strs = new ArrayList<>();
@@ -679,10 +679,10 @@ void withDiamondOperatorOnRaw() {
java(
"""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList();
@@ -703,10 +703,10 @@ void ifWelldefined() {
java(
"""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList();
@@ -715,9 +715,9 @@ void m() {
""",
"""
package com.example.app;
-
+
import java.util.ArrayList;
-
+
class A {
void m() {
var strs = new ArrayList();
@@ -735,10 +735,10 @@ void forNoDiamondOperators() {
java(
"""
package com.example.app;
-
+
import java.util.ArrayList;
import java.util.List;
-
+
class A {
void m() {
List strs = new ArrayList();
@@ -747,9 +747,9 @@ void m() {
""",
"""
package com.example.app;
-
+
import java.util.ArrayList;
-
+
class A {
void m() {
var strs = new ArrayList();
@@ -768,10 +768,10 @@ void withDiamondOperator() {
java(
"""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList<>();
@@ -779,10 +779,10 @@ void m() {
}
""",
"""
- package com.example.app;
-
+ package com.example.app;
+
import java.util.ArrayList;
-
+
class A {
void m() {
var strs = new ArrayList();
@@ -800,9 +800,9 @@ void withFactoryMethods() {
java(
"""
package com.example.app;
-
+
import java.util.List;
-
+
class A {
void m() {
List strs = List.of("one", "two");
@@ -811,9 +811,9 @@ void m() {
""",
"""
package com.example.app;
-
+
import java.util.List;
-
+
class A {
void m() {
var strs = List.of("one", "two");
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericMethodInvocationsTest.java b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericMethodInvocationsTest.java
index a956d41d04..17ea72b5ca 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericMethodInvocationsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericMethodInvocationsTest.java
@@ -39,17 +39,17 @@ void forNonGenericMethod() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- class A {
- static String myString(String ... values) {
- return String.join("",values);
- }
- void m() {
- String strs = myString();
+ package com.example.app;
+
+ class A {
+ static String myString(String ... values) {
+ return String.join("",values);
+ }
+ void m() {
+ String strs = myString();
+ }
}
- }
- """),
+ """),
10
)
);
@@ -65,23 +65,24 @@ void withStaticMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- static List myList() {
- return List.of("one", "two");
- }
- void m() {
- List strs = myList();
- }
- }
- """),
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ static List myList() {
+ return List.of("one", "two");
+ }
+ void m() {
+ List strs = myList();
+ }
+ }
+ """),
10
)
);
}
+
@Test
void withEmptyOnwNonStaticFactoryMethods() {
//if detectable this could be `var strs = this.myList();`
@@ -89,23 +90,24 @@ void withEmptyOnwNonStaticFactoryMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- List myList(T ... values) {
- return List.of(values);
- }
- void m() {
- List strs = myList();
- }
- }
- """),
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ List myList(T ... values) {
+ return List.of(values);
+ }
+ void m() {
+ List strs = myList();
+ }
+ }
+ """),
10
)
);
}
+
@Test
void withEmptyOnwFactoryMethods() {
// if detectable this could be `var strs = A.myList();`
@@ -113,23 +115,24 @@ void withEmptyOnwFactoryMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- static List myList(T ... values) {
- return List.of(values);
- }
- void m() {
- List strs = myList();
- }
- }
- """),
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ static List myList(T ... values) {
+ return List.of(values);
+ }
+ void m() {
+ List strs = myList();
+ }
+ }
+ """),
10
)
);
}
+
@Test
void forEmptyJDKFactoryMethod() {
// if detectable this could be `var strs = List.of();`
@@ -139,9 +142,9 @@ void forEmptyJDKFactoryMethod() {
java(
"""
package com.example.app;
-
+
import java.util.List;
-
+
class A {
void m() {
List strs = List.of();
@@ -164,26 +167,26 @@ void withJDKFactoryMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- void m() {
- List strs = List.of("one", "two");
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ void m() {
+ List strs = List.of("one", "two");
+ }
}
- }
- """, """
- package com.example.app;
-
- import java.util.List;
-
- class A {
- void m() {
- var strs = List.of("one", "two");
+ """, """
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ void m() {
+ var strs = List.of("one", "two");
+ }
}
- }
- """),
+ """),
10
)
);
@@ -195,26 +198,26 @@ void withJDKFactoryMethodsAndBounds() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- void m() {
- List extends String> lst = List.of("Test");
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ void m() {
+ List extends String> lst = List.of("Test");
+ }
}
- }
- """, """
- package com.example.app;
-
- import java.util.List;
-
- class A {
- void m() {
- var lst = List.of("Test");
+ """, """
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ void m() {
+ var lst = List.of("Test");
+ }
}
- }
- """),
+ """),
10
)
);
@@ -226,32 +229,32 @@ void withOwnFactoryMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- static List myList(T ... values) {
- return List.of(values);
- }
- void m() {
- List strs = myList("one", "two");
- }
- }
- """, """
- package com.example.app;
-
- import java.util.List;
-
- class A {
- static List myList(T ... values) {
- return List.of(values);
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ static List myList(T ... values) {
+ return List.of(values);
+ }
+ void m() {
+ List strs = myList("one", "two");
+ }
}
- void m() {
- var strs = myList("one", "two");
+ """, """
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ static List myList(T ... values) {
+ return List.of(values);
+ }
+ void m() {
+ var strs = myList("one", "two");
+ }
}
- }
- """),
+ """),
10
)
);
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericsConstructorsTest.java b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericsConstructorsTest.java
index bd832659b4..ba1a5d09a0 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericsConstructorsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForGenericsConstructorsTest.java
@@ -41,21 +41,22 @@ void boundedGenerics() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
- import java.util.ArrayList;
-
- class A {
- void generic() {
- List extends String> lst = new ArrayList<>();
- }
+ package com.example.app;
+
+ import java.util.List;
+ import java.util.ArrayList;
+
+ class A {
+ void generic() {
+ List extends String> lst = new ArrayList<>();
}
- """),
+ }
+ """),
10
)
);
}
+
@Test
void forEmptyFactoryMethod() {
//language=java
@@ -64,9 +65,9 @@ void forEmptyFactoryMethod() {
java(
"""
package com.example.app;
-
+
import java.util.List;
-
+
class A {
void m() {
List strs = List.of();
@@ -77,6 +78,7 @@ void m() {
)
);
}
+
@Test
void withFactoryMethods() {
// this one is handled by UseVarForMethodInvocations
@@ -84,20 +86,21 @@ void withFactoryMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
-
- class A {
- void m() {
- List strs = List.of("one", "two");
+ package com.example.app;
+
+ import java.util.List;
+
+ class A {
+ void m() {
+ List strs = List.of("one", "two");
+ }
}
- }
- """),
+ """),
10
)
);
}
+
@Test
void forEmptyDiamondOperators() {
//language=java
@@ -106,10 +109,10 @@ void forEmptyDiamondOperators() {
java(
"""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList<>();
@@ -120,6 +123,7 @@ void m() {
)
);
}
+
@Test
void withDiamondOperatorOnRaw() {
//todo check if this may be possible!, We could transform ArrayList into ArrayList
@@ -128,10 +132,10 @@ void withDiamondOperatorOnRaw() {
version(
java("""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList();
@@ -142,6 +146,7 @@ void m() {
)
);
}
+
@Test
void forNoDiamondOperators() {
// this one fails for generics because it's covered by UseVarForObjects
@@ -151,10 +156,10 @@ void forNoDiamondOperators() {
java(
"""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList();
@@ -179,63 +184,63 @@ void genericMethod() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
- import java.util.ArrayList;
-
- class A {
- static void generic() {
- List lst = new ArrayList<>();
+ package com.example.app;
+
+ import java.util.List;
+ import java.util.ArrayList;
+
+ class A {
+ static void generic() {
+ List lst = new ArrayList<>();
+ }
}
- }
- """, """
- package com.example.app;
+ """, """
+ package com.example.app;
- import java.util.ArrayList;
-
- class A {
- static void generic() {
- var lst = new ArrayList();
+ import java.util.ArrayList;
+
+ class A {
+ static void generic() {
+ var lst = new ArrayList();
+ }
}
- }
- """),
- 10
- )
- );
- }
+ """),
+ 10
+ )
+ );
+ }
- @Test
- void unboundedGenerics() {
- //language=java
- rewriteRun(
- version(
- java("""
- package com.example.app;
-
- import java.util.List;
- import java.util.ArrayList;
-
- class A {
- void generic() {
- List> lst = new ArrayList<>();
+ @Test
+ void unboundedGenerics() {
+ //language=java
+ rewriteRun(
+ version(
+ java("""
+ package com.example.app;
+
+ import java.util.List;
+ import java.util.ArrayList;
+
+ class A {
+ void generic() {
+ List> lst = new ArrayList<>();
+ }
}
- }
- """, """
- package com.example.app;
-
- import java.util.ArrayList;
-
- class A {
- void generic() {
- var lst = new ArrayList>();
+ """, """
+ package com.example.app;
+
+ import java.util.ArrayList;
+
+ class A {
+ void generic() {
+ var lst = new ArrayList>();
+ }
}
- }
- """),
- 10
- )
- );
- }
+ """),
+ 10
+ )
+ );
+ }
@Test
void boundedGenerics() {
@@ -244,17 +249,17 @@ void boundedGenerics() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.List;
- import java.util.ArrayList;
-
- class A {
- void generic() {
- List extends String> lst = new ArrayList<>();
+ package com.example.app;
+
+ import java.util.List;
+ import java.util.ArrayList;
+
+ class A {
+ void generic() {
+ List extends String> lst = new ArrayList<>();
+ }
}
- }
- """),
+ """),
10
)
);
@@ -267,10 +272,10 @@ void inceptionGenerics() {
version(
java("""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void generic() {
List> lst = new ArrayList<>();
@@ -281,7 +286,7 @@ void generic() {
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void generic() {
var lst = new ArrayList>();
@@ -299,27 +304,27 @@ void twoParams() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- import java.util.Map;
- import java.util.HashMap;
-
- class A {
- void twoParams() {
- Map map = new HashMap<>();
+ package com.example.app;
+
+ import java.util.Map;
+ import java.util.HashMap;
+
+ class A {
+ void twoParams() {
+ Map map = new HashMap<>();
+ }
}
- }
- """, """
- package com.example.app;
+ """, """
+ package com.example.app;
- import java.util.HashMap;
-
- class A {
- void twoParams() {
- var map = new HashMap();
+ import java.util.HashMap;
+
+ class A {
+ void twoParams() {
+ var map = new HashMap();
+ }
}
- }
- """),
+ """),
10
)
);
@@ -333,10 +338,10 @@ void ifWelldefined() {
version(
java("""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList();
@@ -346,7 +351,7 @@ void m() {
package com.example.app;
import java.util.ArrayList;
-
+
class A {
void m() {
var strs = new ArrayList();
@@ -365,10 +370,10 @@ void arrayAsType() {
version(
java("""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList<>();
@@ -378,7 +383,7 @@ void m() {
package com.example.app;
import java.util.ArrayList;
-
+
class A {
void m() {
var strs = new ArrayList();
@@ -397,12 +402,12 @@ void twoParamsWithBounds() {
version(
java("""
package com.example.app;
-
+
import java.util.Map;
import java.util.LinkedHashMap;
-
+
class AbstractOAuth2Configurer {}
-
+
class A {
void twoParams() {
Map, AbstractOAuth2Configurer> configurers = new LinkedHashMap<>();
@@ -422,10 +427,10 @@ void withTypeParameterInDefinitionOnly() {
version(
java("""
package com.example.app;
-
+
import java.util.List;
import java.util.ArrayList;
-
+
class A {
void m() {
List strs = new ArrayList<>();
@@ -435,7 +440,7 @@ void m() {
package com.example.app;
import java.util.ArrayList;
-
+
class A {
void m() {
var strs = new ArrayList();
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForObjectsTest.java b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForObjectsTest.java
index d897c16e55..c1e31ebd8d 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForObjectsTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForObjectsTest.java
@@ -39,23 +39,23 @@ void inMethodBody() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- Object o = new Object();
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ Object o = new Object();
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var o = new Object();
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var o = new Object();
+ }
}
- }
- """)
+ """)
);
}
@@ -64,25 +64,25 @@ void reassignment() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- Object o = new Object();
- void m() {
- Object innerO = o;
+ """
+ package com.example.app;
+
+ class A {
+ Object o = new Object();
+ void m() {
+ Object innerO = o;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- Object o = new Object();
- void m() {
- var innerO = o;
+ """, """
+ package com.example.app;
+
+ class A {
+ Object o = new Object();
+ void m() {
+ var innerO = o;
+ }
}
- }
- """
+ """
)
);
}
@@ -93,19 +93,19 @@ void withModifier() {
//language=java
rewriteRun(
java(
- """
- class A {
- void m() {
- final Object o = new Object();
+ """
+ class A {
+ void m() {
+ final Object o = new Object();
+ }
}
- }
- """, """
- class A {
- void m() {
- final var o = new Object();
+ """, """
+ class A {
+ void m() {
+ final var o = new Object();
+ }
}
- }
- """
+ """
)
);
}
@@ -116,23 +116,23 @@ void withTernary() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- String o = true ? "isTrue" : "Test";
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ String o = true ? "isTrue" : "Test";
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var o = true ? "isTrue" : "Test";
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var o = true ? "isTrue" : "Test";
+ }
}
- }
- """
+ """
)
);
}
@@ -142,23 +142,23 @@ void inStaticInitializer() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- static {
- Object o = new Object();
+ """
+ package com.example.app;
+
+ class A {
+ static {
+ Object o = new Object();
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- static {
- var o = new Object();
+ """, """
+ package com.example.app;
+
+ class A {
+ static {
+ var o = new Object();
+ }
}
- }
- """
+ """
)
);
}
@@ -168,23 +168,23 @@ void inInstanceInitializer() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- {
- Object o = new Object();
+ """
+ package com.example.app;
+
+ class A {
+ {
+ Object o = new Object();
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- {
- var o = new Object();
+ """, """
+ package com.example.app;
+
+ class A {
+ {
+ var o = new Object();
+ }
}
- }
- """
+ """
)
);
}
@@ -198,7 +198,7 @@ void sameType() {
version(
java("""
package com.example.app;
-
+
class A {
String getHello() {
return "Hello";
@@ -209,7 +209,7 @@ void m() {
}
""", """
package com.example.app;
-
+
class A {
String getHello() {
return "Hello";
@@ -231,7 +231,7 @@ void subType() {
version(
java("""
package com.example.app;
-
+
class A {
class CustomTokenizer extends java.util.StringTokenizer {
CustomTokenizer() {
@@ -247,7 +247,7 @@ void m() {
}
""", """
package com.example.app;
-
+
class A {
class CustomTokenizer extends java.util.StringTokenizer {
CustomTokenizer() {
@@ -273,34 +273,34 @@ void staticMethods() {
rewriteRun(
version(
java("""
- package com.example.app;
-
- class A {
- static class B {
- private B() {}
- static B newInstance() {
- return new B();
+ package com.example.app;
+
+ class A {
+ static class B {
+ private B() {}
+ static B newInstance() {
+ return new B();
+ }
}
- }
- void m() {
- B b = B.newInstance();
- }
- }
- """, """
- package com.example.app;
-
- class A {
- static class B {
- private B() {}
- static B newInstance() {
- return new B();
+ void m() {
+ B b = B.newInstance();
}
- }
- void m() {
- var b = B.newInstance();
- }
- }
- """),
+ }
+ """, """
+ package com.example.app;
+
+ class A {
+ static class B {
+ private B() {}
+ static B newInstance() {
+ return new B();
+ }
+ }
+ void m() {
+ var b = B.newInstance();
+ }
+ }
+ """),
10
)
);
@@ -315,15 +315,15 @@ void fieldInAnonymousSubclass() {
//language=java
rewriteRun(
java(
- """
- class A {
- void m() {
- new Object() {
- private final Object o1 = new Object();
- };
- }
- }
"""
+ class A {
+ void m() {
+ new Object() {
+ private final Object o1 = new Object();
+ };
+ }
+ }
+ """
)
);
}
@@ -333,15 +333,15 @@ void asParameter() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- Object m(Object o) {
- return o;
- }
- }
"""
+ package com.example.app;
+
+ class A {
+ Object m(Object o) {
+ return o;
+ }
+ }
+ """
)
);
}
@@ -351,16 +351,16 @@ void asField() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- Object o = new Object();
- Object m() {
- return o;
- }
- }
"""
+ package com.example.app;
+
+ class A {
+ Object o = new Object();
+ Object m() {
+ return o;
+ }
+ }
+ """
)
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForPrimitiveTest.java b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForPrimitiveTest.java
index f654e331ca..0a109d1ae1 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForPrimitiveTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/var/UseVarForPrimitiveTest.java
@@ -37,15 +37,15 @@ void forShort() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- short mask = 0x7fff;
- }
- }
"""
+ package com.example.app;
+
+ class A {
+ void m() {
+ short mask = 0x7fff;
+ }
+ }
+ """
)
);
}
@@ -55,15 +55,15 @@ void forByte() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- byte flags = 0;
- }
- }
"""
+ package com.example.app;
+
+ class A {
+ void m() {
+ byte flags = 0;
+ }
+ }
+ """
)
);
}
@@ -77,23 +77,23 @@ void forBoolean() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- boolean b = true;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ boolean b = true;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var b = true;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var b = true;
+ }
}
- }
- """
+ """
)
);
}
@@ -104,23 +104,23 @@ void forChar() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- char ch = '\ufffd';
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ char ch = '\ufffd';
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var ch = '\ufffd';
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var ch = '\ufffd';
+ }
}
- }
- """
+ """
)
);
}
@@ -130,23 +130,23 @@ void forDouble() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- double d = 2.0;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ double d = 2.0;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var d = 2.0;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var d = 2.0;
+ }
}
- }
- """
+ """
)
);
}
@@ -156,23 +156,23 @@ void forFloat() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- float f = 2.0;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ float f = 2.0;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var f = 2.0F;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var f = 2.0F;
+ }
}
- }
- """
+ """
)
);
}
@@ -182,23 +182,23 @@ void forLong() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- long l = 2;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ long l = 2;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var l = 2L;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var l = 2L;
+ }
}
- }
- """
+ """
)
);
}
@@ -208,23 +208,23 @@ void forDoubleWithTypNotation() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- double d = 2.0D;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ double d = 2.0D;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var d = 2.0D;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var d = 2.0D;
+ }
}
- }
- """
+ """
)
);
}
@@ -234,23 +234,23 @@ void forFloatWithTypNotation() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- float f = 2.0F;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ float f = 2.0F;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var f = 2.0F;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var f = 2.0F;
+ }
}
- }
- """
+ """
)
);
}
@@ -260,23 +260,23 @@ void forLongWithTypNotation() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- long l = 2L;
+ """
+ package com.example.app;
+
+ class A {
+ void m() {
+ long l = 2L;
+ }
}
- }
- """, """
- package com.example.app;
-
- class A {
- void m() {
- var l = 2L;
+ """, """
+ package com.example.app;
+
+ class A {
+ void m() {
+ var l = 2L;
+ }
}
- }
- """
+ """
)
);
}
@@ -286,19 +286,19 @@ void withModifier() {
//language=java
rewriteRun(
java(
- """
- class A {
- void m() {
- final int i = 42;
+ """
+ class A {
+ void m() {
+ final int i = 42;
+ }
}
- }
- """, """
- class A {
- void m() {
- final var i = 42;
+ """, """
+ class A {
+ void m() {
+ final var i = 42;
+ }
}
- }
- """
+ """
)
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/lang/var/VarBaseTest.java b/src/test/java/org/openrewrite/java/migrate/lang/var/VarBaseTest.java
index fc5324c87d..23474abb19 100644
--- a/src/test/java/org/openrewrite/java/migrate/lang/var/VarBaseTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/lang/var/VarBaseTest.java
@@ -46,18 +46,18 @@ void fieldsInInnerClass() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
+ """
+ package com.example.app;
- class A {
- void m() {
- class Inner {
- final String str = "test";
- final int i = 0;
+ class A {
+ void m() {
+ class Inner {
+ final String str = "test";
+ final int i = 0;
+ }
}
}
- }
- """
+ """
)
);
}
@@ -67,15 +67,15 @@ void assignNull() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
+ """
+ package com.example.app;
- class A {
- void m() {
- String str = null;
+ class A {
+ void m() {
+ String str = null;
+ }
}
- }
- """
+ """
)
);
}
@@ -85,16 +85,16 @@ void assignNothing() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
+ """
+ package com.example.app;
- class A {
- void m() {
- String str;
- int i;
+ class A {
+ void m() {
+ String str;
+ int i;
+ }
}
- }
- """
+ """
)
);
}
@@ -104,16 +104,16 @@ void multipleVariables() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
+ """
+ package com.example.app;
- class A {
- void m() {
- String str1, str2 = "Hello World!";
- int i1, i2 = 1;
+ class A {
+ void m() {
+ String str1, str2 = "Hello World!";
+ int i1, i2 = 1;
+ }
}
- }
- """
+ """
)
);
}
@@ -123,18 +123,18 @@ void simpleAssigment() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- class A {
- void m() {
- String str1;
- str1 = "Hello World!";
- int i;
- i = 1;
- }
- }
"""
+ package com.example.app;
+
+ class A {
+ void m() {
+ String str1;
+ str1 = "Hello World!";
+ int i;
+ i = 1;
+ }
+ }
+ """
)
);
}
@@ -144,18 +144,18 @@ void varUsage() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
+ """
+ package com.example.app;
- import java.util.Date;
+ import java.util.Date;
- class A {
- void m() {
- var str1 = "Hello World!";
- var i = 1;
+ class A {
+ void m() {
+ var str1 = "Hello World!";
+ var i = 1;
+ }
}
- }
- """
+ """
)
);
}
@@ -165,16 +165,16 @@ void withTernary() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
+ """
+ package com.example.app;
- class A {
- void m() {
- String o = true ? "isTrue" : "isFalse";
- int i = true ? 1 : 0;
+ class A {
+ void m() {
+ String o = true ? "isTrue" : "isFalse";
+ int i = true ? 1 : 0;
+ }
}
- }
- """
+ """
)
);
}
@@ -186,18 +186,18 @@ void inDefinition() {
//language=java
rewriteRun(
java(
- """
- package com.example.app;
-
- import java.util.List;
- import java.util.ArrayList;
-
- class A {
- void m() {
- List
"""
)
@@ -93,14 +93,14 @@ void replaceSourceAndTargetConfigIfDefault() {
rewriteRun(
//language=xml
pomXml(
- """
+ """
4.0.0
org.sample
sample
1.0.0
-
+
@@ -115,7 +115,7 @@ void replaceSourceAndTargetConfigIfDefault() {
-
+
""",
"""
@@ -125,7 +125,7 @@ void replaceSourceAndTargetConfigIfDefault() {
org.sample
sample
1.0.0
-
+
@@ -139,7 +139,7 @@ void replaceSourceAndTargetConfigIfDefault() {
-
+
"""
)
@@ -151,18 +151,18 @@ void reusesJavaVersionVariableIfAvailable() {
rewriteRun(
//language=xml
pomXml(
- """
+ """
4.0.0
org.sample
sample
1.0.0
-
+
11
-
+
@@ -175,7 +175,7 @@ void reusesJavaVersionVariableIfAvailable() {
-
+
""",
"""
@@ -185,11 +185,11 @@ void reusesJavaVersionVariableIfAvailable() {
org.sample
sample
1.0.0
-
+
11
-
+
@@ -201,7 +201,7 @@ void reusesJavaVersionVariableIfAvailable() {
-
+
"""
)
@@ -213,14 +213,14 @@ void upgradesExistingReleaseConfig() {
rewriteRun(
//language=xml
pomXml(
- """
+ """
4.0.0
org.sample
sample
1.0.0
-
+
@@ -233,7 +233,7 @@ void upgradesExistingReleaseConfig() {
-
+
""",
"""
@@ -243,7 +243,7 @@ void upgradesExistingReleaseConfig() {
org.sample
sample
1.0.0
-
+
@@ -256,7 +256,7 @@ void upgradesExistingReleaseConfig() {
-
+
"""
)
@@ -268,18 +268,18 @@ void prefersJavaVersionIfAvailable() {
rewriteRun(
//language=xml
pomXml(
- """
+ """
4.0.0
org.sample
sample
1.0.0
-
+
11
-
+
@@ -292,7 +292,7 @@ void prefersJavaVersionIfAvailable() {
-
+
""",
"""
@@ -302,11 +302,11 @@ void prefersJavaVersionIfAvailable() {
org.sample
sample
1.0.0
-
+
11
-
+
@@ -319,7 +319,7 @@ void prefersJavaVersionIfAvailable() {
-
+
"""
)
@@ -331,18 +331,18 @@ void notMisledByUnrelatedProperty() {
rewriteRun(
//language=xml
pomXml(
- """
+ """
4.0.0
org.sample
sample
1.0.0
-
+
11
-
+
@@ -356,7 +356,7 @@ void notMisledByUnrelatedProperty() {
-
+
""",
"""
@@ -366,11 +366,11 @@ void notMisledByUnrelatedProperty() {
org.sample
sample
1.0.0
-
+
11
-
+
@@ -384,7 +384,7 @@ void notMisledByUnrelatedProperty() {
-
+
"""
)
@@ -397,29 +397,29 @@ void noVersionDowngrade() {
rewriteRun(
//language=xml
pomXml(
- """
-
-
- 4.0.0
- org.sample
- sample
- 1.0.0
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.0
-
- 17
-
-
-
-
-
-
- """)
+ """
+
+
+ 4.0.0
+ org.sample
+ sample
+ 1.0.0
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.0
+
+ 17
+
+
+
+
+
+
+ """)
);
}
@@ -428,21 +428,21 @@ void reusesJavaVersionVariableIfDefinedInParentPom() {
rewriteRun(
//language=xml
pomXml(
- """
-
-
- 4.0.0
- org.sample
- parent
- 1.0.0
-
-
- 11
-
-
- pom
-
- """),
+ """
+
+
+ 4.0.0
+ org.sample
+ parent
+ 1.0.0
+
+
+ 11
+
+
+ pom
+
+ """),
mavenProject(
"sample",
//language=xml
@@ -450,16 +450,16 @@ void reusesJavaVersionVariableIfDefinedInParentPom() {
4.0.0
-
+
org.sample
parent
1.0.0
-
+
sample
1.0.0
-
+
@@ -478,16 +478,16 @@ void reusesJavaVersionVariableIfDefinedInParentPom() {
4.0.0
-
+
org.sample
parent
1.0.0
-
+
sample
1.0.0
-
+
diff --git a/src/test/java/org/openrewrite/java/migrate/net/URLConstructorsToURITest.java b/src/test/java/org/openrewrite/java/migrate/net/URLConstructorsToURITest.java
index a735c33d42..c0df9779ea 100644
--- a/src/test/java/org/openrewrite/java/migrate/net/URLConstructorsToURITest.java
+++ b/src/test/java/org/openrewrite/java/migrate/net/URLConstructorsToURITest.java
@@ -38,7 +38,7 @@ void urlConstructor() {
java(
"""
import java.net.URL;
-
+
class Test {
void urlConstructor(String spec) throws Exception {
URL url1 = new URL(spec);
@@ -50,7 +50,7 @@ void urlConstructor(String spec) throws Exception {
"""
import java.net.URI;
import java.net.URL;
-
+
class Test {
void urlConstructor(String spec) throws Exception {
URL url1 = URI.create(spec).toURL();
diff --git a/src/test/java/org/openrewrite/java/migrate/search/FindDataUsedOnDtoTest.java b/src/test/java/org/openrewrite/java/migrate/search/FindDataUsedOnDtoTest.java
index 6e2d66c1fe..2e34c9b373 100644
--- a/src/test/java/org/openrewrite/java/migrate/search/FindDataUsedOnDtoTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/search/FindDataUsedOnDtoTest.java
@@ -44,7 +44,7 @@ void findDataUsedOnDto(String dtoType) {
java(
"""
import java.time.LocalDate;
-
+
class Test {
void test(LocalDate date) {
date.getDayOfMonth();
@@ -54,7 +54,7 @@ void test(LocalDate date) {
""",
"""
import java.time.LocalDate;
-
+
class Test {
void test(LocalDate date) {
/*~~>*/date.getDayOfMonth();
diff --git a/src/test/java/org/openrewrite/java/migrate/search/FindDtoOverfetchingTest.java b/src/test/java/org/openrewrite/java/migrate/search/FindDtoOverfetchingTest.java
index 4d4c9f8439..1cfe37782d 100644
--- a/src/test/java/org/openrewrite/java/migrate/search/FindDtoOverfetchingTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/search/FindDtoOverfetchingTest.java
@@ -36,13 +36,13 @@ void findDtoOverfetching(String dtoType) {
java(
"""
import java.time.LocalDate;
-
+
class Test {
void test(LocalDate date) {
date.getDayOfMonth();
date.getDayOfYear();
}
-
+
void test2(LocalDate date) {
date.getDayOfMonth();
}
@@ -50,13 +50,13 @@ void test2(LocalDate date) {
""",
"""
import java.time.LocalDate;
-
+
class Test {
void test(LocalDate date) {
date.getDayOfMonth();
date.getDayOfYear();
}
-
+
/*~~(dayOfMonth)~~>*/void test2(LocalDate date) {
date.getDayOfMonth();
}
@@ -74,15 +74,15 @@ void mustHaveSelect() {
java(
"""
package animals;
-
+
public class Dog {
String name;
String breed;
-
+
public String getName() {
return getBreed();
}
-
+
public String getBreed() {
return breed;
}
@@ -100,15 +100,15 @@ void mustBeParameter() {
java(
"""
package animals;
-
+
public class Dog {
String name;
String breed;
-
+
public String getName() {
return new Dog().getBreed();
}
-
+
public String getBreed() {
return breed;
}
diff --git a/src/test/java/org/openrewrite/java/migrate/search/FindJavaVersionTest.java b/src/test/java/org/openrewrite/java/migrate/search/FindJavaVersionTest.java
index d83e2760b3..1fd86e2f08 100644
--- a/src/test/java/org/openrewrite/java/migrate/search/FindJavaVersionTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/search/FindJavaVersionTest.java
@@ -43,17 +43,17 @@ void test() {
}),
//language=java
java(
- """
- class A {
- }
- """,
+ """
+ class A {
+ }
+ """,
spec -> spec.markers(jv)),
//language=java
java(
- """
- class B {
- }
- """,
+ """
+ class B {
+ }
+ """,
spec -> spec.markers(jv))
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/IteratorNextTest.java b/src/test/java/org/openrewrite/java/migrate/util/IteratorNextTest.java
index 2d15833f2b..350734fb1f 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/IteratorNextTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/IteratorNextTest.java
@@ -43,7 +43,7 @@ void listIteratorNextToGetFirst() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.iterator().next();
@@ -52,7 +52,7 @@ String bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.getFirst();
@@ -70,7 +70,7 @@ void nonSequencedCollectionUnchanged() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(Collection collection) {
String first = collection.iterator().next();
@@ -88,7 +88,7 @@ void nextCommentLost() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
String first = collection
@@ -100,7 +100,7 @@ void bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
String first = collection
@@ -119,7 +119,7 @@ void iteratorCommentRetained() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
String first = collection
@@ -131,7 +131,7 @@ void bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
String first = collection
diff --git a/src/test/java/org/openrewrite/java/migrate/util/ListFirstAndLastTest.java b/src/test/java/org/openrewrite/java/migrate/util/ListFirstAndLastTest.java
index a5d531ceb5..420bce3a11 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/ListFirstAndLastTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/ListFirstAndLastTest.java
@@ -44,7 +44,7 @@ void getFirst() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.get(0);
@@ -53,7 +53,7 @@ String bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.getFirst();
@@ -72,12 +72,12 @@ void getFirstFromMethodInvocation() {
java(
"""
import java.util.*;
-
+
class Foo {
List collection() {
return new ArrayList<>();
}
-
+
String bar() {
return collection().get(0);
}
@@ -85,12 +85,12 @@ String bar() {
""",
"""
import java.util.*;
-
+
class Foo {
List collection() {
return new ArrayList<>();
}
-
+
String bar() {
return collection().getFirst();
}
@@ -107,7 +107,7 @@ void addFirst() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
collection.add(0, "first");
@@ -116,7 +116,7 @@ void bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
collection.addFirst("first");
@@ -135,7 +135,7 @@ void addFirstFromMethodInvocation() {
java(
"""
import java.util.*;
-
+
class Foo {
List collection() {
return new ArrayList<>();
@@ -147,7 +147,7 @@ void bar() {
""",
"""
import java.util.*;
-
+
class Foo {
List collection() {
return new ArrayList<>();
@@ -168,7 +168,7 @@ void removeFirst() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.remove(0);
@@ -177,7 +177,7 @@ String bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.removeFirst();
@@ -196,12 +196,12 @@ void removeFirstFromMethodInvocation() {
java(
"""
import java.util.*;
-
+
class Foo {
List collection() {
return new ArrayList<>();
}
-
+
String bar() {
return collection().remove(0);
}
@@ -209,12 +209,12 @@ String bar() {
""",
"""
import java.util.*;
-
+
class Foo {
List collection() {
return new ArrayList<>();
}
-
+
String bar() {
return collection().removeFirst();
}
@@ -234,7 +234,7 @@ void getLast() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.get(collection.size() - 1);
@@ -243,7 +243,7 @@ String bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.getLast();
@@ -261,7 +261,7 @@ void removeLast() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.remove(collection.size() - 1);
@@ -270,7 +270,7 @@ String bar(List collection) {
""",
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.removeLast();
@@ -291,7 +291,7 @@ void getSecond() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.get(1);
@@ -309,7 +309,7 @@ void getSecondToLast() {
java(
"""
import java.util.List;
-
+
class Foo {
String bar(List collection) {
return collection.get(collection.size() - 2);
@@ -327,7 +327,7 @@ void getLastOfDifferentCollection() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List a, List b) {
return a.get(b.size() - 1);
@@ -345,7 +345,7 @@ void addInteger() {
java(
"""
import java.util.*;
-
+
class Foo {
String bar(List collection) {
return collection.add(0);
@@ -363,7 +363,7 @@ void addAtSize() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
collection.add(collection.size(), "last");
@@ -381,7 +381,7 @@ void addAtSizeMinusOne() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(List collection) {
collection.add(collection.size() - 1, "last");
diff --git a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonListTest.java b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonListTest.java
index 4333b92c3d..2980448e1f 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonListTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonListTest.java
@@ -69,7 +69,7 @@ interface ConnectionListener {
class A {
public void setConnectionListeners(List extends ConnectionListener> listeners) {
}
-
+
public void test() {
setConnectionListeners(List.of(new ConnectionListener() {
@Override
@@ -91,14 +91,14 @@ void singletonList() {
java(
"""
import java.util.*;
-
+
class Test {
List list = Collections.singletonList("ABC");
}
""",
"""
import java.util.List;
-
+
class Test {
List list = List.of("ABC");
}
@@ -116,14 +116,14 @@ void singletonListStaticImport() {
"""
import java.util.*;
import static java.util.Collections.singletonList;
-
+
class Test {
List list = singletonList("ABC");
}
""",
"""
import java.util.List;
-
+
class Test {
List list = List.of("ABC");
}
@@ -141,7 +141,7 @@ void singletonListCustomType() {
"""
import java.util.*;
import java.time.LocalDate;
-
+
class Test {
List list = Collections.singletonList(LocalDate.now());
}
@@ -149,7 +149,7 @@ class Test {
"""
import java.util.List;
import java.time.LocalDate;
-
+
class Test {
List list = List.of(LocalDate.now());
}
@@ -169,16 +169,16 @@ void lombokAllArgsConstructor() {
"""
import lombok.AllArgsConstructor;
import java.util.List;
-
+
import static java.util.Collections.singletonList;
-
+
enum FooEnum {
FOO, BAR;
-
+
@AllArgsConstructor
public enum BarEnum {
foobar(singletonList(FOO));
-
+
private final List expectedStates;
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonMapTest.java b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonMapTest.java
index 56a5e1f922..2b77863460 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonMapTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonMapTest.java
@@ -39,14 +39,14 @@ void singletonMap() {
java(
"""
import java.util.*;
-
+
class Test {
Map set = Collections.singletonMap("hello", "world");
}
""",
"""
import java.util.Map;
-
+
class Test {
Map set = Map.of("hello", "world");
}
@@ -67,7 +67,7 @@ void singletonMapCustomType() {
"""
import java.util.*;
import java.time.LocalDate;
-
+
class Test {
Map map = Collections.singletonMap("date", LocalDate.now());
}
@@ -75,7 +75,7 @@ class Test {
"""
import java.util.Map;
import java.time.LocalDate;
-
+
class Test {
Map map = Map.of("date", LocalDate.now());
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonSetTest.java b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonSetTest.java
index 2fd195686e..87f89430a7 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonSetTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsSingletonSetTest.java
@@ -39,14 +39,14 @@ void singleTonSet() {
java(
"""
import java.util.*;
-
+
class Test {
Set set = Collections.singleton("Hello");
}
""",
"""
import java.util.Set;
-
+
class Test {
Set set = Set.of("Hello");
}
@@ -67,7 +67,7 @@ void singletonSetCustomType() {
"""
import java.util.*;
import java.time.LocalDate;
-
+
class Test {
Set set = Collections.singleton(LocalDate.now());
}
@@ -75,7 +75,7 @@ class Test {
"""
import java.util.Set;
import java.time.LocalDate;
-
+
class Test {
Set set = Set.of(LocalDate.now());
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableListTest.java b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableListTest.java
index 69e5414e33..f8bac531ee 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableListTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableListTest.java
@@ -39,14 +39,14 @@ void unmodifiableList() {
java(
"""
import java.util.*;
-
+
class Test {
List l = Collections.unmodifiableList(Arrays.asList(1, 2, 3));
}
""",
"""
import java.util.List;
-
+
class Test {
List l = List.of(1, 2, 3);
}
@@ -67,7 +67,7 @@ void unmodifiableListTyped() {
"""
import java.util.*;
import java.time.LocalDate;
-
+
class Test {
List s = Collections.unmodifiableList(Arrays.asList(LocalDate.of(2010,1,1),LocalDate.now()));
}
@@ -75,7 +75,7 @@ class Test {
"""
import java.util.List;
import java.time.LocalDate;
-
+
class Test {
List s = List.of(LocalDate.of(2010, 1, 1), LocalDate.now());
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableSetTest.java b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableSetTest.java
index 43e01c4eb8..5710a9880e 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableSetTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/MigrateCollectionsUnmodifiableSetTest.java
@@ -39,14 +39,14 @@ void unmodifiableSet() {
java(
"""
import java.util.*;
-
+
class Test {
Set s = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(1, 2, 3)));
}
""",
"""
import java.util.Set;
-
+
class Test {
Set s = Set.of(1, 2, 3);
}
@@ -67,7 +67,7 @@ void unmodifiableSetTyped() {
"""
import java.util.*;
import java.time.LocalDate;
-
+
class Test {
Set s = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(LocalDate.of(2010,1,1),LocalDate.now())));
}
@@ -75,7 +75,7 @@ class Test {
"""
import java.util.Set;
import java.time.LocalDate;
-
+
class Test {
Set s = Set.of(LocalDate.of(2010, 1, 1), LocalDate.now());
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/OptionalStreamRecipeTest.java b/src/test/java/org/openrewrite/java/migrate/util/OptionalStreamRecipeTest.java
index e81101f1f8..58e5f6304e 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/OptionalStreamRecipeTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/OptionalStreamRecipeTest.java
@@ -39,7 +39,7 @@ void basic_case() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
var x = Stream.of(Optional.empty())
@@ -51,7 +51,7 @@ public void foo() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
var x = Stream.of(Optional.empty())
@@ -70,7 +70,7 @@ void twice() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
var x = Stream.of(Optional.empty())
@@ -86,7 +86,7 @@ public void foo() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
var x = Stream.of(Optional.empty())
@@ -108,7 +108,7 @@ void without_assignment() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
Stream.of(Optional.empty())
@@ -120,7 +120,7 @@ public void foo() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
Stream.of(Optional.empty())
@@ -139,7 +139,7 @@ void oneliner() {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {Stream.of(Optional.empty()).filter(Optional::isPresent).map(Optional::get);}
}
@@ -147,7 +147,7 @@ class Scratch {
"""
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {Stream.of(Optional.empty()).flatMap(Optional::stream);}
}
@@ -164,7 +164,7 @@ void with_toList() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(17)
@@ -179,7 +179,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(17)
@@ -200,7 +200,7 @@ void with_toList2() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -214,7 +214,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -235,7 +235,7 @@ void with_comment() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -250,7 +250,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -272,7 +272,7 @@ void with_comment_after() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -287,7 +287,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -309,7 +309,7 @@ void with_comment_in_the_middle() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -324,7 +324,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -346,7 +346,7 @@ void with_multiple_coments() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -359,7 +359,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -380,7 +380,7 @@ void with_block_comment() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -395,7 +395,7 @@ public void foo() {
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
final List list = Stream.of(Optional.empty())
@@ -415,7 +415,7 @@ void dont_match_different_optional() {
java(
"""
import java.util.stream.Stream;
-
+
class Scratch {
public void foo() {
var x = Stream.of(Optional.empty())
diff --git a/src/test/java/org/openrewrite/java/migrate/util/RemoveFinalizerFromZipTest.java b/src/test/java/org/openrewrite/java/migrate/util/RemoveFinalizerFromZipTest.java
index 82e21ad3e2..e970062a9e 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/RemoveFinalizerFromZipTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/RemoveFinalizerFromZipTest.java
@@ -45,7 +45,7 @@ public void test() {
obj.finalize();
}
}
- """, """
+ """, """
import java.util.zip.Inflater;
class FooInflater extends Inflater {
@@ -53,7 +53,7 @@ public void test() {
FooInflater obj = new FooInflater();
}
}
- """));
+ """));
}
@Test
@@ -67,14 +67,14 @@ public void test() {
finalize();
}
}
- """, """
+ """, """
import java.util.zip.Inflater;
class FooBar extends Inflater {
public void test() {
}
}
- """));
+ """));
}
@Test
@@ -88,14 +88,14 @@ public void test() {
this.finalize();
}
}
- """, """
+ """, """
import java.util.zip.Inflater;
class FooBar extends Inflater {
public void test() {
}
}
- """));
+ """));
}
@Test
@@ -109,7 +109,7 @@ public void test() {
new FooBar().finalize();
}
}
- """, """
+ """, """
import java.util.zip.Inflater;
class FooBar extends Inflater {
@@ -117,7 +117,7 @@ public void test() {
new FooBar();
}
}
- """));
+ """));
}
@Test
@@ -131,7 +131,7 @@ public void test() {
new Object().finalize();
}
}
- """));
+ """));
}
@Test
@@ -145,7 +145,7 @@ public void test() {
FooBar obj = new FooBar();
}
}
- """));
+ """));
}
@Test
@@ -160,7 +160,7 @@ public void test() {
obj.finalize();
}
}
- """, """
+ """, """
import java.util.zip.Deflater;
class FooBar extends Deflater {
@@ -168,7 +168,7 @@ public void test() {
FooBar obj = new FooBar();
}
}
- """));
+ """));
}
@Test
@@ -182,7 +182,7 @@ public void test() {
FooBar obj = new FooBar();
}
}
- """));
+ """));
}
@Test
@@ -200,7 +200,7 @@ public void test() {
obj.finalize();
}
}
- """, """
+ """, """
import java.util.zip.ZipFile;
class FooBar extends ZipFile {
@@ -211,7 +211,7 @@ public void test() {
FooBar obj = new FooBar();
}
}
- """));
+ """));
}
@Test
@@ -228,7 +228,7 @@ public void test() {
FooBar obj = new FooBar();
}
}
- """));
+ """));
}
@Test
@@ -240,7 +240,7 @@ public void test() {
new Object().finalize();
}
}
- """));
+ """));
}
@Test
@@ -252,7 +252,7 @@ public void test() {
finalize();
}
}
- """));
+ """));
}
@Test
@@ -260,7 +260,7 @@ void noChangeOnJava11() {
//language=java
rewriteRun(version(java("""
import java.util.zip.ZipFile;
-
+
class FooBar extends ZipFile {
FooBar(){
super("");
@@ -269,6 +269,6 @@ public void test() {
finalize();
}
}
- """), 11));
+ """), 11));
}
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/SequencedCollectionTest.java b/src/test/java/org/openrewrite/java/migrate/util/SequencedCollectionTest.java
index 1d677d17b6..abc1d38cd8 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/SequencedCollectionTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/SequencedCollectionTest.java
@@ -43,7 +43,7 @@ void firstToGetFirst() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(SortedSet collection) {
String first = collection.first();
@@ -53,7 +53,7 @@ void bar(SortedSet collection) {
""",
"""
import java.util.*;
-
+
class Foo {
void bar(SortedSet collection) {
String first = collection.getFirst();
@@ -75,7 +75,7 @@ void descendingSetToReversed() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(NavigableSet collection) {
NavigableSet reversed = collection.descendingSet();
@@ -84,7 +84,7 @@ void bar(NavigableSet collection) {
""",
"""
import java.util.*;
-
+
class Foo {
void bar(NavigableSet collection) {
NavigableSet reversed = collection.reversed();
diff --git a/src/test/java/org/openrewrite/java/migrate/util/StreamFindFirstTest.java b/src/test/java/org/openrewrite/java/migrate/util/StreamFindFirstTest.java
index 1f6823f1ca..c8e839b6da 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/StreamFindFirstTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/StreamFindFirstTest.java
@@ -44,7 +44,7 @@ void sequencedCollection() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(SequencedCollection collection) {
String first = collection.stream().findFirst().orElseThrow();
@@ -53,7 +53,7 @@ void bar(SequencedCollection collection) {
""",
"""
import java.util.*;
-
+
class Foo {
void bar(SequencedCollection collection) {
String first = collection.getFirst();
@@ -71,7 +71,7 @@ void regularCollection() {
java(
"""
import java.util.*;
-
+
class Foo {
void bar(Collection collection) {
String first = collection.stream().findFirst().orElseThrow();
diff --git a/src/test/java/org/openrewrite/java/migrate/util/UseLocaleOfTest.java b/src/test/java/org/openrewrite/java/migrate/util/UseLocaleOfTest.java
index a4ecbbbf26..efb1ef65f0 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/UseLocaleOfTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/UseLocaleOfTest.java
@@ -38,24 +38,24 @@ void localeOf() {
spec -> spec.typeValidationOptions(TypeValidation.none()),
version(
java(
- """
- import java.util.Locale;
-
- class Test {
- Locale locale1 = new Locale("english");
- Locale locale2 = new Locale("english", "us");
- Locale locale3 = new Locale("english", "us", "");
- }
- """,
- """
- import java.util.Locale;
-
- class Test {
- Locale locale1 = Locale.of("english");
- Locale locale2 = Locale.of("english", "us");
- Locale locale3 = Locale.of("english", "us", "");
- }
"""
+ import java.util.Locale;
+
+ class Test {
+ Locale locale1 = new Locale("english");
+ Locale locale2 = new Locale("english", "us");
+ Locale locale3 = new Locale("english", "us", "");
+ }
+ """,
+ """
+ import java.util.Locale;
+
+ class Test {
+ Locale locale1 = Locale.of("english");
+ Locale locale2 = Locale.of("english", "us");
+ Locale locale3 = Locale.of("english", "us", "");
+ }
+ """
), 19)
);
}
diff --git a/src/test/java/org/openrewrite/java/migrate/util/UseMapOfTest.java b/src/test/java/org/openrewrite/java/migrate/util/UseMapOfTest.java
index 39a5d00ce8..9213828023 100644
--- a/src/test/java/org/openrewrite/java/migrate/util/UseMapOfTest.java
+++ b/src/test/java/org/openrewrite/java/migrate/util/UseMapOfTest.java
@@ -40,7 +40,7 @@ void anonymousClass() {
"""
import java.util.HashMap;
import java.util.Map;
-
+
class Test {
Map m = new HashMap<>() {{
put("stru", "menta");
@@ -50,7 +50,7 @@ class Test {
""",
"""
import java.util.Map;
-
+
class Test {
Map m = Map.of("stru", "menta", "mod", "erne");
}