Skip to content

Commit 852212d

Browse files
committed
Polishing
1 parent 46e0484 commit 852212d

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

spring-beans/src/test/java/org/springframework/tests/beans/CollectingReaderEventListener.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,20 +36,21 @@
3636
*/
3737
public class CollectingReaderEventListener implements ReaderEventListener {
3838

39-
private final List defaults = new LinkedList();
39+
private final List<DefaultsDefinition> defaults = new LinkedList<>();
4040

41-
private final Map componentDefinitions = new LinkedHashMap<>(8);
41+
private final Map<String, ComponentDefinition> componentDefinitions = new LinkedHashMap<>(8);
4242

43-
private final Map aliasMap = new LinkedHashMap<>(8);
43+
private final Map<String, List<AliasDefinition>> aliasMap = new LinkedHashMap<>(8);
44+
45+
private final List<ImportDefinition> imports = new LinkedList<>();
4446

45-
private final List imports = new LinkedList();
4647

4748
@Override
4849
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
4950
this.defaults.add(defaultsDefinition);
5051
}
5152

52-
public List getDefaults() {
53+
public List<DefaultsDefinition> getDefaults() {
5354
return Collections.unmodifiableList(this.defaults);
5455
}
5556

@@ -59,35 +60,35 @@ public void componentRegistered(ComponentDefinition componentDefinition) {
5960
}
6061

6162
public ComponentDefinition getComponentDefinition(String name) {
62-
return (ComponentDefinition) this.componentDefinitions.get(name);
63+
return this.componentDefinitions.get(name);
6364
}
6465

6566
public ComponentDefinition[] getComponentDefinitions() {
66-
Collection collection = this.componentDefinitions.values();
67-
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]);
67+
Collection<ComponentDefinition> collection = this.componentDefinitions.values();
68+
return collection.toArray(new ComponentDefinition[collection.size()]);
6869
}
6970

7071
@Override
7172
public void aliasRegistered(AliasDefinition aliasDefinition) {
72-
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
73+
List<AliasDefinition> aliases = this.aliasMap.get(aliasDefinition.getBeanName());
7374
if (aliases == null) {
74-
aliases = new ArrayList();
75+
aliases = new ArrayList<>();
7576
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
7677
}
7778
aliases.add(aliasDefinition);
7879
}
7980

80-
public List getAliases(String beanName) {
81-
List aliases = (List) this.aliasMap.get(beanName);
82-
return aliases == null ? null : Collections.unmodifiableList(aliases);
81+
public List<AliasDefinition> getAliases(String beanName) {
82+
List<AliasDefinition> aliases = this.aliasMap.get(beanName);
83+
return (aliases != null ? Collections.unmodifiableList(aliases) : null);
8384
}
8485

8586
@Override
8687
public void importProcessed(ImportDefinition importDefinition) {
8788
this.imports.add(importDefinition);
8889
}
8990

90-
public List getImports() {
91+
public List<ImportDefinition> getImports() {
9192
return Collections.unmodifiableList(this.imports);
9293
}
9394

spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,9 @@ public boolean equals(Object obj) {
702702
public int hashCode() {
703703
return getPath().hashCode();
704704
}
705-
706705
}
707706

707+
708708
/**
709709
* Represents a path backed by a string list (i.e. path segments).
710710
*/
@@ -883,6 +883,7 @@ public int hashCode() {
883883
}
884884
};
885885

886+
886887
private static class QueryUriTemplateVariables implements UriTemplateVariables {
887888

888889
private final UriTemplateVariables delegate;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.net.URLDecoder;
2121
import java.util.ArrayList;
2222
import java.util.List;
23-
2423
import javax.servlet.ServletException;
2524
import javax.servlet.http.HttpServletRequest;
2625
import javax.servlet.http.HttpServletResponse;
@@ -224,7 +223,7 @@ public void afterPropertiesSet() throws Exception {
224223
if (this.contentNegotiationManager == null) {
225224
this.contentNegotiationManager = initContentNegotiationManager();
226225
}
227-
if ( this.resourceHttpMessageConverter == null) {
226+
if (this.resourceHttpMessageConverter == null) {
228227
this.resourceHttpMessageConverter = new ResourceHttpMessageConverter();
229228
}
230229
}

0 commit comments

Comments
 (0)