Closed Tomas-Kraus closed 2 years ago
Previously tracked via: https://bugs.openjdk.java.net/browse/JDK-8182558
My colleagues Marsela Sulku and Maria Sam are working on detecting errors with new errorprone checks and have found one impossible cast in openjdk:
Method jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java#getItemType contains if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) { Type componentType = ((Class)type).getComponentType(); Type genericComponentType = null; if (genericType!= null && genericType instanceof GenericArrayType) { GenericArrayType arrayType = (GenericArrayType) type; genericComponentType = arrayType.getGenericComponentType(); componentType = arrayType.getGenericComponentType(); }
The cast to (GenericArrayType) cannot succeed because type is already a Class. (Probably this code has never worked or been tested)
It's very likely that this is a typo for:
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java +++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java @@ -177,7 +177,7 @@ Type componentType = ((Class)type).getComponentType(); Type genericComponentType = null; if (genericType!= null && genericType instanceof GenericArrayType) {
Source: https://github.com/javaee/metro-jax-ws/issues/1223 Author: LanceAndersen
Previously tracked via: https://bugs.openjdk.java.net/browse/JDK-8182558
My colleagues Marsela Sulku and Maria Sam are working on detecting errors with new errorprone checks and have found one impossible cast in openjdk:
Method jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java#getItemType contains if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) { Type componentType = ((Class)type).getComponentType(); Type genericComponentType = null; if (genericType!= null && genericType instanceof GenericArrayType) { GenericArrayType arrayType = (GenericArrayType) type; genericComponentType = arrayType.getGenericComponentType(); componentType = arrayType.getGenericComponentType(); }
The cast to (GenericArrayType) cannot succeed because type is already a Class. (Probably this code has never worked or been tested)
It's very likely that this is a typo for:
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java +++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java @@ -177,7 +177,7 @@ Type componentType = ((Class)type).getComponentType(); Type genericComponentType = null; if (genericType!= null && genericType instanceof GenericArrayType) {
Source: https://github.com/javaee/metro-jax-ws/issues/1223 Author: LanceAndersen