| Summary: | java generic methods | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | gerhard presser <gerpres> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | VERIFIED DUPLICATE | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | jerome_lanneluc, philippe_mulet |
| Version: | 3.5 | ||
| Target Milestone: | 3.4.1 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
*** This bug has been marked as a duplicate of bug 238484 *** Verified for 3.5M1 using I20080805-1307 Cannot verify since the test case is not complete (missing Remote , RemoteException, Persistent, etc.) Kent why was it marked as a dup? Given kent is away.
Here is a better testcase:
//the remote-usable interface
class RemoteException extends Throwable {
}
interface RemoteStore {
public abstract <P> P get(Class<P> c) throws RemoteException;
}
// the interface for local use
interface Store extends RemoteStore {
public <P> P get(Class<P> c);
}
// the implementation
class StoreImpl implements Store {
public <P> P get(Class<P> c) {
System.out.print("[get]");
return null;
}
}
class Persistent {
}
public class X {
public static void main(String[] args) {
try {
RemoteStore t = new StoreImpl();
t.get(Object.class); // works
t.get(Persistent.class); // works
} catch (RemoteException e) {
e.printStackTrace();
}
Store t = new StoreImpl();
t.get(Object.class); // works
t.get(Persistent.class); // NoSuchMethodError
}
}
It is truly a dup, since problem comes from method override with different throws clause, as addressed in bug 238484.
Added GenericTypeTest#test1378
Verified for 3.4.1 using build M20080827-2000. |
Hi! following code doesn't execute properly on eclipse-ganymede. //the remote-usable interface public interface RemoteStore extends Remote { public abstract <P> P get(Class<P> c) throws RemoteException; } //the interface for local use public interface Store extends RemoteStore{ public <P> P get(Class<P> c) ; } //the implementation public class StoreImpl implements Store { public <P> P get(Class<P> c) { System.out.println("get"); return null; } } //testcases public static void main(String[] args) { try { RemoteStore t = new StoreImpl(); t.get(Object.class); //works t.get(Persistent.class); //works t.get(User.class); //works } catch (RemoteException e) { e.printStackTrace(); } Store t = new StoreImpl(); t.get(Object.class); //works t.get(Persistent.class); //NoSuchMethodError t.get(User.class); //NoSuchMethodError } it works on eclipse 3.3 problem description: I have an Interface which is used for RMI-calls. Because of that all methods have to throw RemoteException. If i use this Interface locally, it's very disturbing if you have to catch RemoteExceptions all the time, alltough you know it cannot be thrown. I thought i write another interface which extends the Remote-Interface which overrides all the methods without the throws-declarations. everything went fine (no compiletime errors) but when i test the methods i get NoSuchMethodErrors.