Skip to content

Commit 39bead9

Browse files
committed
Reduce public API footprint for new class
1 parent da8fb28 commit 39bead9

File tree

3 files changed

+5
-36
lines changed

3 files changed

+5
-36
lines changed

src/changes/changes.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ The <action> type attribute can be add,update,fix,remove.
110110
<action dev="ggregory" type="fix" due-to="Gary Gregory">Use generics internally.</action>
111111
<action dev="ggregory" type="fix" due-to="Gary Gregory">NodeSet.getPointers() is now typed with generics.</action>
112112
<action dev="ggregory" type="fix" due-to="Gary Gregory">ServletContextHandler.collectPropertyNames(HashSet, Object) is now typed with generics.</action>
113-
<action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate ClassLoaderUtil.ClassLoaderUtil().</action>
114113
<action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate MethodLookupUtils.MethodLookupUtils().</action>
115114
<action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate KeyManagerUtils.KeyManagerUtils().</action>
116115
<action dev="ggregory" type="fix" due-to="Gary Gregory">Deprecate TypeUtils.TypeUtils().</action>

src/main/java/org/apache/commons/jxpath/JXPathIntrospector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private static Object instantiate(final Class sibling, final String className) t
166166
}
167167
}
168168
// Now try the ClassLoaderUtil.
169-
return ClassLoaderUtil.getClass(className).newInstance();
169+
return ClassLoaderUtil.getClass(className, true).newInstance();
170170
}
171171

172172
/**

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

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
* context class loader results in a {@code java.lang.ClassNotFoundException}.
2828
*
2929
* See org.apache.commons.lang3.ClassUtils
30+
* @since 1.4.0
3031
*/
31-
public class ClassLoaderUtil {
32+
public final class ClassLoaderUtil {
3233

3334
/**
3435
* Maps a primitive class name to its corresponding abbreviation used in array class names.
@@ -58,21 +59,6 @@ private static void addAbbreviation(final String primitive, final String abbrevi
5859
abbreviationMap.put(primitive, abbreviation);
5960
}
6061

61-
/**
62-
* Returns the (initialized) class represented by {@code className} using the {@code classLoader}. This implementation supports names like
63-
* "{@code java.lang.String[]}" as well as "{@code [Ljava.lang.String;}".
64-
*
65-
* @param <T> The expected class type.
66-
* @param classLoader the class loader to use to load the class
67-
* @param className the class name
68-
* @return the class represented by {@code className} using the {@code classLoader}
69-
* @throws ClassNotFoundException if the class is not found
70-
*/
71-
public static <T> Class<T> getClass(final ClassLoader classLoader, final String className) throws ClassNotFoundException {
72-
return getClass(classLoader, className, true);
73-
}
74-
75-
// Class loading
7662
/**
7763
* Returns the class represented by {@code className} using the {@code classLoader}. This implementation supports names like "{@code java.lang.String[]}" as
7864
* well as "{@code [Ljava.lang.String;}".
@@ -85,7 +71,7 @@ public static <T> Class<T> getClass(final ClassLoader classLoader, final String
8571
* @throws ClassNotFoundException if the class is not found
8672
*/
8773
@SuppressWarnings("unchecked") // assume the call site knows what it's doing.
88-
public static <T> Class<T> getClass(final ClassLoader classLoader, final String className, final boolean initialize) throws ClassNotFoundException {
74+
private static <T> Class<T> getClass(final ClassLoader classLoader, final String className, final boolean initialize) throws ClassNotFoundException {
8975
Class<T> clazz;
9076
if (abbreviationMap.containsKey(className)) {
9177
final String clsName = "[" + abbreviationMap.get(className);
@@ -96,19 +82,6 @@ public static <T> Class<T> getClass(final ClassLoader classLoader, final String
9682
return clazz;
9783
}
9884

99-
/**
100-
* Returns the (initialized) class represented by {@code className} using the current thread's context class loader. This implementation supports names like
101-
* "{@code java.lang.String[]}" as well as "{@code [Ljava.lang.String;}".
102-
*
103-
* @param <T> The expected class type.
104-
* @param className the class name
105-
* @return the class represented by {@code className} using the current thread's context class loader
106-
* @throws ClassNotFoundException if the class is not found
107-
*/
108-
public static <T> Class<T> getClass(final String className) throws ClassNotFoundException {
109-
return getClass(className, true);
110-
}
111-
11285
/**
11386
* Returns the class represented by {@code className} using the current thread's context class loader. This implementation supports names like
11487
* "{@code java.lang.String[]}" as well as "{@code [Ljava.lang.String;}".
@@ -159,11 +132,8 @@ private static String toCanonicalName(String className) {
159132

160133
/**
161134
* Constructs a new instance.
162-
*
163-
* @deprecated Constructor will be private in the next major version.
164135
*/
165-
@Deprecated
166-
public ClassLoaderUtil() {
136+
private ClassLoaderUtil() {
167137
// empty
168138
}
169139
}

0 commit comments

Comments
 (0)