Skip to content

Commit 5618c27

Browse files
committed
Fix some Checkstyle issues (mostly missing Javadoc)
- Note: implNote in MoreNumberTypes can be removed because it was outdated
1 parent b76e42b commit 5618c27

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

src/main/java/ch/jalu/typeresolver/FieldUtils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public static Stream<Field> getAllFields(Class<?> clazz) {
7676
*/
7777
public static Stream<Field> getAllFields(Class<?> clazz, boolean topParentFirst) {
7878
LinkedList<Class<?>> classes = new LinkedList<>();
79-
collectParents(clazz, (topParentFirst ? classes::addFirst : classes::addLast));
79+
collectParents(clazz, topParentFirst ? classes::addFirst : classes::addLast);
8080

8181
return classes.stream()
8282
.flatMap(clz -> Arrays.stream(clz.getDeclaredFields()));
@@ -146,13 +146,16 @@ public static Optional<Field> tryFindFieldInClassOrParent(Class<?> clazz, String
146146
* false to keep the last one
147147
* @return collector to collect names by field
148148
*/
149+
@SuppressWarnings("checkstyle:IllegalType") // LinkedHashMap is relevant to signal that the order is retained
149150
public static Collector<Field, ?, LinkedHashMap<String, Field>> collectByName(boolean firstFieldWins) {
150151
BiConsumer<LinkedHashMap<String, Field>, Field> accumulator = firstFieldWins
151152
? (map, field) -> map.putIfAbsent(field.getName(), field)
152153
: (map, field) -> map.put(field.getName(), field);
153154

154155
return Collector.of(LinkedHashMap::new, accumulator,
155-
(a, b) -> { throw new UnsupportedOperationException(); });
156+
(a, b) -> {
157+
throw new UnsupportedOperationException();
158+
});
156159
}
157160

158161
private static void collectParents(Class<?> clazz, Consumer<Class<?>> classAdder) {

src/main/java/ch/jalu/typeresolver/TypeToClassUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import java.util.Objects;
1313
import java.util.function.Function;
1414

15+
/**
16+
* Internal utility class to transform Type instances to an equivalent Class.
17+
*/
1518
final class TypeToClassUtils {
1619

1720
private TypeToClassUtils() {

src/main/java/ch/jalu/typeresolver/array/ArrayComponentType.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@
1212
*/
1313
public enum ArrayComponentType {
1414

15+
/** Primitive boolean. */
1516
BOOLEAN(boolean.class),
17+
/** Primitive byte. */
1618
BYTE(byte.class),
19+
/** Primitive char. */
1720
CHARACTER(char.class),
21+
/** Primitive short. */
1822
SHORT(short.class),
23+
/** Primitive int. */
1924
INTEGER(int.class),
25+
/** Primitive long. */
2026
LONG(long.class),
27+
/** Primitive float. */
2128
FLOAT(float.class),
29+
/** Primitive double. */
2230
DOUBLE(double.class),
2331
/** Means any extension of Object, such as the component of {@code String[]}, or even {@code int[][]}. */
2432
OBJECT(Object.class);

src/main/java/ch/jalu/typeresolver/numbers/MoreNumberTypes.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ private MoreNumberTypes() {
3737
/**
3838
* Atomic number type implementation: uses a base number type and wraps it in its atomic equivalent.
3939
*
40-
* @implNote Value ranges that go beyond Long's range are not supported because of the implementation of
41-
* {@link #getValueRange()}.
42-
*
4340
* @param <B> the base number type (e.g. Integer)
4441
* @param <A> the atomic type (e.g. AtomicInteger)
4542
*/

src/main/java/ch/jalu/typeresolver/numbers/StandardNumberType.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,24 @@ public Number convertUnsafe(Number number) {
9494
}
9595
};
9696

97+
/** Byte number type. */
9798
public static final NumberType<Byte> TYPE_BYTE = (NumberType<Byte>) BYTE;
99+
/** Short number type. */
98100
public static final NumberType<Short> TYPE_SHORT = (NumberType<Short>) SHORT;
101+
/** Integer number type. */
99102
public static final NumberType<Integer> TYPE_INTEGER = (NumberType<Integer>) INTEGER;
103+
/** Long number type. */
100104
public static final NumberType<Long> TYPE_LONG = (NumberType<Long>) LONG;
105+
/** Float number type. */
101106
public static final NumberType<Float> TYPE_FLOAT = (NumberType<Float>) FLOAT;
107+
/** Double number type. */
102108
public static final NumberType<Double> TYPE_DOUBLE = (NumberType<Double>) DOUBLE;
109+
/** BigInteger number type. */
103110
public static final NumberType<BigInteger> TYPE_BIG_INTEGER = (NumberType<BigInteger>) BIG_INTEGER;
111+
/** BigDecimal number type. */
104112
public static final NumberType<BigDecimal> TYPE_BIG_DECIMAL = (NumberType<BigDecimal>) BIG_DECIMAL;
105113

106-
private static final Map<Class<?>, StandardNumberType> typeToEnumEntry =
114+
private static final Map<Class<?>, StandardNumberType> TYPE_TO_ENUM_ENTRIES =
107115
initReferenceTypeToStandardNumberTypeMap();
108116

109117
private final Class<? extends Number> type;
@@ -207,7 +215,7 @@ public ValueRangeComparison compareToValueRange(Number number) {
207215
*/
208216
@Nullable
209217
public static StandardNumberType fromClass(Class<?> clazz) {
210-
return typeToEnumEntry.get(PrimitiveType.toReferenceType(clazz));
218+
return TYPE_TO_ENUM_ENTRIES.get(PrimitiveType.toReferenceType(clazz));
211219
}
212220

213221
/**

0 commit comments

Comments
 (0)