Skip to content

Commit 128d4d3

Browse files
committed
Use generics internally
1 parent 55f4ec9 commit 128d4d3

File tree

5 files changed

+21
-24
lines changed

5 files changed

+21
-24
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<commons.osgi.import>*;resolution:=optional</commons.osgi.import>
5858
<!-- JaCoCo: Don't make code coverage worse than: -->
5959
<commons.jacoco.haltOnFailure>true</commons.jacoco.haltOnFailure>
60-
<commons.jacoco.classRatio>0.92</commons.jacoco.classRatio>
60+
<commons.jacoco.classRatio>0.91</commons.jacoco.classRatio>
6161
<commons.jacoco.instructionRatio>0.74</commons.jacoco.instructionRatio>
6262
<commons.jacoco.methodRatio>0.82</commons.jacoco.methodRatio>
6363
<commons.jacoco.branchRatio>0.68</commons.jacoco.branchRatio>

src/main/java/org/apache/commons/jxpath/servlet/PageContextHandler.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,24 @@ public Object getProperty(final Object pageContext, final String property) {
4343

4444
@Override
4545
public String[] getPropertyNames(final Object pageContext) {
46-
final HashSet list = new HashSet();
47-
Enumeration e = ((PageContext) pageContext).getAttributeNamesInScope(PageContext.PAGE_SCOPE);
46+
final HashSet<String> set = new HashSet<>();
47+
Enumeration<String> e = ((PageContext) pageContext).getAttributeNamesInScope(PageContext.PAGE_SCOPE);
4848
while (e.hasMoreElements()) {
49-
list.add(e.nextElement());
49+
set.add(e.nextElement());
5050
}
5151
e = ((PageContext) pageContext).getAttributeNamesInScope(PageContext.REQUEST_SCOPE);
5252
while (e.hasMoreElements()) {
53-
list.add(e.nextElement());
53+
set.add(e.nextElement());
5454
}
5555
e = ((PageContext) pageContext).getAttributeNamesInScope(PageContext.SESSION_SCOPE);
5656
while (e.hasMoreElements()) {
57-
list.add(e.nextElement());
57+
set.add(e.nextElement());
5858
}
5959
e = ((PageContext) pageContext).getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
6060
while (e.hasMoreElements()) {
61-
list.add(e.nextElement());
61+
set.add(e.nextElement());
6262
}
63-
return (String[]) list.toArray(new String[list.size()]);
63+
return set.toArray(new String[set.size()]);
6464
}
6565

6666
@Override

src/main/java/org/apache/commons/jxpath/util/ClassLoaderUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class ClassLoaderUtil {
3333
/**
3434
* Maps a primitive class name to its corresponding abbreviation used in array class names.
3535
*/
36-
private static Map abbreviationMap = new HashMap();
36+
private static Map<String, String> abbreviationMap = new HashMap<>();
3737
/**
3838
* Feed abbreviation maps
3939
*/

src/main/java/org/apache/commons/jxpath/util/TypeUtils.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,17 @@
2525
public class TypeUtils {
2626

2727
private static TypeConverter typeConverter = new BasicTypeConverter();
28-
private static final HashMap PRIMITIVE_TYPE_MAP = new HashMap() {
29-
30-
private static final long serialVersionUID = 1L;
31-
{
32-
put(int.class, Integer.class);
33-
put(byte.class, Byte.class);
34-
put(short.class, Short.class);
35-
put(char.class, Character.class);
36-
put(long.class, Long.class);
37-
put(float.class, Float.class);
38-
put(double.class, Double.class);
39-
put(boolean.class, Boolean.class);
40-
}
41-
};
28+
private static final HashMap<Class, Class> PRIMITIVE_TYPE_MAP = new HashMap<>();
29+
static {
30+
PRIMITIVE_TYPE_MAP.put(int.class, Integer.class);
31+
PRIMITIVE_TYPE_MAP.put(byte.class, Byte.class);
32+
PRIMITIVE_TYPE_MAP.put(short.class, Short.class);
33+
PRIMITIVE_TYPE_MAP.put(char.class, Character.class);
34+
PRIMITIVE_TYPE_MAP.put(long.class, Long.class);
35+
PRIMITIVE_TYPE_MAP.put(float.class, Float.class);
36+
PRIMITIVE_TYPE_MAP.put(double.class, Double.class);
37+
PRIMITIVE_TYPE_MAP.put(boolean.class, Boolean.class);
38+
}
4239

4340
/**
4441
* Returns true if the global converter can convert the supplied object to the specified type.

src/main/java/org/apache/commons/jxpath/util/ValueUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
public class ValueUtils {
4242

43-
private static Map dynamicPropertyHandlerMap = new HashMap();
43+
private static Map<Class, DynamicPropertyHandler> dynamicPropertyHandlerMap = new HashMap<>();
4444
private static final int UNKNOWN_LENGTH_MAX_COUNT = 16000;
4545

4646
/**

0 commit comments

Comments
 (0)