Lines 36736-36739
Link Here
|
36736 |
}, |
36736 |
}, |
36737 |
""); |
36737 |
""); |
36738 |
} |
36738 |
} |
|
|
36739 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 |
36740 |
public void testONLY_1109() { |
36741 |
Map settings = getCompilerOptions(); |
36742 |
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); |
36743 |
this.runConformTest( |
36744 |
new String[] { |
36745 |
"X.java", |
36746 |
"class A<T> {\n" + |
36747 |
" public T foo(Object o) {\n" + |
36748 |
" return (T) o; // should get unchecked warning\n" + |
36749 |
" }\n" + |
36750 |
"}\n" + |
36751 |
"\n" + |
36752 |
"public class X {\n" + |
36753 |
" public static void main(String[] args) {\n" + |
36754 |
" A<X> a = new A<X>();\n" + |
36755 |
" try {\n" + |
36756 |
" X s = a.foo(new Object());\n" + |
36757 |
" } catch(ClassCastException e) {\n" + |
36758 |
" System.out.println(\"SUCCESS\");\n" + |
36759 |
" return;\n" + |
36760 |
" }\n" + |
36761 |
" System.out.println(\"FAILED\");\n" + |
36762 |
" }\n" + |
36763 |
"}\n", // ================= |
36764 |
}, |
36765 |
"SUCCESS", |
36766 |
null, |
36767 |
true, |
36768 |
null, |
36769 |
settings, |
36770 |
null); |
36771 |
} |
36772 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation |
36773 |
public void testONLY_1110() { |
36774 |
Map settings = getCompilerOptions(); |
36775 |
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); |
36776 |
this.runConformTest( |
36777 |
new String[] { |
36778 |
"X.java", |
36779 |
"class A<T> {\n" + |
36780 |
" public T foo;\n" + |
36781 |
"}\n" + |
36782 |
"\n" + |
36783 |
"public class X {\n" + |
36784 |
" public static void main(String[] args) {\n" + |
36785 |
" A<X> a = new A<X>();\n" + |
36786 |
" A ua = a;\n" + |
36787 |
" ua.foo = new Object();\n" + |
36788 |
" try {\n" + |
36789 |
" X s = a.foo;\n" + |
36790 |
" } catch(ClassCastException e) {\n" + |
36791 |
" System.out.println(\"SUCCESS\");\n" + |
36792 |
" return;\n" + |
36793 |
" }\n" + |
36794 |
" System.out.println(\"FAILED\");\n" + |
36795 |
" }\n" + |
36796 |
"}\n", // ================= |
36797 |
}, |
36798 |
"SUCCESS", |
36799 |
null, |
36800 |
true, |
36801 |
null, |
36802 |
settings, |
36803 |
null); |
36804 |
} |
36805 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation |
36806 |
public void testONLY_1111() { |
36807 |
Map settings = getCompilerOptions(); |
36808 |
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); |
36809 |
this.runConformTest( |
36810 |
new String[] { |
36811 |
"X.java", |
36812 |
"class A<T> {\n" + |
36813 |
" public T foo;\n" + |
36814 |
"}\n" + |
36815 |
"\n" + |
36816 |
"public class X extends A<X>{\n" + |
36817 |
" public static void main(String[] args) {\n" + |
36818 |
" new X().foo();\n" + |
36819 |
" }\n" + |
36820 |
" public void foo() {\n" + |
36821 |
" A ua = this;\n" + |
36822 |
" ua.foo = new Object();\n" + |
36823 |
" try {\n" + |
36824 |
" X s = foo;\n" + |
36825 |
" } catch(ClassCastException e) {\n" + |
36826 |
" System.out.println(\"SUCCESS\");\n" + |
36827 |
" return;\n" + |
36828 |
" }\n" + |
36829 |
" System.out.println(\"FAILED\");\n" + |
36830 |
" }\n" + |
36831 |
"}\n", // ================= |
36832 |
}, |
36833 |
"SUCCESS", |
36834 |
null, |
36835 |
true, |
36836 |
null, |
36837 |
settings, |
36838 |
null); |
36839 |
} |
36840 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=177194 - variation |
36841 |
public void testONLY_1112() { |
36842 |
Map settings = getCompilerOptions(); |
36843 |
settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); |
36844 |
this.runConformTest( |
36845 |
new String[] { |
36846 |
"X.java", |
36847 |
"class A<T> {\n" + |
36848 |
" public T foo;\n" + |
36849 |
"}\n" + |
36850 |
"\n" + |
36851 |
"public class X extends A<X>{\n" + |
36852 |
" public static void main(String[] args) {\n" + |
36853 |
" new X().foo();\n" + |
36854 |
" }\n" + |
36855 |
" public void foo() {\n" + |
36856 |
" A ua = this;\n" + |
36857 |
" ua.foo = new Object();\n" + |
36858 |
" try {\n" + |
36859 |
" X s = this.foo;\n" + |
36860 |
" } catch(ClassCastException e) {\n" + |
36861 |
" System.out.println(\"SUCCESS\");\n" + |
36862 |
" return;\n" + |
36863 |
" }\n" + |
36864 |
" System.out.println(\"FAILED\");\n" + |
36865 |
" }\n" + |
36866 |
"}\n", // ================= |
36867 |
}, |
36868 |
"SUCCESS", |
36869 |
null, |
36870 |
true, |
36871 |
null, |
36872 |
settings, |
36873 |
null); |
36874 |
} |
36739 |
} |
36875 |
} |