Skip to content

Commit 4726f9d

Browse files
author
Vincent Potucek
committed
Pull spring-projects#34809: RemoveUnusedPrivateFields
1 parent 838b4d6 commit 4726f9d

File tree

5 files changed

+30
-10
lines changed

5 files changed

+30
-10
lines changed

init.gradle

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
initscript {
2+
repositories {
3+
maven { url "https://plugins.gradle.org/m2" }
4+
}
5+
dependencies { classpath("org.openrewrite:plugin:7.2.1") }
6+
}
7+
rootProject {
8+
plugins.apply(org.openrewrite.gradle.RewritePlugin)
9+
dependencies {
10+
rewrite("org.openrewrite.recipe:rewrite-migrate-java:3.4.0")
11+
}
12+
rewrite {
13+
// activeRecipe("org.openrewrite.java.migrate.UpgradeToJava17")
14+
// activeRecipe("org.openrewrite.java.migrate.UpgradeToJava21")
15+
// activeRecipe("org.openrewrite.java.migrate.lang.var.UseVarForObject")
16+
// activeRecipe("org.openrewrite.java.migrate.lang.var.UseVarForPrimitive")
17+
// activeRecipe("org.openrewrite.staticanalysis.FinalizeLocalVariables")
18+
// activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedLocalVariables")
19+
activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedPrivateFields")
20+
// activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods")
21+
setExportDatatables(true)
22+
}
23+
afterEvaluate {
24+
if (repositories.isEmpty()) {
25+
repositories {
26+
mavenCentral()
27+
}
28+
}
29+
}
30+
}

spring-core/src/test/java/org/springframework/core/BridgeMethodResolverTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,6 @@ public static class GenericBroadcasterImpl implements Broadcaster {
802802
public abstract static class GenericEventBroadcasterImpl<T extends Event>
803803
extends GenericBroadcasterImpl implements EventBroadcaster {
804804

805-
private Class<T>[] subscribingEvents;
806-
807805
private Channel<T> channel;
808806

809807
/**

spring-expression/src/test/java/org/springframework/expression/spel/testresources/Inventor.java

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class Inventor {
3737
public String publicName;
3838
private PlaceOfBirth placeOfBirth;
3939
private Date birthdate;
40-
private int sinNumber;
4140
private String nationality;
4241
private String[] inventions;
4342
public String randomField;

spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java

-4
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,11 @@ public jakarta.xml.bind.Unmarshaller createUnmarshaller() {
377377
@XmlRootElement
378378
@SuppressWarnings("unused")
379379
public static class DummyRootElement {
380-
381-
private DummyType t = new DummyType();
382380
}
383381

384382
@XmlType
385383
@SuppressWarnings("unused")
386384
public static class DummyType {
387-
388-
private String s = "Hello";
389385
}
390386

391387
@SuppressWarnings("unused")

spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java

-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import org.springframework.util.StringUtils;
5454
import org.springframework.util.StringValueResolver;
5555
import org.springframework.web.HttpRequestHandler;
56-
import org.springframework.web.accept.ContentNegotiationManager;
5756
import org.springframework.web.context.request.ServletWebRequest;
5857
import org.springframework.web.context.support.ServletContextResource;
5958
import org.springframework.web.cors.CorsConfiguration;
@@ -123,8 +122,6 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
123122

124123
private @Nullable ResourceRegionHttpMessageConverter resourceRegionHttpMessageConverter;
125124

126-
private @Nullable ContentNegotiationManager contentNegotiationManager;
127-
128125
private final Map<String, MediaType> mediaTypes = new HashMap<>(4);
129126

130127
private @Nullable CorsConfiguration corsConfiguration;

0 commit comments

Comments
 (0)