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 208905 Details for
Bug 346175
@SuppressWarnings should clear all errors including fatal optional errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
A patch
patch.txt (text/plain), 23.80 KB, created by
Satyam Kandula
on 2012-01-02 04:06:37 EST
(
hide
)
Description:
A patch
Filename:
MIME Type:
Creator:
Satyam Kandula
Created:
2012-01-02 04:06:37 EST
Size:
23.80 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java >index 2d92f0d..50ef866 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2010 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -714,6 +714,38 @@ > // javac options > JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); > } >+public void test021() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) return; >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_FatalOptionalError, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED); >+ runNegativeTest( >+ // test directory preparation >+ true /* flush output directory */, >+ new String[] { /* test files */ >+ "Dum.java", >+ "public class Dum {\n" + >+ " public void some(@SuppressWarnings(\"unused\")int aParam) { \n" + >+ " int aLocal;\n" + >+ " }\n"+ >+ "}", >+ }, >+ // compiler options >+ null /* no class libraries */, >+ options /* custom options */, >+ // compiler results >+ "----------\n" + >+ "1. ERROR in Dum.java (at line 3)\n" + >+ " int aLocal;\n" + >+ " ^^^^^^\n" + >+ "The value of the local variable aLocal is not used\n" + >+ "----------\n", >+ // javac options >+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); >+ >+} > public static Class testClass() { > return LocalVariableTest.class; > } >diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java >index eec97ac..8ecb0b9 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java >@@ -2452,7 +2452,7 @@ > try { > TestProgressMonitor monitor = TestProgressMonitor.getInstance(); > monitor.setCancelledCounter(1); >- movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, monitor); >+ movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, true, monitor); > } catch (OperationCanceledException e) { > isCanceled = true; > } >@@ -2488,7 +2488,7 @@ > try { > TestProgressMonitor monitor = TestProgressMonitor.getInstance(); > monitor.setCancelledCounter(1); >- movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, monitor); >+ movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, true, monitor); > } catch (OperationCanceledException e) { > isCanceled = true; > } >diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java >index 3d4d1ec..2b68fd0 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java >@@ -80,7 +80,13 @@ > } > IJavaElementDelta destDelta = this.deltaListener.getDeltaFor(container, true); > assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED); >- IJavaElementDelta[] deltas = destDelta.getAddedChildren(); >+ IJavaElementDelta[] deltas = null; >+ if (force) { >+ deltas = destDelta.getChangedChildren(); >+ } >+ else { >+ deltas = destDelta.getAddedChildren(); >+ } > // FIXME: not strong enough > boolean found = false; > for (int i = 0; i < deltas.length; i++) { >@@ -809,25 +815,38 @@ > * existing CU. > */ > public void testMoveCU03() throws CoreException { >- this.createFolder("/P/src/p1"); >- this.createFile( >- "/P/src/p1/X.java", >- "package p1;\n" + >- "public class X {\n" + >- "}" >- ); >- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java"); >+ try { >+ this.createFolder("/P/src/p1"); >+ this.createFile( >+ "/P/src/p1/X.java", >+ "package p1;\n" + >+ "public class X {\n" + >+ "}" >+ ); >+ ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java"); > >- this.createFolder("/P/src/p2"); >- this.createFile( >- "/P/src/p2/X.java", >- "package p2;\n" + >- "public class X {\n" + >- "}" >- ); >- IPackageFragment pkgDest = getPackage("/P/src/p2"); >- >- movePositive(cuSource, pkgDest, null, null, true); >+ this.createFolder("/P/src/p2"); >+ this.createFile( >+ "/P/src/p2/X.java", >+ "package p2;\n" + >+ "public class X {\n" + >+ "}" >+ ); >+ IPackageFragment pkgDest = getPackage("/P/src/p2"); >+ startDeltas(); >+ movePositive(new IJavaElement[] {cuSource}, new IJavaElement[] {pkgDest}, null, null, true, false, null); >+ assertDeltas( >+ "Incorrect delta", >+ "P[*]: {CHILDREN}\n" >+ + " src[*]: {CHILDREN}\n" >+ + " p1[*]: {CHILDREN}\n" >+ + " X.java[-]: {MOVED_TO(X.java [in p2 [in src [in P]]])}\n" >+ + " p2[*]: {CHILDREN}\n" >+ + " X.java[*]: {CONTENT | PRIMARY RESOURCE}"); >+ } >+ finally { >+ stopDeltas(); >+ } > } > /** > * Ensures that a CU can be moved to a different package, >@@ -853,25 +872,39 @@ > * be renamed, overwriting an existing resource. > */ > public void testMoveCU05() throws CoreException { >- this.createFolder("/P/src/p1"); >- this.createFile( >- "/P/src/p1/X.java", >- "package p1;\n" + >- "public class X {\n" + >- "}" >- ); >- ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java"); >+ try { >+ this.createFolder("/P/src/p1"); >+ this.createFile( >+ "/P/src/p1/X.java", >+ "package p1;\n" + >+ "public class X {\n" + >+ "}" >+ ); >+ ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java"); > >- this.createFolder("/P/src/p2"); >- this.createFile( >- "/P/src/p2/Y.java", >- "package p2;\n" + >- "public class Y {\n" + >- "}" >- ); >- IPackageFragment pkgDest = getPackage("/P/src/p2"); >- >- movePositive(cuSource, pkgDest, null, "Y.java", true); >+ this.createFolder("/P/src/p2"); >+ this.createFile( >+ "/P/src/p2/Y.java", >+ "package p2;\n" + >+ "public class Y {\n" + >+ "}" >+ ); >+ IPackageFragment pkgDest = getPackage("/P/src/p2"); >+ startDeltas(); >+ movePositive(new IJavaElement[] {cuSource}, new IJavaElement[] {pkgDest}, null, new String[]{"Y.java"}, true, false, null); >+ assertDeltas( >+ "Incorrect delta", >+ "P[*]: {CHILDREN}\n" >+ + " src[*]: {CHILDREN}\n" >+ + " p1[*]: {CHILDREN}\n" >+ + " X.java[-]: {MOVED_TO(Y.java [in p2 [in src [in P]]])}\n" >+ + " p2[*]: {CHILDREN}\n" >+ + " Y.java[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" >+ + " Y[+]: {MOVED_FROM(X [in X.java [in p1 [in src [in P]]]])}"); >+ } >+ finally { >+ stopDeltas(); >+ } > } > /** > * Ensures that a CU cannot be moved to a different package, replacing an >diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java >index b1066ae..c03e393 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java >@@ -253,12 +253,15 @@ > public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force) throws JavaModelException { > movePositive(elements, destinations, siblings, names, force, null); > } >+public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaModelException { >+ movePositive(elements, destinations, siblings, names, force, true, null); >+} > /** > * Moves the elements to the containers with optional renaming > * and forcing. The operation should succeed, so any exceptions > * encountered are thrown. > */ >-public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaModelException { >+public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, boolean checkDelta, IProgressMonitor monitor) throws JavaModelException { > // if forcing, ensure that a name collision exists > int i; > if (force) { >@@ -275,7 +278,7 @@ > } > > try { >- startDeltas(); >+ if(checkDelta) startDeltas(); > > // move > getJavaModel().move(elements, destinations, siblings, names, force, monitor); >@@ -341,24 +344,26 @@ > } > } > } >- IJavaElementDelta destDelta = null; >- if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu >- destDelta = this.deltaListener.getDeltaFor(moved.getParent()); >- assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED); >- assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0); >- assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(element.getParent())); >- } else { >- destDelta = this.deltaListener.getDeltaFor(destinations[i], true); >- assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED); >- IJavaElementDelta[] deltas = destDelta.getAddedChildren(); >- assertTrue("Added children not correct for element copy", deltas[i].getElement().equals(moved)); >- assertTrue("should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED); >- IJavaElementDelta sourceDelta= this.deltaListener.getDeltaFor(element, false); >- assertTrue("should be K_REMOVED", sourceDelta.getKind() == IJavaElementDelta.REMOVED); >+ if(checkDelta) { >+ IJavaElementDelta destDelta = null; >+ if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu >+ destDelta = this.deltaListener.getDeltaFor(moved.getParent()); >+ assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED); >+ assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0); >+ assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(element.getParent())); >+ } else { >+ destDelta = this.deltaListener.getDeltaFor(destinations[i], true); >+ assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED); >+ IJavaElementDelta[] deltas = destDelta.getAddedChildren(); >+ assertTrue("Added children not correct for element copy", deltas[i].getElement().equals(moved)); >+ assertTrue("should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED); >+ IJavaElementDelta sourceDelta= this.deltaListener.getDeltaFor(element, false); >+ assertTrue("should be K_REMOVED", sourceDelta.getKind() == IJavaElementDelta.REMOVED); >+ } > } > } > } finally { >- stopDeltas(); >+ if(checkDelta) stopDeltas(); > } > } > } >diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java >index f08ed7a..92b80fa 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java >@@ -115,9 +115,9 @@ > assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(e.getParent())); > } else { > assertTrue("Destination container not changed", destDelta != null && deltaChildrenChanged(destDelta)); >- IJavaElementDelta[] deltas = destDelta.getAddedChildren(); >+ IJavaElementDelta[] deltas = force ? destDelta.getChangedChildren() : destDelta.getAddedChildren(); > assertTrue("Added children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(renamed)); >- assertTrue("kind should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED); >+ assertTrue("kind should be K_ADDED", deltas[i].getKind() == (force? IJavaElementDelta.CHANGED : IJavaElementDelta.ADDED)); > deltas = destDelta.getRemovedChildren(); > assertTrue("Removed children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(e)); > assertTrue("kind should be K_REMOVED", deltas[i].getKind() == IJavaElementDelta.REMOVED); >@@ -364,11 +364,12 @@ > > assertDeltas( > "Unexpected deltas", >- "P[*]: {CHILDREN}\n" + >- " src[*]: {CHILDREN}\n" + >- " <default>[*]: {CHILDREN}\n" + >- " X.java[-]: {MOVED_TO(Y.java [in <default> [in src [in P]]])}\n" + >- " Y.java[+]: {MOVED_FROM(X.java [in <default> [in src [in P]]])}" >+ "P[*]: {CHILDREN}\n" + >+ " src[*]: {CHILDREN}\n" + >+ " <default>[*]: {CHILDREN}\n" + >+ " X.java[-]: {MOVED_TO(Y.java [in <default> [in src [in P]]])}\n" + >+ " Y.java[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + >+ " Y[+]: {MOVED_FROM(X [in X.java [in <default> [in src [in P]]]])}" > ); > } > /* >diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html >index 93443ec..0e46cc5 100644 >--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html >+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html >@@ -46,13 +46,13 @@ > <hr><h1> > Eclipse Platform Build Notes<br> > Java development tools core</h1> >-Eclipse SDK 3.8.0 - %date% - December 2, 2011 >-<br>Project org.eclipse.jdt.core v_C26 >-(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C26">cvs</a>). >+Eclipse SDK 3.8.0 - December 20, 2011 - December 2, 2011 > <h2>What's new in this drop</h2> > > <h3>Problem Reports Fixed</h3> >-<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365835">365835</a> >+<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=362711">362711</a> >+possibly incorrect JDT POST_CHANGE event fired when a file is replaced >+<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365835">365835</a> > [compiler][null] inconsistent error reporting. > <br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365836">365836</a> > [compiler][null] Incomplete propagation of null defaults. >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >index f6d98fd..114dea8 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >@@ -361,6 +361,13 @@ > } > } > >+ public CompilationUnitDeclaration getCompilationUnitDeclaration() { >+ if (this.scope != null) { >+ return this.scope.compilationUnitScope().referenceContext; >+ } >+ return null; >+ } >+ > public boolean hasErrors() { > return this.ignoreFurtherInvestigation; > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >index eb6f64a..b8f3919 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >@@ -394,6 +394,20 @@ > return CharOperation.equals(getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME); > } > >+public boolean isSuppresed(int irritant, int start, int end) { >+ if (this.suppressWarningsCount == 0) return false; >+ nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) { >+ long position = this.suppressWarningScopePositions[iSuppress]; >+ int startSuppress = (int) (position >>> 32); >+ int endSuppress = (int) position; >+ if (start < startSuppress) continue nextSuppress; >+ if (end > endSuppress) continue nextSuppress; >+ if (this.suppressWarningIrritants[iSuppress].isSet(irritant)) >+ return true; >+ } >+ return false; >+} >+ > public boolean hasErrors() { > return this.ignoreFurtherInvestigation; > } >@@ -696,4 +710,8 @@ > // ignore > } > } >+ >+public CompilationUnitDeclaration getCompilationUnitDeclaration() { >+ return this; >+} > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >index f5d41ea..20b3a97 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >@@ -494,6 +494,13 @@ > return null; > } > >+public CompilationUnitDeclaration getCompilationUnitDeclaration() { >+ if (this.scope != null) { >+ return this.scope.compilationUnitScope().referenceContext; >+ } >+ return null; >+} >+ > /** > * Generic bytecode generation for type > */ >@@ -1464,4 +1471,5 @@ > public boolean isSecondary() { > return (this.bits & ASTNode.IsSecondaryType) != 0; > } >+ > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >index ec3f72b..2ee82fb 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -18,6 +18,7 @@ > > import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.internal.compiler.CompilationResult; >+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; > > public interface ReferenceContext { > >@@ -25,7 +26,10 @@ > > CompilationResult compilationResult(); > >+ CompilationUnitDeclaration getCompilationUnitDeclaration(); >+ > boolean hasErrors(); > > void tagAsHavingErrors(); >+ > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java >index 6baad99..4918e35 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java >@@ -15,6 +15,7 @@ > import org.eclipse.jdt.internal.compiler.CompilationResult; > import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; > import org.eclipse.jdt.internal.compiler.IProblemFactory; >+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; > import org.eclipse.jdt.internal.compiler.util.Util; >@@ -149,12 +150,21 @@ > switch (severity & ProblemSeverities.Error) { > case ProblemSeverities.Error : > record(problem, unitResult, referenceContext); >+ boolean suppressed = false; > if ((severity & ProblemSeverities.Fatal) != 0) { >- referenceContext.tagAsHavingErrors(); >- // should abort ? >- int abortLevel; >- if ((abortLevel = this.policy.stopOnFirstError() ? ProblemSeverities.AbortCompilation : severity & ProblemSeverities.Abort) != 0) { >- referenceContext.abort(abortLevel, problem); >+ if (!referenceContext.hasErrors() && (severity & ProblemSeverities.Optional) != 0) { >+ CompilationUnitDeclaration unitDecl = referenceContext.getCompilationUnitDeclaration(); >+ if (unitDecl != null) { >+ int irritant = ProblemReporter.getIrritant(problemId); >+ suppressed = unitDecl.isSuppresed(irritant, problemStartPosition, problemEndPosition); >+ } >+ } >+ if (!suppressed) { >+ referenceContext.tagAsHavingErrors(); >+ int abortLevel; >+ if ((abortLevel = this.policy.stopOnFirstError() ? ProblemSeverities.AbortCompilation : severity & ProblemSeverities.Abort) != 0) { >+ referenceContext.abort(abortLevel, problem); >+ } > } > } > break; >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java >index 291378c..426d41e 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java >@@ -266,20 +266,29 @@ > * <li>On a copy, the delta should be rooted in the dest project > * <li>On a move, two deltas are generated<ul> > * <li>one rooted in the source project >- * <li>one rooted in the destination project</ul></ul> >+ * <li>one rooted in the destination project >+ * <li> When a CU is being overwritten, the delta on the destination will be of type F_CONTENT </ul></ul> > * If the operation is rooted in a single project, the delta is rooted in that project > * > */ >- protected void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove) { >+ protected void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove, boolean overWriteCU) { > if (Util.isExcluded(sourceElement) || Util.isExcluded(destinationElement)) return; >+ > IJavaProject destProject = destinationElement.getJavaProject(); > if (isMove) { > IJavaProject sourceProject = sourceElement.getJavaProject(); > getDeltaFor(sourceProject).movedFrom(sourceElement, destinationElement); >- getDeltaFor(destProject).movedTo(destinationElement, sourceElement); >+ if (!overWriteCU) { >+ getDeltaFor(destProject).movedTo(destinationElement, sourceElement); >+ return; >+ } > } else { >- getDeltaFor(destProject).added(destinationElement); >+ if (!overWriteCU) { >+ getDeltaFor(destProject).added(destinationElement); >+ return; >+ } > } >+ getDeltaFor(destinationElement.getJavaProject()).changed(destinationElement, IJavaElementDelta.F_CONTENT); > } > /** > * Copies/moves a compilation unit with the name <code>newCUName</code> >@@ -357,12 +366,14 @@ > } > > // register the correct change deltas >- prepareDeltas(source, destCU, isMove()); >+ boolean contentChanged = this.force && destFile.exists(); >+ prepareDeltas(source, destCU, isMove(), contentChanged); >+ > if (newCUName != null) { > //the main type has been renamed > String oldName = Util.getNameWithoutJavaLikeExtension(source.getElementName()); > String newName = Util.getNameWithoutJavaLikeExtension(newCUName); >- prepareDeltas(source.getType(oldName), destCU.getType(newName), isMove()); >+ prepareDeltas(source.getType(oldName), destCU.getType(newName), isMove(), false); > } > } else { > if (!this.force) {
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 Raw
Actions:
View
Attachments on
bug 346175
:
208905
|
208926
|
208984