i have this piece of code:
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
public class ClientLookup<T extends Remote> {
private T sharedObject;
public void lookup(String adress) throws MalformedURLException, RemoteException, NotBoundException {
sharedObject = (T) Naming.lookup(adress);
}
public T getSharedObject() {
return sharedObject;
}
}
The part with "(T) Naming.lookup(adress)" is giving me a warning: "Type safety: Unchecked cast from Remote to T"
I don't wanto to use "@SuppressWarnings("unchecked")", i just want to know why is it showing a warning when "T extends Remote" and fix it (for a clean code)
Thnaks.