Lines 11-16
Link Here
|
11 |
package org.eclipse.jdt.core.tests.model; |
11 |
package org.eclipse.jdt.core.tests.model; |
12 |
|
12 |
|
13 |
|
13 |
|
|
|
14 |
import java.io.File; |
14 |
import java.io.IOException; |
15 |
import java.io.IOException; |
15 |
|
16 |
|
16 |
import junit.framework.Test; |
17 |
import junit.framework.Test; |
Lines 19-24
Link Here
|
19 |
import org.eclipse.core.runtime.CoreException; |
20 |
import org.eclipse.core.runtime.CoreException; |
20 |
import org.eclipse.core.runtime.IProgressMonitor; |
21 |
import org.eclipse.core.runtime.IProgressMonitor; |
21 |
import org.eclipse.core.runtime.OperationCanceledException; |
22 |
import org.eclipse.core.runtime.OperationCanceledException; |
|
|
23 |
import org.eclipse.core.runtime.Path; |
22 |
import org.eclipse.jdt.core.*; |
24 |
import org.eclipse.jdt.core.*; |
23 |
import org.eclipse.jdt.core.compiler.CompilationParticipant; |
25 |
import org.eclipse.jdt.core.compiler.CompilationParticipant; |
24 |
import org.eclipse.jdt.core.compiler.IProblem; |
26 |
import org.eclipse.jdt.core.compiler.IProblem; |
Lines 805-810
Link Here
|
805 |
" f2[*]: {CATEGORIES}" |
807 |
" f2[*]: {CATEGORIES}" |
806 |
); |
808 |
); |
807 |
} |
809 |
} |
|
|
810 |
/* |
811 |
* Ensures that changing and external jar and refreshing takes the change into account |
812 |
* (regression test for bug |
813 |
*/ |
814 |
public void testChangeExternalJar() throws CoreException, IOException { |
815 |
IJavaProject project = getJavaProject("Reconciler"); |
816 |
String jarPath = getExternalPath() + "lib.jar"; |
817 |
try { |
818 |
org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { |
819 |
"p/Y.java", |
820 |
"package p;\n" + |
821 |
"public class Y {\n" + |
822 |
" public void foo() {\n" + |
823 |
" }\n" + |
824 |
"}" |
825 |
}, jarPath, "1.4"); |
826 |
addLibraryEntry(project, jarPath, false); |
827 |
|
828 |
// force Y.class file to be cached during resolution |
829 |
setWorkingCopyContents( |
830 |
"package p1;\n" + |
831 |
"public class X extends p.Y {\n" + |
832 |
" public void bar() {\n" + |
833 |
" foo();\n" + |
834 |
" }\n" + |
835 |
"}"); |
836 |
this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null); |
837 |
|
838 |
// change jar and refresh |
839 |
org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { |
840 |
"p/Y.java", |
841 |
"package p;\n" + |
842 |
"public class Y {\n" + |
843 |
" public void foo(String s) {\n" + |
844 |
" }\n" + |
845 |
"}" |
846 |
}, jarPath, "1.4"); |
847 |
getJavaModel().refreshExternalArchives(null,null); |
848 |
|
849 |
setWorkingCopyContents( |
850 |
"package p1;\n" + |
851 |
"public class X extends p.Y {\n" + |
852 |
" public void bar() {\n" + |
853 |
" foo(\"a\");\n" + |
854 |
" }\n" + |
855 |
"}"); |
856 |
this.workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, null); |
857 |
assertProblems( |
858 |
"Unexpected problems", |
859 |
"----------\n" + |
860 |
"----------\n" |
861 |
); |
862 |
} finally { |
863 |
removeLibraryEntry(project, new Path(jarPath)); |
864 |
deleteFile(new File(jarPath)); |
865 |
} |
866 |
} |
808 |
/** |
867 |
/** |
809 |
* Ensures that the reconciler reconciles the new contents with the current |
868 |
* Ensures that the reconciler reconciles the new contents with the current |
810 |
* contents,updating the structure of this reconciler's compilation |
869 |
* contents,updating the structure of this reconciler's compilation |