Lines 2775-2778
Link Here
|
2775 |
assertTrue("Unexpected elements", false); |
2775 |
assertTrue("Unexpected elements", false); |
2776 |
} |
2776 |
} |
2777 |
} |
2777 |
} |
|
|
2778 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=209639 |
2779 |
public void test0119() throws Exception { |
2780 |
this.workingCopies = new ICompilationUnit[3]; |
2781 |
this.workingCopies[0] = getWorkingCopy( |
2782 |
"/Resolve/src/test/Test.java", |
2783 |
"package test;\n" + |
2784 |
"public class Test {\n" + |
2785 |
" public List<String> foo() {\n" + |
2786 |
" return Collections.emptyList();\n" + |
2787 |
" }\n" + |
2788 |
"}"); |
2789 |
|
2790 |
this.workingCopies[1] = getWorkingCopy( |
2791 |
"/Resolve/src/test/Collections.java", |
2792 |
"package test;\n" + |
2793 |
"public class Collections {\n" + |
2794 |
" public static final <T> List<T> emptyList() {return null;}\n" + |
2795 |
"}"); |
2796 |
|
2797 |
this.workingCopies[1] = getWorkingCopy( |
2798 |
"/Resolve/src/test/List.java", |
2799 |
"package test;\n" + |
2800 |
"public class List<E> {\n" + |
2801 |
"}"); |
2802 |
|
2803 |
String str = this.workingCopies[0].getSource(); |
2804 |
int start = str.lastIndexOf("emptyList"); |
2805 |
int length = "emptyList".length(); |
2806 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); |
2807 |
|
2808 |
assertElementsEqual( |
2809 |
"Unexpected elements", |
2810 |
"emptyList() {key=Ltest/Collections;.emptyList<T:Ljava/lang/Object;>()Ltest/List<TT;>;%<Ljava/lang/String;>} [in Collections [in [Working copy] Collections.java [in test [in src [in Resolve]]]]]", |
2811 |
elements, |
2812 |
true |
2813 |
); |
2814 |
} |
2815 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=209639 |
2816 |
public void test0120() throws Exception { |
2817 |
this.workingCopies = new ICompilationUnit[3]; |
2818 |
this.workingCopies[0] = getWorkingCopy( |
2819 |
"/Resolve/src/test/Test.java", |
2820 |
"package test;\n" + |
2821 |
"public class Test {\n" + |
2822 |
" public void foo() {\n" + |
2823 |
" List<String> local = Collections.emptyList();\n" + |
2824 |
" }\n" + |
2825 |
"}"); |
2826 |
|
2827 |
this.workingCopies[1] = getWorkingCopy( |
2828 |
"/Resolve/src/test/Collections.java", |
2829 |
"package test;\n" + |
2830 |
"public class Collections {\n" + |
2831 |
" public static final <T> List<T> emptyList() {return null;}\n" + |
2832 |
"}"); |
2833 |
|
2834 |
this.workingCopies[1] = getWorkingCopy( |
2835 |
"/Resolve/src/test/List.java", |
2836 |
"package test;\n" + |
2837 |
"public class List<E> {\n" + |
2838 |
"}"); |
2839 |
|
2840 |
String str = this.workingCopies[0].getSource(); |
2841 |
int start = str.lastIndexOf("emptyList"); |
2842 |
int length = "emptyList".length(); |
2843 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); |
2844 |
|
2845 |
assertElementsEqual( |
2846 |
"Unexpected elements", |
2847 |
"emptyList() {key=Ltest/Collections;.emptyList<T:Ljava/lang/Object;>()Ltest/List<TT;>;%<Ljava/lang/String;>} [in Collections [in [Working copy] Collections.java [in test [in src [in Resolve]]]]]", |
2848 |
elements, |
2849 |
true |
2850 |
); |
2851 |
} |
2852 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=209639 |
2853 |
public void test0121() throws Exception { |
2854 |
this.workingCopies = new ICompilationUnit[3]; |
2855 |
this.workingCopies[0] = getWorkingCopy( |
2856 |
"/Resolve/src/test/Test.java", |
2857 |
"package test;\n" + |
2858 |
"public class Test {\n" + |
2859 |
" List<String> field = Collections.emptyList();\n" + |
2860 |
" public void foo() {\n" + |
2861 |
" }\n" + |
2862 |
"}"); |
2863 |
|
2864 |
this.workingCopies[1] = getWorkingCopy( |
2865 |
"/Resolve/src/test/Collections.java", |
2866 |
"package test;\n" + |
2867 |
"public class Collections {\n" + |
2868 |
" public static final <T> List<T> emptyList() {return null;}\n" + |
2869 |
"}"); |
2870 |
|
2871 |
this.workingCopies[1] = getWorkingCopy( |
2872 |
"/Resolve/src/test/List.java", |
2873 |
"package test;\n" + |
2874 |
"public class List<E> {\n" + |
2875 |
"}"); |
2876 |
|
2877 |
String str = this.workingCopies[0].getSource(); |
2878 |
int start = str.lastIndexOf("emptyList"); |
2879 |
int length = "emptyList".length(); |
2880 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); |
2881 |
|
2882 |
assertElementsEqual( |
2883 |
"Unexpected elements", |
2884 |
"emptyList() {key=Ltest/Collections;.emptyList<T:Ljava/lang/Object;>()Ltest/List<TT;>;%<Ljava/lang/String;>} [in Collections [in [Working copy] Collections.java [in test [in src [in Resolve]]]]]", |
2885 |
elements, |
2886 |
true |
2887 |
); |
2888 |
} |
2889 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=209639 |
2890 |
public void test0122() throws Exception { |
2891 |
this.workingCopies = new ICompilationUnit[1]; |
2892 |
this.workingCopies[0] = getWorkingCopy( |
2893 |
"/Resolve/src/test/Test.java", |
2894 |
"package test;\n" + |
2895 |
"public class Test {\n" + |
2896 |
" static <T> T foo() { return null; }\n" + |
2897 |
" String[] strings = { foo() };\n" + |
2898 |
"}"); |
2899 |
|
2900 |
String str = this.workingCopies[0].getSource(); |
2901 |
int start = str.lastIndexOf("foo"); |
2902 |
int length = "foo".length(); |
2903 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length, this.wcOwner); |
2904 |
|
2905 |
assertElementsEqual( |
2906 |
"Unexpected elements", |
2907 |
"foo() {key=Ltest/Test;.foo<T:Ljava/lang/Object;>()TT;%<Ljava/lang/String;>} [in Test [in [Working copy] Test.java [in test [in src [in Resolve]]]]]", |
2908 |
elements, |
2909 |
true |
2910 |
); |
2911 |
} |
2778 |
} |
2912 |
} |