You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm observing the following warning messages when running Copybara (which depends on JCommander):
INFO: From Building external/JCommander/libjcommander.jar (61 source files):
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java:217: warning: [unchecked] unchecked cast
String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString();
^
required: Class<? extends Enum>
found: Class<CAP#1>
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java:217: warning: [unchecked] unchecked method invocation: method allOf in class EnumSet is applied to given types
String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString();
^
required: Class<E>
found: Class<CAP#1>
where E is a type-variable:
E extends Enum<E> declared in method <E>allOf(Class<E>)
where CAP#1 is a fresh type-variable:
CAP#1 extends Enum from capture of ? extends Enum
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/JCommander.java:982: warning: [unchecked] unchecked conversion
mainParameter.multipleValue = result;
^
required: List<Object>
found: List
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/JCommander.java:1347: warning: [unchecked] unchecked call to isAssignableFrom(Class<?>) as a member of the raw type Class
if (type.isAssignableFrom(List.class)) {
^
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/JCommander.java:1351: warning: [unchecked] unchecked call to isAssignableFrom(Class<?>) as a member of the raw type Class
if (type.isAssignableFrom(List.class) && converter == null) {
^
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/JCommander.java:1354: warning: [unchecked] unchecked call to DefaultListConverter(IParameterSplitter,IStringConverter<T>) as a member of the raw type DefaultListConverter
converter = new DefaultListConverter(splitter, new IStringConverter() {
^
where T is a type-variable:
T extends Object declared in class DefaultListConverter
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/JCommander.java:1370: warning: [unchecked] unchecked call to EnumConverter(String,Class<T>) as a member of the raw type EnumConverter
converter = new EnumConverter(optionName, type);
^
where T is a type-variable:
T extends Enum<T> declared in class EnumConverter
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/JCommander.java:1394: warning: [unchecked] unchecked cast
for (Constructor<T> c : (Constructor<T>[]) converterClass.getDeclaredConstructors()) {
^
required: Constructor<T>[]
found: Constructor<?>[]
where T is a type-variable:
T extends Object declared in method <T>instantiateConverter(String,Class<? extends T>)
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/ParameterDescription.java:264: warning: [unchecked] unchecked method invocation: method addAll in interface Collection is applied to given types
l.addAll((Collection) convertedValue);
^
required: Collection<? extends E>
found: Collection
where E is a type-variable:
E extends Object declared in interface Collection
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/ParameterDescription.java:264: warning: [unchecked] unchecked conversion
l.addAll((Collection) convertedValue);
^
required: Collection<? extends E>
found: Collection
where E is a type-variable:
E extends Object declared in interface Collection
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/ParameterDescription.java:364: warning: [unchecked] unchecked call to validate(String,T) as a member of the raw type IValueValidator
validator.newInstance().validate(name, value);
^
where T is a type-variable:
T extends Object declared in interface IValueValidator
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/UnixStyleUsageFormatter.java:91: warning: [unchecked] unchecked cast
String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString();
^
required: Class<? extends Enum>
found: Class<CAP#1>
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/UnixStyleUsageFormatter.java:91: warning: [unchecked] unchecked method invocation: method allOf in class EnumSet is applied to given types
String valueList = EnumSet.allOf((Class<? extends Enum>) type).toString();
^
required: Class<E>
found: Class<CAP#1>
where E is a type-variable:
E extends Enum<E> declared in method <E>allOf(Class<E>)
where CAP#1 is a fresh type-variable:
CAP#1 extends Enum from capture of ? extends Enum
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/internal/Lists.java:37: warning: [unchecked] Possible heap pollution from parameterized vararg type K
public static <K> List<K> newArrayList(K... c) {
^
where K is a type-variable:
K extends Object declared in method <K>newArrayList(K...)
external/JCommander/jcommander-05254453c0a824f719bd72dac66fa686525752a5/src/main/java/com/beust/jcommander/internal/Maps.java:35: warning: [unchecked] Possible heap pollution from parameterized vararg type T
public static <T> Map<T, T> newHashMap(T... parameters) {
^
where T is a type-variable:
T extends Object declared in method <T>newHashMap(T...)
Looking around the codebase, I'm noticing that the SuppressWarnings annotation is used in a few places in the codebase. In particular, @SuppressWarnings("unchecked") appears in a few places. Are there any particular reasons for suppressing warnings as opposed to resolving the concerns that the warnings hint at? It's not clear whether the preference would be to suppress warnings or to try to actually resolve them. Frankly, it's not even clear whether the warnings are just noise or they're indicative of actual problems (which is itself worrisome).
I'm observing the following warning messages when running Copybara (which depends on JCommander):
I'm using
--java_runtime_version=remotejdk_11
in Bazel as suggested in https://bazel.build/docs/bazel-and-java#hermetic-testing. I'm also using JCommander commit 0525445 (the archive for which is pulled in Copybara commit 19ed647).The text was updated successfully, but these errors were encountered: