From 4ca0c8ec3d292d32a1db5017124b8112a9d32d12 Mon Sep 17 00:00:00 2001 From: Jonathan Schneider Date: Tue, 24 Dec 2024 23:19:16 +0100 Subject: [PATCH] Add more scenarios to JavaTypeGoat for simply typed fields and methods that return exceptions. --- .../src/main/java/org/openrewrite/java/JavaTypeGoat.java | 6 ++++++ rewrite-java-test/src/main/resources/JavaTypeGoat.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/rewrite-java-test/src/main/java/org/openrewrite/java/JavaTypeGoat.java b/rewrite-java-test/src/main/java/org/openrewrite/java/JavaTypeGoat.java index a32c6df44c4..8e8abd6fe37 100644 --- a/rewrite-java-test/src/main/java/org/openrewrite/java/JavaTypeGoat.java +++ b/rewrite-java-test/src/main/java/org/openrewrite/java/JavaTypeGoat.java @@ -15,6 +15,7 @@ */ package org.openrewrite.java; +import java.io.FileNotFoundException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -25,6 +26,8 @@ public abstract class JavaTypeGoat & C> { public static final PT parameterizedField = new PT() { }; + public static final Double PI = 3.14; + public static final double PI_PRIMITIVE = 3.14; public static abstract class InheritedJavaTypeGoat & C> extends JavaTypeGoat { public InheritedJavaTypeGoat() { @@ -73,6 +76,9 @@ public static class TypeB {} public abstract & C> U genericIntersection(U n); public abstract T genericT(T n); // remove after signatures are common. public abstract & Intersection> void recursiveIntersection(U n); + public abstract T nameShadow(T t); + public abstract void throwsException() throws FileNotFoundException; + public abstract void throwsGenericException() throws T, InterruptedException; } interface C { diff --git a/rewrite-java-test/src/main/resources/JavaTypeGoat.java b/rewrite-java-test/src/main/resources/JavaTypeGoat.java index 61953059cab..40e1696a15a 100644 --- a/rewrite-java-test/src/main/resources/JavaTypeGoat.java +++ b/rewrite-java-test/src/main/resources/JavaTypeGoat.java @@ -15,6 +15,7 @@ */ package org.openrewrite.java; +import java.io.FileNotFoundException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -25,6 +26,8 @@ public abstract class JavaTypeGoat & C> { public static final PT parameterizedField = new PT() { }; + public static final Double PI = 3.14; + public static final double PI_PRIMITIVE = 3.14; public static abstract class InheritedJavaTypeGoat & C> extends JavaTypeGoat { public InheritedJavaTypeGoat() { @@ -73,6 +76,9 @@ public static class TypeB {} public abstract & C> U genericIntersection(U n); public abstract T genericT(T n); // remove after signatures are common. public abstract & Intersection> void recursiveIntersection(U n); + public abstract T nameShadow(T t); + public abstract void throwsException() throws FileNotFoundException; + public abstract void throwsGenericException() throws T, InterruptedException; } interface C {