Javadoc of the following method said that it accepts null value for the valueType argument:
public <T> T getAttribute(String name, Class<? extends T> valueType);
However there is no way this method can be type-safe with a null valueType. For example the following code compile without errors even if the "recipe" attribute is not an Integer:
Disallowing null Class argument value in T getAttribute(String, Class).
Adding a Object getAttribute(String) method in replacement for the case where the Class argument was null.
On a related topic, I don't see where getAttribute(String, Class) verifies the type. Is it done in the native code? If not, then we should add a valueType.cast(theResult) call in the method implementation.
Javadoc of the following method said that it accepts
null
value for thevalueType
argument:However there is no way this method can be type-safe with a null
valueType
. For example the following code compile without errors even if the "recipe" attribute is not anInteger
:This can be fixed by:
Class
argument value inT getAttribute(String, Class)
.Object getAttribute(String)
method in replacement for the case where theClass
argument was null.On a related topic, I don't see where
getAttribute(String, Class)
verifies the type. Is it done in the native code? If not, then we should add avalueType.cast(theResult)
call in the method implementation.