Community
Participate
Working Groups
3.4.0 In following code, try to perform codeselect (F3) on 'visit' invocation on line marked with "SELECT #visit(...)" comment. Nothing occurs. import java.io.IOException; interface TreeVisitor<T, U> { public T visit(U location); } interface TreeVisitable<U> { public <T> T visit(TreeVisitor<T, U> visitor) throws IOException; } abstract class Param implements TreeVisitable<Param> { public final Param lookforParam(final String name) { TreeVisitor<Param, Param> visitor = new TreeVisitor<Param, Param>() { public Param visit(Param location) { return null; } }; return visit(visitor); // SELECT #visit(...) } public abstract <T> T visit(TreeVisitor<T, Param> visitor); } class StructParam extends Param { public <T> T visit(TreeVisitor<T, Param> visitor) { return null; } } public class X { public static void main(String[] args) { StructParam p = new StructParam(); p.lookforParam("abc"); System.out.println("done"); } }
also see compiler bug 238484
Synthetic method addition came from handling this sort of situation: import java.awt.print.PrinterAbortException; import java.awt.print.PrinterException; import java.io.IOException; import java.util.zip.ZipException; class Over { void x() throws Exception { IandJ ij= new K(); ij.m(); //wrong compile error } } interface I { void m() throws IOException, PrinterAbortException; } interface J { void m() throws ZipException, PrinterException; } interface IandJ extends I, J {} // swapping I and J does not help class K implements IandJ { public void m() throws ZipException { } } ---------------- A synthetic method is creating for invocation, and replaces the original I#m() and J#m(). Codeselect should recognize this situation and surface the 2 methods instead.
This bug is fixed by the fix for 238484. I added some regression test for 3.5M1 and 3.4.1: ResolveTests_1_5#test0115() -> test0116() *** This bug has been marked as a duplicate of bug 238484 ***
Verified for 3.5M1 using I20080805-1307
Verified for 3.4.1 using M20080827-2000.