View | Details | Raw Unified | Return to bug 346175 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java (-2 / +40 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
12
13
import java.util.Map;
13
import java.util.Map;
14
14
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
16
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
16
17
17
import junit.framework.Test;
18
import junit.framework.Test;
Lines 24-30 Link Here
24
	// All specified tests which does not belong to the class are skipped...
25
	// All specified tests which does not belong to the class are skipped...
25
	static {
26
	static {
26
//		TESTS_NAMES = new String[] { "test127" };
27
//		TESTS_NAMES = new String[] { "test127" };
27
//		TESTS_NUMBERS = new int[] { 5 };
28
//		TESTS_NUMBERS = new int[] { 7 };
28
//		TESTS_RANGE = new int[] { 169, 180 };
29
//		TESTS_RANGE = new int[] { 169, 180 };
29
	}
30
	}
30
31
Lines 258-261 Link Here
258
			// javac options
259
			// javac options
259
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
260
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
260
	}
261
	}
262
	public void test007() {
263
		if (this.complianceLevel < ClassFileConstants.JDK1_5) {
264
			return;
265
		}
266
		Map customOptions = getCompilerOptions();
267
		customOptions.put(CompilerOptions.OPTION_FatalOptionalError,
268
				CompilerOptions.ENABLED);
269
		customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal,
270
				CompilerOptions.ERROR);
271
		customOptions.put(CompilerOptions.OPTION_SuppressWarnings,
272
				CompilerOptions.ENABLED);
273
		customOptions.put(CompilerOptions.OPTION_SuppressOptionalErrors,
274
				CompilerOptions.ENABLED);
275
		customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken,
276
				CompilerOptions.ERROR);
277
		runConformTest(
278
				new String[] { /* test files */
279
						"X.java",
280
						"public class X {\n" +
281
								"        @SuppressWarnings(\"unused\")\n" +
282
								"        static void foo() {\n" +
283
								"            String s = null;\n" +
284
								"            System.out.println(\"SUCCESS\");\n" +
285
								"        }\n" +
286
								"        public static void main(String argv[]) {\n" +
287
								"            foo();\n" +
288
								"        }\n" +
289
								"}"
290
				},
291
				"SUCCESS" /* expected output string */,
292
				null /* no class libraries */,
293
				true,
294
				null,
295
				customOptions /* custom options */,
296
				// compiler results
297
				null /* do not check error string */);
298
	}
261
}
299
}
(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveElementsTests.java (-2 / +2 lines)
Lines 2452-2458 Link Here
2452
	try {
2452
	try {
2453
		TestProgressMonitor monitor = TestProgressMonitor.getInstance();
2453
		TestProgressMonitor monitor = TestProgressMonitor.getInstance();
2454
		monitor.setCancelledCounter(1);
2454
		monitor.setCancelledCounter(1);
2455
		movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, monitor);
2455
		movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, true, monitor);
2456
	} catch (OperationCanceledException e) {
2456
	} catch (OperationCanceledException e) {
2457
		isCanceled = true;
2457
		isCanceled = true;
2458
	}
2458
	}
Lines 2488-2494 Link Here
2488
		try {
2488
		try {
2489
			TestProgressMonitor monitor = TestProgressMonitor.getInstance();
2489
			TestProgressMonitor monitor = TestProgressMonitor.getInstance();
2490
			monitor.setCancelledCounter(1);
2490
			monitor.setCancelledCounter(1);
2491
			movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, monitor);
2491
			movePositive(typeSource.getMethods(), new IJavaElement[] {typeDest}, null, null, false, true, monitor);
2492
		} catch (OperationCanceledException e) {
2492
		} catch (OperationCanceledException e) {
2493
			isCanceled = true;
2493
			isCanceled = true;
2494
		}
2494
		}
(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveResourcesTests.java (-37 / +70 lines)
Lines 80-86 Link Here
80
		}
80
		}
81
		IJavaElementDelta destDelta = this.deltaListener.getDeltaFor(container, true);
81
		IJavaElementDelta destDelta = this.deltaListener.getDeltaFor(container, true);
82
		assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
82
		assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
83
		IJavaElementDelta[] deltas = destDelta.getAddedChildren();
83
		IJavaElementDelta[] deltas = null;
84
		if (force) {
85
			deltas = destDelta.getChangedChildren();
86
		}
87
		else {
88
			deltas = destDelta.getAddedChildren();
89
		}
84
		// FIXME: not strong enough
90
		// FIXME: not strong enough
85
		boolean found = false;
91
		boolean found = false;
86
		for (int i = 0; i < deltas.length; i++) {
92
		for (int i = 0; i < deltas.length; i++) {
Lines 809-833 Link Here
809
 * existing CU.
815
 * existing CU.
810
 */
816
 */
811
public void testMoveCU03() throws CoreException {
817
public void testMoveCU03() throws CoreException {
812
	this.createFolder("/P/src/p1");
818
	try {
813
	this.createFile(
819
		this.createFolder("/P/src/p1");
814
		"/P/src/p1/X.java",
820
		this.createFile(
815
		"package p1;\n" +
821
			"/P/src/p1/X.java",
816
		"public class X {\n" +
822
			"package p1;\n" +
817
		"}"
823
			"public class X {\n" +
818
	);
824
			"}"
819
	ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
825
		);
826
		ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
820
827
821
	this.createFolder("/P/src/p2");
828
		this.createFolder("/P/src/p2");
822
	this.createFile(
829
		this.createFile(
823
		"/P/src/p2/X.java",
830
			"/P/src/p2/X.java",
824
		"package p2;\n" +
831
			"package p2;\n" +
825
		"public class X {\n" +
832
			"public class X {\n" +
826
		"}"
833
			"}"
827
	);
834
		);
828
	IPackageFragment pkgDest = getPackage("/P/src/p2");
835
		IPackageFragment pkgDest = getPackage("/P/src/p2");
829
836
		startDeltas();
830
	movePositive(cuSource, pkgDest, null, null, true);
837
		movePositive(new IJavaElement[] {cuSource}, new IJavaElement[] {pkgDest}, null, null, true, false, null);
838
			assertDeltas(
839
					"Incorrect delta",
840
					"P[*]: {CHILDREN}\n"
841
							+ "	src[*]: {CHILDREN}\n"
842
							+ "		p1[*]: {CHILDREN}\n"
843
							+ "			X.java[-]: {MOVED_TO(X.java [in p2 [in src [in P]]])}\n"
844
							+ "		p2[*]: {CHILDREN}\n"
845
							+ "			X.java[*]: {CONTENT | PRIMARY RESOURCE}");
846
	}
847
	finally {
848
		stopDeltas();
849
	}
831
}
850
}
832
/**
851
/**
833
 * Ensures that a CU can be moved to a different package,
852
 * Ensures that a CU can be moved to a different package,
Lines 853-877 Link Here
853
 * be renamed, overwriting an existing resource.
872
 * be renamed, overwriting an existing resource.
854
 */
873
 */
855
public void testMoveCU05() throws CoreException {
874
public void testMoveCU05() throws CoreException {
856
	this.createFolder("/P/src/p1");
875
	try {
857
	this.createFile(
876
		this.createFolder("/P/src/p1");
858
		"/P/src/p1/X.java",
877
		this.createFile(
859
		"package p1;\n" +
878
			"/P/src/p1/X.java",
860
		"public class X {\n" +
879
			"package p1;\n" +
861
		"}"
880
			"public class X {\n" +
862
	);
881
			"}"
863
	ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
882
		);
883
		ICompilationUnit cuSource = getCompilationUnit("/P/src/p1/X.java");
864
884
865
	this.createFolder("/P/src/p2");
885
		this.createFolder("/P/src/p2");
866
	this.createFile(
886
		this.createFile(
867
		"/P/src/p2/Y.java",
887
			"/P/src/p2/Y.java",
868
		"package p2;\n" +
888
			"package p2;\n" +
869
		"public class Y {\n" +
889
			"public class Y {\n" +
870
		"}"
890
			"}"
871
	);
891
		);
872
	IPackageFragment pkgDest = getPackage("/P/src/p2");
892
		IPackageFragment pkgDest = getPackage("/P/src/p2");
873
893
		startDeltas();
874
	movePositive(cuSource, pkgDest, null, "Y.java", true);
894
		movePositive(new IJavaElement[] {cuSource}, new IJavaElement[] {pkgDest}, null, new String[]{"Y.java"}, true, false, null);
895
		assertDeltas(
896
					"Incorrect delta",
897
					"P[*]: {CHILDREN}\n"
898
							+ "	src[*]: {CHILDREN}\n"
899
							+ "		p1[*]: {CHILDREN}\n"
900
							+ "			X.java[-]: {MOVED_TO(Y.java [in p2 [in src [in P]]])}\n"
901
							+ "		p2[*]: {CHILDREN}\n"
902
							+ "			Y.java[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n"
903
							+ "				Y[+]: {MOVED_FROM(X [in X.java [in p1 [in src [in P]]]])}");
904
	}
905
	finally {
906
		stopDeltas();
907
	}
875
}
908
}
876
/**
909
/**
877
 * Ensures that a CU cannot be moved to a different package, replacing an
910
 * Ensures that a CU cannot be moved to a different package, replacing an
(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CopyMoveTests.java (-17 / +22 lines)
Lines 253-264 Link Here
253
public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force) throws JavaModelException {
253
public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force) throws JavaModelException {
254
	movePositive(elements, destinations, siblings, names, force, null);
254
	movePositive(elements, destinations, siblings, names, force, null);
255
}
255
}
256
public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaModelException {
257
	movePositive(elements, destinations, siblings, names, force, true, null);
258
}
256
/**
259
/**
257
 * Moves the elements to the containers with optional renaming
260
 * Moves the elements to the containers with optional renaming
258
 * and forcing. The operation should succeed, so any exceptions
261
 * and forcing. The operation should succeed, so any exceptions
259
 * encountered are thrown.
262
 * encountered are thrown.
260
 */
263
 */
261
public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, IProgressMonitor monitor) throws JavaModelException {
264
public void movePositive(IJavaElement[] elements, IJavaElement[] destinations, IJavaElement[] siblings, String[] names, boolean force, boolean checkDelta, IProgressMonitor monitor) throws JavaModelException {
262
	// if forcing, ensure that a name collision exists
265
	// if forcing, ensure that a name collision exists
263
	int i;
266
	int i;
264
	if (force) {
267
	if (force) {
Lines 275-281 Link Here
275
	}
278
	}
276
279
277
	try {
280
	try {
278
		startDeltas();
281
		if(checkDelta)	startDeltas();
279
282
280
		// move
283
		// move
281
		getJavaModel().move(elements, destinations, siblings, names, force, monitor);
284
		getJavaModel().move(elements, destinations, siblings, names, force, monitor);
Lines 341-364 Link Here
341
					}
344
					}
342
				}
345
				}
343
			}
346
			}
344
			IJavaElementDelta destDelta = null;
347
			if(checkDelta) {
345
			if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu
348
				IJavaElementDelta destDelta = null;
346
				destDelta = this.deltaListener.getDeltaFor(moved.getParent());
349
				if (isMainType(element, destinations[i]) && names != null && names[i] != null) { //moved/renamed main type to same cu
347
				assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED);
350
					destDelta = this.deltaListener.getDeltaFor(moved.getParent());
348
				assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0);
351
					assertTrue("Renamed compilation unit as result of main type not added", destDelta != null && destDelta.getKind() == IJavaElementDelta.ADDED);
349
				assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(element.getParent()));
352
					assertTrue("flag should be F_MOVED_FROM", (destDelta.getFlags() & IJavaElementDelta.F_MOVED_FROM) > 0);
350
			} else {
353
					assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(element.getParent()));
351
				destDelta = this.deltaListener.getDeltaFor(destinations[i], true);
354
				} else {
352
				assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
355
					destDelta = this.deltaListener.getDeltaFor(destinations[i], true);
353
				IJavaElementDelta[] deltas = destDelta.getAddedChildren();
356
					assertTrue("Destination container not changed", destDelta != null && destDelta.getKind() == IJavaElementDelta.CHANGED);
354
				assertTrue("Added children not correct for element copy", deltas[i].getElement().equals(moved));
357
					IJavaElementDelta[] deltas = destDelta.getAddedChildren();
355
				assertTrue("should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED);
358
					assertTrue("Added children not correct for element copy", deltas[i].getElement().equals(moved));
356
				IJavaElementDelta sourceDelta= this.deltaListener.getDeltaFor(element, false);
359
					assertTrue("should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED);
357
				assertTrue("should be K_REMOVED", sourceDelta.getKind() == IJavaElementDelta.REMOVED);
360
					IJavaElementDelta sourceDelta= this.deltaListener.getDeltaFor(element, false);
361
					assertTrue("should be K_REMOVED", sourceDelta.getKind() == IJavaElementDelta.REMOVED);
362
				}
358
			}
363
			}
359
		}
364
		}
360
	} finally {
365
	} finally {
361
		stopDeltas();
366
		if(checkDelta)	stopDeltas();
362
	}
367
	}
363
}
368
}
364
}
369
}
(-)a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/RenameTests.java (-7 / +8 lines)
Lines 115-123 Link Here
115
			assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(e.getParent()));
115
			assertTrue("moved from handle should be original", destDelta.getMovedFromElement().equals(e.getParent()));
116
		} else {
116
		} else {
117
			assertTrue("Destination container not changed", destDelta != null && deltaChildrenChanged(destDelta));
117
			assertTrue("Destination container not changed", destDelta != null && deltaChildrenChanged(destDelta));
118
			IJavaElementDelta[] deltas = destDelta.getAddedChildren();
118
			IJavaElementDelta[] deltas = force ? destDelta.getChangedChildren() : destDelta.getAddedChildren();
119
			assertTrue("Added children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(renamed));
119
			assertTrue("Added children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(renamed));
120
			assertTrue("kind should be K_ADDED", deltas[i].getKind() == IJavaElementDelta.ADDED);
120
			assertTrue("kind should be K_ADDED", deltas[i].getKind() == (force? IJavaElementDelta.CHANGED : IJavaElementDelta.ADDED));
121
			deltas = destDelta.getRemovedChildren();
121
			deltas = destDelta.getRemovedChildren();
122
			assertTrue("Removed children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(e));
122
			assertTrue("Removed children not correct for element rename", deltas.length > i && deltas[i].getElement().equals(e));
123
			assertTrue("kind should be K_REMOVED", deltas[i].getKind() == IJavaElementDelta.REMOVED);
123
			assertTrue("kind should be K_REMOVED", deltas[i].getKind() == IJavaElementDelta.REMOVED);
Lines 364-374 Link Here
364
364
365
	assertDeltas(
365
	assertDeltas(
366
		"Unexpected deltas",
366
		"Unexpected deltas",
367
		"P[*]: {CHILDREN}\n" +
367
		"P[*]: {CHILDREN}\n" + 
368
		"	src[*]: {CHILDREN}\n" +
368
				"	src[*]: {CHILDREN}\n" + 
369
		"		<default>[*]: {CHILDREN}\n" +
369
				"		<default>[*]: {CHILDREN}\n" + 
370
		"			X.java[-]: {MOVED_TO(Y.java [in <default> [in src [in P]]])}\n" +
370
				"			X.java[-]: {MOVED_TO(Y.java [in <default> [in src [in P]]])}\n" + 
371
		"			Y.java[+]: {MOVED_FROM(X.java [in <default> [in src [in P]]])}"
371
				"			Y.java[*]: {CHILDREN | FINE GRAINED | PRIMARY RESOURCE}\n" + 
372
				"				Y[+]: {MOVED_FROM(X [in X.java [in <default> [in src [in P]]]])}"
372
	);
373
	);
373
}
374
}
374
/*
375
/*
(-)a/org.eclipse.jdt.core/buildnotes_jdt-core.html (-4 / +4 lines)
Lines 46-58 Link Here
46
<hr><h1>
46
<hr><h1>
47
Eclipse Platform Build Notes<br>
47
Eclipse Platform Build Notes<br>
48
Java development tools core</h1>
48
Java development tools core</h1>
49
Eclipse SDK 3.8.0 - %date% - December 2, 2011
49
Eclipse SDK 3.8.0 - December 20, 2011 - December 2, 2011
50
<br>Project org.eclipse.jdt.core v_C26
51
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_C26">cvs</a>).
52
<h2>What's new in this drop</h2>
50
<h2>What's new in this drop</h2>
53
51
54
<h3>Problem Reports Fixed</h3>
52
<h3>Problem Reports Fixed</h3>
55
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365835">365835</a>
53
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=362711">362711</a>
54
possibly incorrect JDT POST_CHANGE event fired when a file is replaced
55
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365835">365835</a>
56
[compiler][null] inconsistent error reporting.
56
[compiler][null] inconsistent error reporting.
57
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365836">365836</a>
57
<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=365836">365836</a>
58
[compiler][null] Incomplete propagation of null defaults.
58
[compiler][null] Incomplete propagation of null defaults.
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java (-1 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 361-366 Link Here
361
		}
361
		}
362
	}
362
	}
363
363
364
	public CompilationUnitDeclaration getCompilationUnitDeclaration() {
365
		if (this.scope != null) {
366
			return this.scope.compilationUnitScope().referenceContext;
367
		}
368
		return null;
369
	}
370
364
	public boolean hasErrors() {
371
	public boolean hasErrors() {
365
		return this.ignoreFurtherInvestigation;
372
		return this.ignoreFurtherInvestigation;
366
	}
373
	}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java (-1 / +23 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 364-369 Link Here
364
	}
364
	}
365
}
365
}
366
366
367
public CompilationUnitDeclaration getCompilationUnitDeclaration() {
368
	return this;
369
}
370
367
public char[] getFileName() {
371
public char[] getFileName() {
368
	return this.compilationResult.getFileName();
372
	return this.compilationResult.getFileName();
369
}
373
}
Lines 394-399 Link Here
394
	return CharOperation.equals(getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME);
398
	return CharOperation.equals(getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME);
395
}
399
}
396
400
401
public boolean isSuppressed(CategorizedProblem problem) {
402
	if (this.suppressWarningsCount == 0) return false;
403
	int irritant = ProblemReporter.getIrritant(problem.getID());
404
	if (irritant == 0) return false;
405
	int start = problem.getSourceStart();
406
	int end = problem.getSourceEnd();
407
	nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
408
		long position = this.suppressWarningScopePositions[iSuppress];
409
		int startSuppress = (int) (position >>> 32);
410
		int endSuppress = (int) position;
411
		if (start < startSuppress) continue nextSuppress;
412
		if (end > endSuppress) continue nextSuppress;
413
		if (this.suppressWarningIrritants[iSuppress].isSet(irritant))
414
			return true;
415
	}
416
	return false;
417
}
418
397
public boolean hasErrors() {
419
public boolean hasErrors() {
398
	return this.ignoreFurtherInvestigation;
420
	return this.ignoreFurtherInvestigation;
399
}
421
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 490-495 Link Here
490
		if (typeDecl != null) {
490
		if (typeDecl != null) {
491
			return typeDecl;
491
			return typeDecl;
492
		}
492
		}
493
	}
494
	return null;
495
}
496
497
public CompilationUnitDeclaration getCompilationUnitDeclaration() {
498
	if (this.scope != null) {
499
		return this.scope.compilationUnitScope().referenceContext;
493
	}
500
	}
494
	return null;
501
	return null;
495
}
502
}
Lines 1464-1467 Link Here
1464
public boolean isSecondary() {
1471
public boolean isSecondary() {
1465
	return (this.bits & ASTNode.IsSecondaryType) != 0;
1472
	return (this.bits & ASTNode.IsSecondaryType) != 0;
1466
}
1473
}
1474
1467
}
1475
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 18-23 Link Here
18
18
19
import org.eclipse.jdt.core.compiler.CategorizedProblem;
19
import org.eclipse.jdt.core.compiler.CategorizedProblem;
20
import org.eclipse.jdt.internal.compiler.CompilationResult;
20
import org.eclipse.jdt.internal.compiler.CompilationResult;
21
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
21
22
22
public interface ReferenceContext {
23
public interface ReferenceContext {
23
24
Lines 25-31 Link Here
25
26
26
	CompilationResult compilationResult();
27
	CompilationResult compilationResult();
27
28
29
	CompilationUnitDeclaration getCompilationUnitDeclaration();
30
28
	boolean hasErrors();
31
	boolean hasErrors();
29
32
30
	void tagAsHavingErrors();
33
	void tagAsHavingErrors();
34
31
}
35
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-20 Link Here
15
import org.eclipse.jdt.internal.compiler.CompilationResult;
15
import org.eclipse.jdt.internal.compiler.CompilationResult;
16
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
16
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
17
import org.eclipse.jdt.internal.compiler.IProblemFactory;
17
import org.eclipse.jdt.internal.compiler.IProblemFactory;
18
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
18
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
19
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
19
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
20
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
20
import org.eclipse.jdt.internal.compiler.util.Util;
21
import org.eclipse.jdt.internal.compiler.util.Util;
Lines 150-155 Link Here
150
		case ProblemSeverities.Error :
151
		case ProblemSeverities.Error :
151
			record(problem, unitResult, referenceContext);
152
			record(problem, unitResult, referenceContext);
152
			if ((severity & ProblemSeverities.Fatal) != 0) {
153
			if ((severity & ProblemSeverities.Fatal) != 0) {
154
				// don't abort or tag as error if the error is suppressed
155
				if (!referenceContext.hasErrors() && (severity & ProblemSeverities.Optional) != 0 && this.options.suppressOptionalErrors) {
156
					CompilationUnitDeclaration unitDecl = referenceContext.getCompilationUnitDeclaration();
157
					if (unitDecl != null && unitDecl.isSuppressed(problem)) {
158
						return;
159
					}
160
				}
153
				referenceContext.tagAsHavingErrors();
161
				referenceContext.tagAsHavingErrors();
154
				// should abort ?
162
				// should abort ?
155
				int abortLevel;
163
				int abortLevel;
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java (-6 / +17 lines)
Lines 266-285 Link Here
266
	 * <li>On a copy, the delta should be rooted in the dest project
266
	 * <li>On a copy, the delta should be rooted in the dest project
267
	 * <li>On a move, two deltas are generated<ul>
267
	 * <li>On a move, two deltas are generated<ul>
268
	 * 			<li>one rooted in the source project
268
	 * 			<li>one rooted in the source project
269
	 *			<li>one rooted in the destination project</ul></ul>
269
	 *			<li>one rooted in the destination project
270
	 * <li> When a CU is being overwritten, the delta on the destination will be of type F_CONTENT </ul></ul>
270
	 * If the operation is rooted in a single project, the delta is rooted in that project
271
	 * If the operation is rooted in a single project, the delta is rooted in that project
271
	 *
272
	 *
272
	 */
273
	 */
273
	protected void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove) {
274
	protected void prepareDeltas(IJavaElement sourceElement, IJavaElement destinationElement, boolean isMove, boolean overWriteCU) {
274
		if (Util.isExcluded(sourceElement) || Util.isExcluded(destinationElement)) return;
275
		if (Util.isExcluded(sourceElement) || Util.isExcluded(destinationElement)) return;
276
		
275
		IJavaProject destProject = destinationElement.getJavaProject();
277
		IJavaProject destProject = destinationElement.getJavaProject();
276
		if (isMove) {
278
		if (isMove) {
277
			IJavaProject sourceProject = sourceElement.getJavaProject();
279
			IJavaProject sourceProject = sourceElement.getJavaProject();
278
			getDeltaFor(sourceProject).movedFrom(sourceElement, destinationElement);
280
			getDeltaFor(sourceProject).movedFrom(sourceElement, destinationElement);
279
			getDeltaFor(destProject).movedTo(destinationElement, sourceElement);
281
			if (!overWriteCU) {
282
				getDeltaFor(destProject).movedTo(destinationElement, sourceElement);
283
				return;
284
			}
280
		} else {
285
		} else {
281
			getDeltaFor(destProject).added(destinationElement);
286
			if (!overWriteCU) {
287
				getDeltaFor(destProject).added(destinationElement);
288
				return;
289
			}
282
		}
290
		}
291
		getDeltaFor(destinationElement.getJavaProject()).changed(destinationElement, IJavaElementDelta.F_CONTENT);
283
	}
292
	}
284
	/**
293
	/**
285
	 * Copies/moves a compilation unit with the name <code>newCUName</code>
294
	 * Copies/moves a compilation unit with the name <code>newCUName</code>
Lines 357-368 Link Here
357
			}
366
			}
358
367
359
			// register the correct change deltas
368
			// register the correct change deltas
360
			prepareDeltas(source, destCU, isMove());
369
			boolean contentChanged = this.force && destFile.exists();
370
			prepareDeltas(source, destCU, isMove(), contentChanged);
371
			
361
			if (newCUName != null) {
372
			if (newCUName != null) {
362
				//the main type has been renamed
373
				//the main type has been renamed
363
				String oldName = Util.getNameWithoutJavaLikeExtension(source.getElementName());
374
				String oldName = Util.getNameWithoutJavaLikeExtension(source.getElementName());
364
				String newName = Util.getNameWithoutJavaLikeExtension(newCUName);
375
				String newName = Util.getNameWithoutJavaLikeExtension(newCUName);
365
				prepareDeltas(source.getType(oldName), destCU.getType(newName), isMove());
376
				prepareDeltas(source.getType(oldName), destCU.getType(newName), isMove(), false);
366
			}
377
			}
367
		} else {
378
		} else {
368
			if (!this.force) {
379
			if (!this.force) {

Return to bug 346175