Skip to content

Commit cac1fce

Browse files
committed
Solved IntelliJ warnings
1 parent e25c4f9 commit cac1fce

7 files changed

Lines changed: 11 additions & 14 deletions

File tree

src/main/java/org/bbottema/javareflection/BeanUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ public static boolean isBeanMethod(final Method method, final Class<?> boundaryM
116116
/**
117117
* @return Same as {@link #isBeanMethod(Method, Class, EnumSet)}, but may consider methods declared on interfaces as well.
118118
*/
119+
@SuppressWarnings("WeakerAccess")
119120
public static boolean isBeanMethod(Method method, Class<?> boundaryMarker,
120-
EnumSet<Visibility> visibility, boolean checkBeanLikeForInterfaces) {
121+
EnumSet<Visibility> visibility, boolean checkBeanLikeForInterfaces) {
121122
return method.getDeclaringClass().isInterface()
122123
? checkBeanLikeForInterfaces && methodIsBeanlike(method)
123124
: isBeanMethodForField(method, boundaryMarker, visibility);

src/main/java/org/bbottema/javareflection/LookupCaches.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.jetbrains.annotations.Nullable;
88

99
import java.lang.reflect.Method;
10-
import java.util.EnumSet;
1110
import java.util.HashMap;
1211
import java.util.LinkedHashMap;
1312
import java.util.List;
@@ -33,16 +32,16 @@ public class LookupCaches {
3332
* combinations using autoboxing and/or automatic common conversions can become very large (7000+ with only three parameters) and can become a
3433
* real problem. The more frequently a method is being called the larger the performance gain, especially for methods with long parameter lists
3534
*
36-
* @see MethodUtils#addMethodToCache(Class, String, Set, Class[])
37-
* @see MethodUtils#getMethodFromCache(Class, String, Class[])
35+
* @see "MethodUtils.addMethodToCache(Class, String, Set, Class[])"
36+
* @see "MethodUtils#getMethodFromCache(Class, String, Class[])"
3837
*/
3938
final static Map<Class<?>, Map<String, Map<Class<?>[], Set<InvokableObject>>>> METHOD_CACHE = new LinkedHashMap<>();
4039

4140
static final Map<Class<?>, Set<Class<?>>> CACHED_REGISTERED_COMPATIBLE_TARGET_TYPES = new HashMap<>();
4241
static final Map<Class<?>, Set<Class<?>>> CACHED_COMPATIBLE_TARGET_TYPES = new HashMap<>();
43-
static final Map<Set<LookupMode>, Map<ArrayKey, List<Class<?>[]>>> CACHED_COMPATIBLE_TYPE_LISTS = new HashMap<>();
42+
private static final Map<Set<LookupMode>, Map<ArrayKey, List<Class<?>[]>>> CACHED_COMPATIBLE_TYPE_LISTS = new HashMap<>();
4443

45-
@SuppressWarnings({"WeakerAccess", "unused"})
44+
@SuppressWarnings({"unused"})
4645
public static void resetCache() {
4746
CLASS_CACHE.clear();
4847
METHOD_CACHE.clear();
@@ -55,10 +54,7 @@ public static void resetCache() {
5554
static List<Class<?>[]> getCachedCompatibleSignatures(Set<LookupMode> lookupMode, ArrayKey arrayKey) {
5655
final Map<ArrayKey, List<Class<?>[]>> cachedCompatibleSignatures = CACHED_COMPATIBLE_TYPE_LISTS.get(lookupMode);
5756
if (cachedCompatibleSignatures != null) {
58-
final List<Class<?>[]> cachedResult = cachedCompatibleSignatures.get(arrayKey);
59-
if (cachedResult != null) {
60-
return cachedResult;
61-
}
57+
return cachedCompatibleSignatures.get(arrayKey);
6258
}
6359
return null;
6460
}

src/main/java/org/bbottema/javareflection/PackageUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import lombok.experimental.UtilityClass;
44
import org.jetbrains.annotations.Nullable;
55

6+
@SuppressWarnings("WeakerAccess")
67
@UtilityClass
78
public final class PackageUtils {
89

src/main/java/org/bbottema/javareflection/ReflectionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
public class ReflectionUtils {
1313

1414
@SuppressWarnings("FieldCanBeLocal")
15-
private static String INVALID_GENERIC_TYPE_DEFINITION = "Unable to determine generic type, probably due to type erasure. Make sure the type is part of a class signature (it can not be a field or variable, or a nested generic type such as List<NestedType>)";
15+
private static final String INVALID_GENERIC_TYPE_DEFINITION = "Unable to determine generic type, probably due to type erasure. Make sure the type is part of a class signature (it can not be a field or variable, or a nested generic type such as List<NestedType>)";
1616

1717
/**
1818
* Inspects a inheritance chain of classes until the <em>classOfInterest</em> is found and then will look for the Generic type declared for the given (zero-based) index.

src/main/java/org/bbottema/javareflection/util/ExternalClassLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ private Class<?> loadClass(final String classPath, final String className)
168168
// get data from file
169169
final File f = new File(classPath);
170170
final int size = (int) f.length();
171-
final byte buff[] = new byte[size];
171+
final byte[] buff = new byte[size];
172172
final DataInputStream dis = new DataInputStream(new FileInputStream(f));
173173
dis.readFully(buff);
174174
dis.close();

src/main/java/org/bbottema/javareflection/util/commonslang25/NumberUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public static boolean isNumber(String str) {
5454
int i = start;
5555
// loop to the next to last char or to the last char if we need another digit to
5656
// make a valid number (e.g. chars[0..5] = "1234E")
57-
//noinspection ConstantConditions
5857
while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) {
5958
if (chars[i] >= '0' && chars[i] <= '9') {
6059
foundDigit = true;

src/main/java/org/bbottema/javareflection/util/commonslang25/StringUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public static String capitalize(String str) {
3030
if (str == null || str.length() == 0) {
3131
return str;
3232
}
33-
return String.valueOf(Character.toTitleCase(str.charAt(0))) + str.substring(1);
33+
return Character.toTitleCase(str.charAt(0)) + str.substring(1);
3434
}
3535
}

0 commit comments

Comments
 (0)