Skip to content

Commit

Permalink
Typographic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Dec 30, 2023
1 parent f4a6fc2 commit b766921
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public AnnotationParameterException(final Annotation annotation, final String me
* @return The {@link Annotation} that is the subject of this exception.
*/
public Annotation annotation() {
return this.annotation;
return annotation;
}
}
15 changes: 5 additions & 10 deletions src/main/java/org/libj/lang/Classes.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,7 @@ public static Field getDeclaredFieldDeep(Class<?> cls, final String name) {
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getConstructor(final Class<T> cls, final Class<?> ... parameterTypes) {
final Constructor<?>[] constructors = cls.getConstructors();
for (final Constructor<?> constructor : constructors) // [A]
for (final Constructor<?> constructor : cls.getConstructors()) // [A]
if (isMatch(constructor, parameterTypes))
return (Constructor<T>)constructor;

Expand All @@ -688,8 +687,7 @@ public static <T> Constructor<T> getConstructor(final Class<T> cls, final Class<
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getConstructor(final Class<T> cls) {
final Constructor<?>[] constructors = cls.getConstructors();
for (final Constructor<?> constructor : constructors) // [A]
for (final Constructor<?> constructor : cls.getConstructors()) // [A]
if (constructor.getParameterCount() == 0)
return (Constructor<T>)constructor;

Expand Down Expand Up @@ -717,8 +715,7 @@ public static <T> Constructor<T> getConstructor(final Class<T> cls) {
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getCompatibleConstructor(final Class<T> cls, final Class<?> ... parameterTypes) {
final Constructor<?>[] constructors = cls.getConstructors();
for (final Constructor<?> constructor : constructors) // [A]
for (final Constructor<?> constructor : cls.getConstructors()) // [A]
if (isCompatible(constructor.getParameterTypes(), parameterTypes))
return (Constructor<T>)constructor;

Expand Down Expand Up @@ -748,8 +745,7 @@ public static <T> Constructor<T> getCompatibleConstructor(final Class<T> cls, fi
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getDeclaredConstructor(final Class<T> cls, final Class<?> ... parameterTypes) {
final Constructor<?>[] constructors = cls.getDeclaredConstructors();
for (final Constructor<?> constructor : constructors) // [A]
for (final Constructor<?> constructor : cls.getDeclaredConstructors()) // [A]
if (isMatch(constructor, parameterTypes))
return (Constructor<T>)constructor;

Expand Down Expand Up @@ -778,8 +774,7 @@ public static <T> Constructor<T> getDeclaredConstructor(final Class<T> cls, fina
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getDeclaredConstructor(final Class<T> cls) {
final Constructor<?>[] constructors = cls.getDeclaredConstructors();
for (final Constructor<?> constructor : constructors) // [A]
for (final Constructor<?> constructor : cls.getDeclaredConstructors()) // [A]
if (constructor.getParameterCount() == 0)
return (Constructor<T>)constructor;

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/libj/lang/EnumerationIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,20 @@
import java.util.Iterator;
import java.util.Objects;

/**
* An {@link Iterator} over an {@link Enumeration}.
*
* @param <E> The type parameter of the {@link Enumeration}.
*/
public class EnumerationIterator<E> implements Iterator<E> {
private final Enumeration<E> enumeration;

/**
* Creates a new {@link EnumerationIterator} with the provided {@link Enumeration}.
*
* @param enumeration The {@link Enumeration} backing this {@link EnumerationIterator}.
* @throws NullPointerException If {@code enumeration} is null.
*/
public EnumerationIterator(final Enumeration<E> enumeration) {
this.enumeration = Objects.requireNonNull(enumeration);
}
Expand All @@ -37,6 +48,9 @@ public E next() {
return enumeration.nextElement();
}

/**
* Throws {@link UnsupportedOperationException}, because removing elements from an {@link Enumeration} is not supported.
*/
@Override
public void remove() {
throw new UnsupportedOperationException();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/libj/lang/Enumerations.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public void forEachRemaining(final Consumer<? super T> action) {
* @param enumeration The {@link Enumeration}.
* @return The size of the provided {@link Enumeration}.
* @throws NullPointerException If {@code enumeration} is null.
* @implNote After the execution of this method, the provided {@link Enumeration} will be fully consumed.
*/
public static int getSize(final Enumeration<?> enumeration) {
int size = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public IllegalAnnotationException(final Annotation annotation, final String mess
* @return The {@link Annotation} that is the subject of this exception.
*/
public Annotation annotation() {
return this.annotation;
return annotation;
}
}
4 changes: 2 additions & 2 deletions src/test/java/org/libj/lang/DeclarativeOrderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public class DeclarativeOrderTest {
private static void test(final DeclarativeOrderPolicy declarativeOrderPolicy) throws ClassNotFoundException {
final Method[] methods = declarativeOrderPolicy.getMethods(DeclarativeOrderTest0.class, Test.class);
assertTrue(Classes.sortDeclarativeOrder(methods, declarativeOrderPolicy.isSuperFirst()));
for (int i = 0, i$ = methods.length; i < i$; ++i) {
for (int i = 0; i < methods.length; ++i) { // [A]
final Method method = methods[i];
final ExpectOrders expectOrders = method.getAnnotation(ExpectOrders.class);
for (final ExpectOrder expectOrder : expectOrders.value())
for (final ExpectOrder expectOrder : expectOrders.value()) // [A]
if (expectOrder.policy() == declarativeOrderPolicy)
assertEquals(i + " " + method.getDeclaringClass().getName() + ":" + method.getName() + " " + expectOrder.order(), expectOrder.order(), i);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/libj/lang/DeclarativeOrderTest2.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void assertIndex(final String sig) throws NoSuchMethodException {
final StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
final Method method = getClass().getMethod(stackTraceElements[2].getMethodName());
final ExpectOrders expectOrders = method.getAnnotation(ExpectOrders.class);
for (final ExpectOrder expectOrder : expectOrders.value())
for (final ExpectOrder expectOrder : expectOrders.value()) // [A]
if (expectOrder.policy() == PUBLIC_SUPER_FIRST)
assertEquals(index + " " + method.getDeclaringClass().getName() + ":" + method.getName() + " " + expectOrder.order(), expectOrder.order(), index);

Expand Down

0 comments on commit b766921

Please sign in to comment.