Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 53548 Details for
Bug 162621
[model][delta] Validation errors do not clear after replacing jar file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch + completion test
v01.txt (text/plain), 8.56 KB, created by
Frederic Fusier
on 2006-11-09 10:58:35 EST
(
hide
)
Description:
Proposed patch + completion test
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2006-11-09 10:58:35 EST
Size:
8.56 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v >retrieving revision 1.106 >diff -u -r1.106 ReconcilerTests.java >--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 8 Nov 2006 15:18:37 -0000 1.106 >+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 9 Nov 2006 16:00:04 -0000 >@@ -16,6 +16,7 @@ > > import junit.framework.Test; > >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IWorkspaceRunnable; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.ILogListener; >@@ -870,6 +871,84 @@ > } > } > /** >+ * @bug 162621: [model][delta] Validation errors do not clear after replacing jar file >+ * @test Ensures that changing an internal jar and refreshing takes the change into account >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162621" >+ */ >+public void testChangeInternalJar() throws CoreException, IOException { >+ IJavaProject project = getJavaProject("Reconciler"); >+ String jarName = "b162621.jar"; >+ try { >+ String[] pathAndContents = new String[] { >+ "test/before/Foo.java", >+ "package test.before;\n" + >+ "public class Foo {\n" + >+ "}\n" >+ }; >+ addLibrary(project, jarName, "b162621_src.zip", pathAndContents, JavaCore.VERSION_1_4); >+ >+ // Set working copy content with no error >+ setUpWorkingCopy("/Reconciler/src/test/Test.java", >+ "package test;\n" + >+ "import test.before.Foo;\n" + >+ "public class Test {\n" + >+ " Foo f;\n" + >+ "}\n" >+ ); >+ assertProblems( >+ "Unexpected problems", >+ "----------\n" + >+ "----------\n" >+ ); >+ >+ // Update working copy with Jar expected changes >+ String contents = "package test;\n" + >+ "import test.after.Foo;\n" + >+ "public class Test {\n" + >+ " Foo f;\n" + >+ "}\n"; >+ setWorkingCopyContents(contents); >+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true, null, null); >+ assertProblems( >+ "Wrong expected problems", >+ "----------\n" + >+ "1. ERROR in /Reconciler/src/test/Test.java (at line 2)\n" + >+ " import test.after.Foo;\n" + >+ " ^^^^^^^^^^\n" + >+ "The import test.after cannot be resolved\n" + >+ "----------\n" + >+ "2. ERROR in /Reconciler/src/test/Test.java (at line 4)\n" + >+ " Foo f;\n" + >+ " ^^^\n" + >+ "Foo cannot be resolved to a type\n" + >+ "----------\n" >+ ); >+ >+ // change jar and refresh >+ String projectLocation = project.getProject().getLocation().toOSString(); >+ String jarPath = projectLocation + File.separator + jarName; >+ org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { >+ "test/after/Foo.java", >+ "package test.after;\n" + >+ "public class Foo {\n" + >+ "}\n" >+ }, jarPath, "1.4"); >+ project.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); >+ >+ // Verify that error is gone >+ this.problemRequestor.initialize(contents.toCharArray()); >+ this.workingCopy.reconcile(ICompilationUnit.NO_AST, true, null, null); >+ assertProblems( >+ "Unexpected problems", >+ "----------\n" + >+ "----------\n" >+ ); >+ } finally { >+ removeLibraryEntry(project, new Path(jarName)); >+ deleteFile(new File(jarName)); >+ } >+} >+/** > * Ensures that the reconciler reconciles the new contents with the current > * contents,updating the structure of this reconciler's compilation > * unit, and fires the Java element deltas for the structural changes >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java,v >retrieving revision 1.29 >diff -u -r1.29 CompletionTests2.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests2.java 9 Oct 2006 10:57:55 -0000 1.29 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests2.java 9 Nov 2006 16:00:01 -0000 >@@ -20,6 +20,7 @@ > > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IWorkspaceRunnable; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >@@ -2249,4 +2250,74 @@ > this.deleteProject("P2"); > } > } >+/** >+ * @bug 162621: [model][delta] Validation errors do not clear after replacing jar file >+ * @test Ensures that changing an internal jar and refreshing takes the change into account >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162621" >+ */ >+public void testChangeInternalJar() throws CoreException, IOException { >+ String jarName = "b162621.jar"; >+ try { >+ // Create jar file with a class with 2 methods doXXX >+ String[] pathAndContents = new String[] { >+ "pack/Util.java", >+ "package pack;\n" + >+ "public class Util {\n" + >+ " public void doit2A(int x, int y) { }\n" + >+ " public void doit2B(int x) { }\n" + >+ "}\n" >+ }; >+ addLibrary(jarName, "b162621_src.zip", pathAndContents, JavaCore.VERSION_1_4); >+ >+ // Create compilation unit in which completion occurs >+ String path = "/Completion/src/test/Test.java"; >+ String source = "package test;\n" + >+ "import pack.*;\n" + >+ "public class Test {\n" + >+ " public void foo() {\n" + >+ " Util test = new Util();\n" + >+ " test.doit2A(1, 2);\n" + >+ " }\n" + >+ "}\n"; >+ createFolder("/Completion/src/test"); >+ createFile(path, source); >+ >+ // first completion >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >+ ICompilationUnit unit = getCompilationUnit(path); >+ String completeBehind = "test.do"; >+ int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length(); >+ unit.codeComplete(cursorLocation, requestor); >+ assertResults( >+ "doit2A[METHOD_REF]{doit2A, Lpack.Util;, (II)V, doit2A, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + >+ "doit2B[METHOD_REF]{doit2B, Lpack.Util;, (I)V, doit2B, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", >+ requestor.getResults()); >+ >+ // change class file to add a third doXXX method and refresh >+ String projectLocation = this.currentProject.getProject().getLocation().toOSString(); >+ String jarPath = projectLocation + File.separator + jarName; >+ org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { >+ "pack/Util.java", >+ "package pack;\n" + >+ "public class Util {\n" + >+ " public void doit2A(int x, int y) { }\n" + >+ " public void doit2B(int x) { }\n" + >+ " public void doit2C(int x) { }\n" + >+ "}\n" >+ }, jarPath, "1.4"); >+ this.currentProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); >+ >+ // second completion >+ requestor = new CompletionTestsRequestor2(); >+ unit.codeComplete(cursorLocation, requestor); >+ assertResults( >+ "doit2A[METHOD_REF]{doit2A, Lpack.Util;, (II)V, doit2A, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + >+ "doit2B[METHOD_REF]{doit2B, Lpack.Util;, (I)V, doit2B, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + >+ "doit2C[METHOD_REF]{doit2C, Lpack.Util;, (I)V, doit2C, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", >+ requestor.getResults()); >+ } finally { >+ removeLibraryEntry(this.currentProject, new Path(jarName)); >+ deleteFile(new File(jarName)); >+ } >+} > } >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/DeltaProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java,v >retrieving revision 1.291 >diff -u -r1.291 DeltaProcessor.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessor.java 6 Nov 2006 18:11:00 -0000 1.291 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessor.java 9 Nov 2006 16:00:07 -0000 >@@ -624,6 +624,9 @@ > int flags = IJavaElementDelta.F_CONTENT; > if (element instanceof JarPackageFragmentRoot){ > flags |= IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED; >+ // need also to reset project cache otherwise it will be out-of-date >+ // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=162621 >+ this.projectCachesToReset.add(element.getJavaProject()); > } > if (isPrimary) { > flags |= IJavaElementDelta.F_PRIMARY_RESOURCE;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 162621
:
52885
|
53543
| 53548