(T) vs. t.cast in p4j5, or the opensource effect 📎
public <T> T getElement(String jndiName,Class<T> t){
Object component = this.getElement(jndiName);
return (T)PortableRemoteObject.narrow(component, t);
}
the problem is the cast, which causes warnings, which is in turn sub-optimal :-).
Robert Herschke sent me the following snippet, which was immediately committed to the trunk:
public <T> T getElement(String jndiName,Class<T> t){
Object component = this.getElement(jndiName);
return t.cast(PortableRemoteObject.narrow(component, t));
}
I invited him to get the developer role, but he had to work :-).