Skip to content

Commit 3f40a7e

Browse files
committed
Update @⁠since/@⁠API versions in Reflection[Support|Utils] plus polishing
1 parent 5fd9e88 commit 3f40a7e

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static Try<Class<?>> tryToLoadClass(String name, ClassLoader classLoader)
116116
}
117117

118118
/**
119-
* Tries to get the {@linkplain Resource resources} for the supplied classpath
119+
* Try to get the {@linkplain Resource resources} for the supplied classpath
120120
* resource name.
121121
*
122122
* <p>The name of a <em>classpath resource</em> must follow the semantics
@@ -130,15 +130,16 @@ public static Try<Class<?>> tryToLoadClass(String name, ClassLoader classLoader)
130130
* @return a successful {@code Try} containing the loaded resources or a failed
131131
* {@code Try} containing the exception if no such resources could be loaded;
132132
* never {@code null}
133-
* @since 1.11
133+
* @since 1.12
134+
* @see #tryToGetResources(String, ClassLoader)
134135
*/
135136
@API(status = EXPERIMENTAL, since = "1.12")
136137
public static Try<Set<Resource>> tryToGetResources(String classpathResourceName) {
137138
return ReflectionUtils.tryToGetResources(classpathResourceName);
138139
}
139140

140141
/**
141-
* Tries to load the {@linkplain Resource resources} for the supplied classpath
142+
* Try to load the {@linkplain Resource resources} for the supplied classpath
142143
* resource name, using the supplied {@link ClassLoader}.
143144
*
144145
* <p>The name of a <em>classpath resource</em> must follow the semantics
@@ -153,7 +154,8 @@ public static Try<Set<Resource>> tryToGetResources(String classpathResourceName)
153154
* @return a successful {@code Try} containing the loaded resources or a failed
154155
* {@code Try} containing the exception if no such resources could be loaded;
155156
* never {@code null}
156-
* @since 1.11
157+
* @since 1.12
158+
* @see #tryToGetResources(String)
157159
*/
158160
@API(status = EXPERIMENTAL, since = "1.12")
159161
public static Try<Set<Resource>> tryToGetResources(String classpathResourceName, ClassLoader classLoader) {
@@ -201,7 +203,6 @@ public static List<Class<?>> findAllClassesInClasspathRoot(URI root, Predicate<C
201203
*/
202204
@API(status = EXPERIMENTAL, since = "1.11")
203205
public static List<Resource> findAllResourcesInClasspathRoot(URI root, Predicate<Resource> resourceFilter) {
204-
205206
return ReflectionUtils.findAllResourcesInClasspathRoot(root, resourceFilter);
206207
}
207208

@@ -248,7 +249,6 @@ public static Stream<Class<?>> streamAllClassesInClasspathRoot(URI root, Predica
248249
*/
249250
@API(status = EXPERIMENTAL, since = "1.11")
250251
public static Stream<Resource> streamAllResourcesInClasspathRoot(URI root, Predicate<Resource> resourceFilter) {
251-
252252
return ReflectionUtils.streamAllResourcesInClasspathRoot(root, resourceFilter);
253253
}
254254

@@ -296,7 +296,6 @@ public static List<Class<?>> findAllClassesInPackage(String basePackageName, Pre
296296
*/
297297
@API(status = EXPERIMENTAL, since = "1.11")
298298
public static List<Resource> findAllResourcesInPackage(String basePackageName, Predicate<Resource> resourceFilter) {
299-
300299
return ReflectionUtils.findAllResourcesInPackage(basePackageName, resourceFilter);
301300
}
302301

@@ -370,6 +369,7 @@ public static Stream<Resource> streamAllResourcesInPackage(String basePackageNam
370369
* @see #findAllClassesInClasspathRoot(URI, Predicate, Predicate)
371370
* @see #findAllClassesInPackage(String, Predicate, Predicate)
372371
*/
372+
@API(status = MAINTAINED, since = "1.1.1")
373373
public static List<Class<?>> findAllClassesInModule(String moduleName, Predicate<Class<?>> classFilter,
374374
Predicate<String> classNameFilter) {
375375

@@ -394,7 +394,6 @@ public static List<Class<?>> findAllClassesInModule(String moduleName, Predicate
394394
*/
395395
@API(status = EXPERIMENTAL, since = "1.11")
396396
public static List<Resource> findAllResourcesInModule(String moduleName, Predicate<Resource> resourceFilter) {
397-
398397
return ReflectionUtils.findAllResourcesInModule(moduleName, resourceFilter);
399398
}
400399

@@ -441,7 +440,6 @@ public static Stream<Class<?>> streamAllClassesInModule(String moduleName, Predi
441440
*/
442441
@API(status = EXPERIMENTAL, since = "1.11")
443442
public static Stream<Resource> streamAllResourcesInModule(String moduleName, Predicate<Resource> resourceFilter) {
444-
445443
return ReflectionUtils.streamAllResourcesInModule(moduleName, resourceFilter);
446444
}
447445

@@ -711,10 +709,10 @@ public static Stream<Class<?>> streamNestedClasses(Class<?> clazz, Predicate<Cla
711709
*
712710
* @param field the field to make accessible; never {@code null}
713711
* @return the supplied field
714-
* @since 1.11.1
712+
* @since 1.12
715713
* @see Field#setAccessible(boolean)
716714
*/
717-
@API(status = EXPERIMENTAL, since = "1.11.1")
715+
@API(status = EXPERIMENTAL, since = "1.12")
718716
public static Field makeAccessible(Field field) {
719717
return ReflectionUtils.makeAccessible(Preconditions.notNull(field, "field must not be null"));
720718
}

junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2011,7 +2011,7 @@ public static <T extends Executable> T makeAccessible(T executable) {
20112011
return executable;
20122012
}
20132013

2014-
@API(status = INTERNAL, since = "1.11")
2014+
@API(status = INTERNAL, since = "1.12")
20152015
@SuppressWarnings("deprecation") // "AccessibleObject.isAccessible()" is deprecated in Java 9
20162016
public static Field makeAccessible(Field field) {
20172017
if ((!isPublic(field) || !isPublic(field.getDeclaringClass()) || isFinal(field)) && !field.isAccessible()) {

0 commit comments

Comments
 (0)