Lines 10832-10835
Link Here
|
10832 |
}, |
10832 |
}, |
10833 |
"class java.lang.Object"); |
10833 |
"class java.lang.Object"); |
10834 |
} |
10834 |
} |
|
|
10835 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=288658, make sure a bridge method |
10836 |
// is generated when a public method is inherited from a non-public class into a |
10837 |
// public class. |
10838 |
public void test208() { |
10839 |
this.runConformTest( |
10840 |
new String[] { |
10841 |
"Test.java", |
10842 |
"import java.lang.annotation.Annotation;\n"+ |
10843 |
"import java.lang.annotation.Retention;\n"+ |
10844 |
"import java.lang.annotation.RetentionPolicy;\n"+ |
10845 |
"import java.lang.reflect.Method;\n"+ |
10846 |
"\n"+ |
10847 |
"public class Test extends Super {\n"+ |
10848 |
" public static void main(String[] args) {\n"+ |
10849 |
" try {\n"+ |
10850 |
" Method m = Test.class.getMethod(\"setFoo\", String.class);\n"+ |
10851 |
" Annotation a = m.getAnnotation(Anno.class);\n"+ |
10852 |
" System.out.println(\"Annotation was \" + (a == null ? \"not \" : \"\") +\n"+ |
10853 |
"\"found\");\n"+ |
10854 |
" } catch (Exception e) {\n"+ |
10855 |
" e.printStackTrace();\n"+ |
10856 |
" }\n"+ |
10857 |
" }\n"+ |
10858 |
"}\n"+ |
10859 |
"\n"+ |
10860 |
"class Super {\n"+ |
10861 |
" @Anno\n"+ |
10862 |
" public void setFoo(String foo) {}\n"+ |
10863 |
"}\n"+ |
10864 |
"\n"+ |
10865 |
"@Retention(RetentionPolicy.RUNTIME)\n"+ |
10866 |
"@interface Anno {\n"+ |
10867 |
"\n"+ |
10868 |
"}\n" |
10869 |
}, |
10870 |
"Annotation was not found"); |
10871 |
} |
10872 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=288658, make sure a bridge method |
10873 |
// is generated when a public method is inherited from a non-public class into a |
10874 |
// public class. |
10875 |
public void test208a() { |
10876 |
this.runConformTest( |
10877 |
new String[] { |
10878 |
"Test.java", |
10879 |
"import java.lang.annotation.Annotation;\n"+ |
10880 |
"import java.lang.annotation.Retention;\n"+ |
10881 |
"import java.lang.annotation.RetentionPolicy;\n"+ |
10882 |
"import java.lang.reflect.Method;\n"+ |
10883 |
"\n"+ |
10884 |
"public class Test extends Super {\n"+ |
10885 |
" public void setFoo() {}\n" + |
10886 |
" public static void main(String[] args) {\n"+ |
10887 |
" try {\n"+ |
10888 |
" Method m = Test.class.getMethod(\"setFoo\", String.class);\n"+ |
10889 |
" Annotation a = m.getAnnotation(Anno.class);\n"+ |
10890 |
" System.out.println(\"Annotation was \" + (a == null ? \"not \" : \"\") +\n"+ |
10891 |
"\"found\");\n"+ |
10892 |
" } catch (Exception e) {\n"+ |
10893 |
" e.printStackTrace();\n"+ |
10894 |
" }\n"+ |
10895 |
" }\n"+ |
10896 |
"}\n"+ |
10897 |
"\n"+ |
10898 |
"class Super {\n"+ |
10899 |
" @Anno\n"+ |
10900 |
" public void setFoo(String foo) {}\n"+ |
10901 |
"}\n"+ |
10902 |
"\n"+ |
10903 |
"@Retention(RetentionPolicy.RUNTIME)\n"+ |
10904 |
"@interface Anno {\n"+ |
10905 |
"\n"+ |
10906 |
"}\n" |
10907 |
}, |
10908 |
"Annotation was not found"); |
10909 |
} |
10835 |
} |
10910 |
} |