Lines 4807-4810
Link Here
|
4807 |
deleteProject(project15); |
4807 |
deleteProject(project15); |
4808 |
} |
4808 |
} |
4809 |
} |
4809 |
} |
|
|
4810 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=325633 |
4811 |
public void testGenericAPIUsageFromA14Project5() throws CoreException { |
4812 |
IJavaProject project14 = null; |
4813 |
IJavaProject project15 = null; |
4814 |
try { |
4815 |
project15 = createJavaProject("Reconciler15API", new String[] {"src"}, new String[] {"JCL15_LIB"}, "bin"); |
4816 |
createFolder("/Reconciler15API/src/p2"); |
4817 |
createFile( |
4818 |
"/Reconciler15API/src/p2/List.java", |
4819 |
"package p2;\n" + |
4820 |
"public class List<T> {}\n" + |
4821 |
" public static List<String> [] getArray() {\n" + |
4822 |
" return null;\n" + |
4823 |
" }\n" + |
4824 |
" public static List<String> [] getBackArray(List<String>[] p) {\n" + |
4825 |
" return p;\n" + |
4826 |
" }\n" + |
4827 |
"}" |
4828 |
); |
4829 |
project15.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); |
4830 |
project15.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); |
4831 |
project15.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); |
4832 |
|
4833 |
project14 = createJavaProject("Reconciler1415", new String[] {"src"}, new String[] {"JCL_LIB"}, "bin"); |
4834 |
project14.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4); |
4835 |
project14.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_4); |
4836 |
project14.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4); |
4837 |
|
4838 |
IClasspathEntry[] oldClasspath = project14.getRawClasspath(); |
4839 |
int oldLength = oldClasspath.length; |
4840 |
IClasspathEntry[] newClasspath = new IClasspathEntry[oldLength+1]; |
4841 |
System.arraycopy(oldClasspath, 0, newClasspath, 0, oldLength); |
4842 |
newClasspath[oldLength] = JavaCore.newProjectEntry(new Path("/Reconciler15API")); |
4843 |
project14.setRawClasspath(newClasspath, null); |
4844 |
|
4845 |
createFolder("/Reconciler1415/src/p1"); |
4846 |
String source = |
4847 |
"package p1;\n" + |
4848 |
"import p2.List;\n" + |
4849 |
"public class X {\n" + |
4850 |
" private List [] l = List.getArray();\n" + |
4851 |
" private List [] l2 = List.getBackArray(l);\n" + |
4852 |
"}"; |
4853 |
|
4854 |
createFile( |
4855 |
"/Reconciler1415/src/p1/X.java", |
4856 |
source |
4857 |
); |
4858 |
|
4859 |
this.workingCopies = new ICompilationUnit[1]; |
4860 |
char[] sourceChars = source.toCharArray(); |
4861 |
this.problemRequestor.initialize(sourceChars); |
4862 |
this.workingCopies[0] = getCompilationUnit("/Reconciler1415/src/p1/X.java").getWorkingCopy(this.wcOwner, null); |
4863 |
assertProblems( |
4864 |
"Unexpected problems", |
4865 |
"----------\n" + |
4866 |
"1. WARNING in /Reconciler1415/src/p1/X.java (at line 5)\n" + |
4867 |
" private List [] l2 = List.getBackArray(l);\n" + |
4868 |
" ^^\n" + |
4869 |
"The field X.l2 is never read locally\n" + |
4870 |
"----------\n" |
4871 |
); |
4872 |
} finally { |
4873 |
if (project14 != null) |
4874 |
deleteProject(project14); |
4875 |
if (project15 != null) |
4876 |
deleteProject(project15); |
4877 |
} |
4878 |
} |
4810 |
} |
4879 |
} |