Lines 41678-41682
Link Here
|
41678 |
"Zork cannot be resolved to a type\n" + |
41678 |
"Zork cannot be resolved to a type\n" + |
41679 |
"----------\n"); |
41679 |
"----------\n"); |
41680 |
} |
41680 |
} |
|
|
41681 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484 |
41682 |
public void test1350() { |
41683 |
this.runConformTest( |
41684 |
new String[] { |
41685 |
"X.java", // ================= |
41686 |
"import java.io.IOException;\n" + |
41687 |
"\n" + |
41688 |
"interface TreeVisitor<T, U> {\n" + |
41689 |
" public T visit(U location);\n" + |
41690 |
"}\n" + |
41691 |
"\n" + |
41692 |
"interface TreeVisitable<U> {\n" + |
41693 |
" public <T> T visit(TreeVisitor<T, U> visitor) throws IOException;\n" + |
41694 |
"}\n" + |
41695 |
"\n" + |
41696 |
"abstract class Param implements TreeVisitable<Param> {\n" + |
41697 |
" public final Param lookforParam(final String name) {\n" + |
41698 |
" TreeVisitor<Param, Param> visitor = new TreeVisitor<Param, Param>() {\n" + |
41699 |
" public Param visit(Param location) {\n" + |
41700 |
" return null;\n" + |
41701 |
" }\n" + |
41702 |
" };\n" + |
41703 |
" return visit(visitor);\n" + |
41704 |
" }\n" + |
41705 |
"\n" + |
41706 |
" public abstract <T> T visit(TreeVisitor<T, Param> visitor);\n" + |
41707 |
"}\n" + |
41708 |
"\n" + |
41709 |
"class StructParam extends Param {\n" + |
41710 |
" public <T> T visit(TreeVisitor<T, Param> visitor) {\n" + |
41711 |
" return null;\n" + |
41712 |
" }\n" + |
41713 |
"}\n" + |
41714 |
"\n" + |
41715 |
"public class X {\n" + |
41716 |
" public static void main(String[] args) {\n" + |
41717 |
" StructParam p = new StructParam();\n" + |
41718 |
" p.lookforParam(\"abc\");\n" + |
41719 |
" System.out.println(\"done\");\n" + |
41720 |
" }\n" + |
41721 |
"}\n", // ================= |
41722 |
}, |
41723 |
"done"); |
41724 |
} |
41725 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484 - variation |
41726 |
public void test1351() { |
41727 |
this.runConformTest( |
41728 |
new String[] { |
41729 |
"X.java", // ================= |
41730 |
"import java.io.IOException;\n" + |
41731 |
"\n" + |
41732 |
"interface IFoo {\n" + |
41733 |
" <T> T foo(T t) throws IOException;\n" + |
41734 |
"}\n" + |
41735 |
"interface JFoo {\n" + |
41736 |
" <T> T foo(T t) throws Exception;\n" + |
41737 |
"}\n" + |
41738 |
"abstract class Foo implements IFoo, JFoo {}\n" + |
41739 |
"\n" + |
41740 |
"public class X {\n" + |
41741 |
" public static void main(String[] args) {\n" + |
41742 |
" Foo f = createFoo();\n" + |
41743 |
" try {\n" + |
41744 |
" f.foo(null);\n" + |
41745 |
" } catch(IOException e) {\n" + |
41746 |
" }\n" + |
41747 |
" System.out.println(\"done\");\n" + |
41748 |
" }\n" + |
41749 |
" static Foo createFoo() {\n" + |
41750 |
" return new Foo() {\n" + |
41751 |
" public <T> T foo(T t) {\n" + |
41752 |
" return t;\n" + |
41753 |
" }\n" + |
41754 |
" };\n" + |
41755 |
" }\n" + |
41756 |
"}\n", // ================= |
41757 |
}, |
41758 |
"done"); |
41759 |
} |
41760 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484 - variation |
41761 |
public void test1352() { |
41762 |
this.runConformTest( |
41763 |
new String[] { |
41764 |
"X.java", // ================= |
41765 |
"import java.io.IOException;\n" + |
41766 |
"\n" + |
41767 |
"interface IFoo<U> {\n" + |
41768 |
" <T> T foo(T t) throws IOException;\n" + |
41769 |
"}\n" + |
41770 |
"interface JFoo<U> {\n" + |
41771 |
" <T> T foo(T t) throws Exception;\n" + |
41772 |
"}\n" + |
41773 |
"abstract class Foo implements IFoo<String>, JFoo<String> {}\n" + |
41774 |
"\n" + |
41775 |
"public class X {\n" + |
41776 |
" public static void main(String[] args) {\n" + |
41777 |
" Foo f = createFoo();\n" + |
41778 |
" try {\n" + |
41779 |
" f.foo(null);\n" + |
41780 |
" } catch(IOException e) {\n" + |
41781 |
" }\n" + |
41782 |
" System.out.println(\"done\"); //dd\n" + |
41783 |
" }\n" + |
41784 |
" static Foo createFoo() {\n" + |
41785 |
" return new Foo() {\n" + |
41786 |
" public <T> T foo(T t) {\n" + |
41787 |
" return t;\n" + |
41788 |
" }\n" + |
41789 |
" };\n" + |
41790 |
" }\n" + |
41791 |
"}\n", // ================= |
41792 |
}, |
41793 |
"done"); |
41794 |
} |
41795 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=238484 - variation |
41796 |
public void test1353() { |
41797 |
this.runNegativeTest( |
41798 |
new String[] { |
41799 |
"X.java", // ================= |
41800 |
"import java.io.IOException;\n" + |
41801 |
"\n" + |
41802 |
"interface IFoo<U> {\n" + |
41803 |
" <T> T foo(T t) throws IOException;\n" + |
41804 |
"}\n" + |
41805 |
"interface JFoo<U> {\n" + |
41806 |
" <T> T foo(T t);\n" + |
41807 |
"}\n" + |
41808 |
"abstract class Foo implements IFoo<String>, JFoo<String> {}\n" + |
41809 |
"\n" + |
41810 |
"public class X {\n" + |
41811 |
" public static void main(String[] args) {\n" + |
41812 |
" Foo f = createFoo();\n" + |
41813 |
" try {\n" + |
41814 |
" f.foo(null);\n" + |
41815 |
" } catch(IOException e) {\n" + |
41816 |
" }\n" + |
41817 |
" System.out.println(\"done\"); //dd\n" + |
41818 |
" }\n" + |
41819 |
" static Foo createFoo() {\n" + |
41820 |
" return new Foo() {\n" + |
41821 |
" public <T> T foo(T t) {\n" + |
41822 |
" return t;\n" + |
41823 |
" }\n" + |
41824 |
" };\n" + |
41825 |
" }\n" + |
41826 |
"}\n", // ================= |
41827 |
}, |
41828 |
"----------\n" + |
41829 |
"1. ERROR in X.java (at line 16)\n" + |
41830 |
" } catch(IOException e) {\n" + |
41831 |
" ^^^^^^^^^^^\n" + |
41832 |
"Unreachable catch block for IOException. This exception is never thrown from the try statement body\n" + |
41833 |
"----------\n"); |
41834 |
} |
41681 |
|
41835 |
|
41682 |
} |
41836 |
} |