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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java (+42 lines)
Lines 21-26 Link Here
21
import org.eclipse.jdt.internal.core.JavaProject;
21
import org.eclipse.jdt.internal.core.JavaProject;
22
import java.io.*;
22
import java.io.*;
23
import java.util.*;
23
import java.util.*;
24
import java.util.jar.JarOutputStream;
25
import java.util.zip.ZipEntry;
24
26
25
public class TestingEnvironment {
27
public class TestingEnvironment {
26
	
28
	
Lines 109-114 Link Here
109
		return addClass(packageFragmentRootPath, className, contents);
111
		return addClass(packageFragmentRootPath, className, contents);
110
	}
112
	}
111
113
114
public void addClassFolder(IPath projectPath, IPath classFolderPath) throws JavaModelException {
115
	addEntry(projectPath, JavaCore.newLibraryEntry(classFolderPath, null, null));
116
}
117
112
	/** Adds a package to the given package fragment root
118
	/** Adds a package to the given package fragment root
113
	 * in the workspace.  The package fragment root is created
119
	 * in the workspace.  The package fragment root is created
114
	 * if necessary.  If a package with the same name already
120
	 * if necessary.  If a package with the same name already
Lines 288-293 Link Here
288
		return path;
294
		return path;
289
	}
295
	}
290
296
297
public IPath addInternalJar(IPath projectPath, String zipName, 
298
		String[] entryNames, String [] fileNames, boolean isExported) 
299
			throws JavaModelException {
300
	try {
301
		checkAssertion("entryNames must not be null", entryNames != null);
302
		checkAssertion("fileNames must not be null", fileNames != null);
303
		int entriesNb = entryNames.length;
304
		checkAssertion("entryNames and fileNames must have the same length", 
305
			entriesNb == fileNames.length);
306
		ByteArrayOutputStream sinkArray = new ByteArrayOutputStream();
307
		BufferedOutputStream outputBuffer = new BufferedOutputStream(sinkArray);
308
		BufferedInputStream inputBuffer;
309
		IProject project = getProject(projectPath);
310
		JarOutputStream jar = new JarOutputStream(outputBuffer);
311
		byte[] bytes = new byte[1024];
312
		for (int i = 0; i < entriesNb; i++) {
313
			ZipEntry classFile = new ZipEntry(entryNames[i]);
314
			jar.putNextEntry(classFile);
315
			inputBuffer = new BufferedInputStream(
316
				project.getFile(fileNames[i]).getContents());
317
			int bytesNb;
318
			while ((bytesNb = inputBuffer.read(bytes)) != -1) {
319
				jar.write(bytes, 0, bytesNb);
320
			}
321
			inputBuffer.close();
322
		}
323
		jar.close();
324
		outputBuffer.close();
325
		return addInternalJar(projectPath, zipName, sinkArray.toByteArray());
326
	} catch (Exception e) {
327
		e.printStackTrace();
328
		checkAssertion("could not create jar file", false);
329
		return null; // won't get here
330
	}
331
}
332
291
	private void checkAssertion(String message, boolean b) {
333
	private void checkAssertion(String message, boolean b) {
292
		Assert.isTrue(b, message);
334
		Assert.isTrue(b, message);
293
	}
335
	}
(-)src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java (-1 / +439 lines)
Lines 14-21 Link Here
14
14
15
import junit.framework.Test;
15
import junit.framework.Test;
16
16
17
import org.eclipse.core.resources.IProject;
18
import org.eclipse.core.resources.IResourceChangeEvent;
19
import org.eclipse.core.resources.IResourceChangeListener;
20
import org.eclipse.core.resources.IWorkspaceDescription;
21
import org.eclipse.core.resources.WorkspaceJob;
22
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IPath;
23
import org.eclipse.core.runtime.IPath;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.Path;
26
import org.eclipse.core.runtime.Path;
27
import org.eclipse.core.runtime.Status;
19
import org.eclipse.jdt.core.IAccessRule;
28
import org.eclipse.jdt.core.IAccessRule;
20
import org.eclipse.jdt.core.JavaCore;
29
import org.eclipse.jdt.core.JavaCore;
21
import org.eclipse.jdt.core.JavaModelException;
30
import org.eclipse.jdt.core.JavaModelException;
Lines 780-785 Link Here
780
		}
789
		}
781
	}
790
	}
782
	
791
	
792
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349
793
//	 this one fails; compare with testCycle7 (only one change in Object source),
794
//	 which passes
795
	public void testCycle6() throws JavaModelException {
796
		Hashtable options = JavaCore.getOptions();
797
		Hashtable newOptions = JavaCore.getOptions();
798
		newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
799
		
800
		JavaCore.setOptions(newOptions);
801
		
802
		//----------------------------
803
		//         Project1
804
		//----------------------------
805
		IPath p1 = env.addProject("P1");
806
		// remove old package fragment root so that names don't collide
807
		env.removePackageFragmentRoot(p1, "");
808
		IPath root1 = env.addPackageFragmentRoot(p1, "src");
809
		env.setOutputFolder(p1, "bin");
810
		
811
		env.addClass(root1, "java/lang", "Object",
812
			"package java.lang;\n" +
813
			"public class Object {\n" +
814
			"  Class getClass() { return null; }\n" +
815
			"  String toString() { return \"\"; }\n" +	// the line that changes
816
			"}\n"
817
			);
818
			
819
		//----------------------------
820
		//         Project2
821
		//----------------------------
822
		IPath p2 = env.addProject("P2");
823
		// remove old package fragment root so that names don't collide
824
		env.removePackageFragmentRoot(p2, "");
825
		IPath root2 = env.addPackageFragmentRoot(p2, "src");
826
		env.setOutputFolder(p2, "bin");
827
		
828
		env.addClass(root2, "java/lang", "Class",
829
			"package java.lang;\n" +
830
			"public class Class {\n" +
831
			"  String getName() { return \"\"; };\n" +
832
			"}\n"
833
			);
834
835
		//----------------------------
836
		//         Project3
837
		//----------------------------
838
		IPath p3 = env.addProject("P3");
839
		// remove old package fragment root so that names don't collide
840
		env.removePackageFragmentRoot(p3, "");
841
		IPath root3 = env.addPackageFragmentRoot(p3, "src");
842
		env.setOutputFolder(p3, "bin");
843
		
844
		env.addClass(root3, "java/lang", "String",
845
			"package java.lang;\n" +
846
			"public class String {\n" +
847
			"}\n"
848
			);
849
850
		// Dependencies
851
		IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")};
852
		IPath[] forbiddenPaths = new IPath[] {new Path("**/*")};
853
		env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false);
854
		env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false);
855
		env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false);
856
		env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false);
857
		env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false);
858
		env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false);
859
860
		try {
861
			fullBuild();
862
863
			expectingOnlySpecificProblemsFor(p1,new Problem[]{
864
				new Problem("p1", "A cycle was detected in the build path of project: P1", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$
865
			});
866
			expectingOnlySpecificProblemsFor(p2,new Problem[]{
867
				new Problem("p2", "A cycle was detected in the build path of project: P2", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$
868
			});
869
			expectingOnlySpecificProblemsFor(p3,new Problem[]{
870
				new Problem("p3", "A cycle was detected in the build path of project: P3", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$
871
			});
872
			
873
		} finally {
874
			JavaCore.setOptions(options);
875
		}
876
	}
877
878
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349
879
//	 this one passes; compare with testCycle6 (only one change in Object source),
880
//	 which fails
881
	public void testCycle7() throws JavaModelException {
882
		Hashtable options = JavaCore.getOptions();
883
		Hashtable newOptions = JavaCore.getOptions();
884
		newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
885
		
886
		JavaCore.setOptions(newOptions);
887
		
888
		//----------------------------
889
		//         Project1
890
		//----------------------------
891
		IPath p1 = env.addProject("P1");
892
		// remove old package fragment root so that names don't collide
893
		env.removePackageFragmentRoot(p1, "");
894
		IPath root1 = env.addPackageFragmentRoot(p1, "src");
895
		env.setOutputFolder(p1, "bin");
896
		
897
		env.addClass(root1, "java/lang", "Object",
898
			"package java.lang;\n" +
899
			"public class Object {\n" +
900
			"  Class getClass() { return null; }\n" +
901
			"  String toString() { return null; }\n" +	// the line that changes
902
			"}\n"
903
			);
904
			
905
		//----------------------------
906
		//         Project2
907
		//----------------------------
908
		IPath p2 = env.addProject("P2");
909
		// remove old package fragment root so that names don't collide
910
		env.removePackageFragmentRoot(p2, "");
911
		IPath root2 = env.addPackageFragmentRoot(p2, "src");
912
		env.setOutputFolder(p2, "bin");
913
		
914
		env.addClass(root2, "java/lang", "Class",
915
			"package java.lang;\n" +
916
			"public class Class {\n" +
917
			"  String getName() { return \"\"; };\n" +
918
			"}\n"
919
			);
920
921
		//----------------------------
922
		//         Project3
923
		//----------------------------
924
		IPath p3 = env.addProject("P3");
925
		// remove old package fragment root so that names don't collide
926
		env.removePackageFragmentRoot(p3, "");
927
		IPath root3 = env.addPackageFragmentRoot(p3, "src");
928
		env.setOutputFolder(p3, "bin");
929
		
930
		env.addClass(root3, "java/lang", "String",
931
			"package java.lang;\n" +
932
			"public class String {\n" +
933
			"}\n"
934
			);
935
936
		// Dependencies
937
		IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")};
938
		IPath[] forbiddenPaths = new IPath[] {new Path("**/*")};
939
		env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false);
940
		env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false);
941
		env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false);
942
		env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false);
943
		env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false);
944
		env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false);
945
946
		try {
947
			fullBuild();
948
949
			expectingOnlySpecificProblemsFor(p1,new Problem[]{
950
				new Problem("p1", "A cycle was detected in the build path of project: P1", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$
951
			});
952
			expectingOnlySpecificProblemsFor(p2,new Problem[]{
953
				new Problem("p2", "A cycle was detected in the build path of project: P2", p2, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$
954
			});
955
			expectingOnlySpecificProblemsFor(p3,new Problem[]{
956
				new Problem("p3", "A cycle was detected in the build path of project: P3", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH)//$NON-NLS-1$ //$NON-NLS-2$
957
			});
958
			
959
		} finally {
960
			JavaCore.setOptions(options);
961
		}
962
	}
963
	
783
	/*
964
	/*
784
	 * Full buid case
965
	 * Full buid case
785
	 */
966
	 */
Lines 1223-1227 Link Here
1223
			env.setBuildOrder(null);
1404
			env.setBuildOrder(null);
1224
		}
1405
		}
1225
	}
1406
	}
1226
	
1407
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=160550
1408
	public void test0100_cycle_with_bad_library() throws CoreException {
1409
		Hashtable options = JavaCore.getOptions();
1410
		Hashtable newOptions = JavaCore.getOptions();
1411
		newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
1412
		JavaCore.setOptions(newOptions);
1413
		try {
1414
			// jar preparation (broken jar: l/Super.class missing)
1415
			IPath brokenLibProjectPath = env.addProject("Lib");
1416
			env.addExternalJars(brokenLibProjectPath, Util.getJavaClassLibs());
1417
			IProject brokenLibProject = env.getProject(brokenLibProjectPath);
1418
			env.removePackageFragmentRoot(brokenLibProjectPath, "");
1419
			IPath root0 = env.addPackageFragmentRoot(brokenLibProjectPath, "src");
1420
			env.setOutputFolder(brokenLibProjectPath, "bin");
1421
			env.addClass(root0, "l", "Super",
1422
				"package l;\n" +
1423
				"public class Super {\n" +
1424
				"}\n"
1425
			);
1426
			env.addClass(root0, "l", "Sub",
1427
				"package l;\n" +
1428
				"public class Sub extends Super {\n" +
1429
				"}\n"
1430
			);
1431
			fullBuild();
1432
			String brokenLibJarExternalPath =
1433
				env.addInternalJar(brokenLibProjectPath, "broken.jar", 
1434
					new String[] {"l/Sub.class"}, new String[]{"bin/l/Sub.class"},
1435
					// avoid to include Super on purpose
1436
					false).toString();
1437
			//----------------------------
1438
			//         Project1
1439
			//----------------------------
1440
			IPath p1 = env.addProject("P1");
1441
			// remove old package fragment root so that names don't collide
1442
			env.removePackageFragmentRoot(p1, "");
1443
			IPath root1 = env.addPackageFragmentRoot(p1, "src");
1444
			env.setOutputFolder(p1, "bin");
1445
			env.addExternalJars(p1, Util.getJavaClassLibs());
1446
			env.addExternalJar(p1, brokenLibJarExternalPath);
1447
			/* IPath xPath = */ env.addClass(root1, "p", "X",
1448
				"package p;\n" +
1449
				"public class X extends l.Sub {\n" +
1450
				"  q.Y m;\n" +
1451
				"}\n"
1452
				);
1453
			//----------------------------
1454
			//         Project2
1455
			//----------------------------
1456
			IPath p2 = env.addProject("P2");
1457
			// remove old package fragment root so that names don't collide
1458
			env.removePackageFragmentRoot(p2, "");
1459
			IPath root2 = env.addPackageFragmentRoot(p2, "src");
1460
			env.setOutputFolder(p2, "bin");
1461
			env.addExternalJars(p2, Util.getJavaClassLibs());
1462
			env.addExternalJar(p2, brokenLibJarExternalPath);
1463
			/* IPath yPath = */ env.addClass(root2, "q", "Y",
1464
				"package q;\n" +
1465
				"public class Y extends l.Sub {\n" +
1466
				"  p.X m;\n" +
1467
				"}\n"
1468
				);
1469
			// Dependencies
1470
			env.addRequiredProject(p1, p2, null, null, false);
1471
			env.addRequiredProject(p2, p1, null, null, false);
1472
			// Re-launcher
1473
			class PostBuildJob extends WorkspaceJob implements IResourceChangeListener {
1474
				int invocationsNb = 0;
1475
				public PostBuildJob() {
1476
					super("Post build");
1477
				}
1478
				public void resourceChanged(IResourceChangeEvent event) {
1479
					invocationsNb++;
1480
					if (DEBUG) {
1481
						System.out.println("event #" + invocationsNb);
1482
					}
1483
					schedule(100);
1484
				}
1485
				public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
1486
					try {
1487
						Thread.sleep(500);
1488
					} catch (InterruptedException e) { /*  */ }
1489
					return Status.OK_STATUS;
1490
				}
1491
			}
1492
			PostBuildJob listener = new PostBuildJob();
1493
			try {
1494
				fullBuild();
1495
	// TODO the problems layout is changed by patches, hence they are deactivated for now
1496
	//			expectingOnlySpecificProblemsFor(p1, new Problem[] {
1497
	//				new Problem("p1", "A cycle was detected in the build path of project: P1", 
1498
	//					p1, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1499
	//				new Problem("p1", "The project was not built since its build path is incomplete. Cannot find the class file for l.Super. Fix the build path then try building this project", 
1500
	//					p1, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1501
	//				new Problem("p1", "The type l.Super cannot be resolved. It is indirectly referenced from required .class files", 
1502
	//					xPath, 34, 39, CategorizedProblem.CAT_BUILDPATH),
1503
	//			});
1504
	//			expectingOnlySpecificProblemsFor(p2, new Problem[] {
1505
	//				new Problem("p2", "A cycle was detected in the build path of project: P2", 
1506
	//					p2, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1507
	//				new Problem("p2", "The project was not built since its build path is incomplete. Cannot find the class file for l.Super. Fix the build path then try building this project", 
1508
	//					p2, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1509
	//				new Problem("p2", "The type l.Super cannot be resolved. It is indirectly referenced from required .class files", 
1510
	//					yPath, 34, 39, CategorizedProblem.CAT_BUILDPATH),
1511
	//			});
1512
				IWorkspaceDescription description = brokenLibProject.getWorkspace().getDescription();
1513
				description.setAutoBuilding(true);
1514
				brokenLibProject.getWorkspace().setDescription(description);
1515
				brokenLibProject.getWorkspace().
1516
					addResourceChangeListener(listener, IResourceChangeEvent.POST_BUILD);
1517
				env.addClass(root1, "p", "X",
1518
					"package p;\n" +
1519
					"public class X extends l.Sub {\n" +
1520
					"  q.Y m;\n" +
1521
					"}\n"
1522
					);
1523
				try {
1524
					Thread.sleep(3000); // beware, too low a delay would miss the point
1525
				} catch (InterruptedException e) { /*  */ }
1526
				if (listener.invocationsNb > 1) {
1527
					fail("looping in build (" + listener.invocationsNb + " invocations)");
1528
				}
1529
			} finally {
1530
				brokenLibProject.getWorkspace().removeResourceChangeListener(listener);
1531
				brokenLibProject.getWorkspace().getDescription().setAutoBuilding(false);
1532
			}
1533
		} finally {
1534
			JavaCore.setOptions(options);
1535
		}
1536
	}	
1537
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=160550
1538
	public void test0101_cycle_with_bad_class_folder() throws CoreException {
1539
		Hashtable options = JavaCore.getOptions();
1540
		Hashtable newOptions = JavaCore.getOptions();
1541
		newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
1542
		JavaCore.setOptions(newOptions);
1543
		try {
1544
			// jar preparation (broken jar: l/Super.class missing)
1545
			IPath brokenLibProjectPath = env.addProject("Lib");
1546
			env.addExternalJars(brokenLibProjectPath, Util.getJavaClassLibs());
1547
			IProject brokenLibProject = env.getProject(brokenLibProjectPath);
1548
			env.removePackageFragmentRoot(brokenLibProjectPath, "");
1549
			IPath root0 = env.addPackageFragmentRoot(brokenLibProjectPath,
1550
				"src1", null, false, "bin1");
1551
			env.addClass(root0, "l", "Super",
1552
				"package l;\n" +
1553
				"public class Super {\n" +
1554
				"}\n"
1555
			);
1556
			root0 = env.addPackageFragmentRoot(brokenLibProjectPath,
1557
				"src2", null, false, "bin2");
1558
			env.addClass(root0, "l", "Sub",
1559
				"package l;\n" +
1560
				"public class Sub extends Super {\n" +
1561
				"}\n"
1562
			);
1563
			fullBuild();
1564
			IPath brokenClassFolderPath = brokenLibProjectPath.append("bin2");
1565
			//----------------------------
1566
			//         Project1
1567
			//----------------------------
1568
			IPath p1 = env.addProject("P1");
1569
			// remove old package fragment root so that names don't collide
1570
			env.removePackageFragmentRoot(p1, "");
1571
			IPath root1 = env.addPackageFragmentRoot(p1, "src");
1572
			env.setOutputFolder(p1, "bin");
1573
			env.addExternalJars(p1, Util.getJavaClassLibs());
1574
			env.addClassFolder(p1, brokenClassFolderPath);
1575
			/* IPath xPath = */ env.addClass(root1, "p", "X",
1576
				"package p;\n" +
1577
				"public class X extends l.Sub {\n" +
1578
				"  q.Y m;\n" +
1579
				"}\n"
1580
				);
1581
			//----------------------------
1582
			//         Project2
1583
			//----------------------------
1584
			IPath p2 = env.addProject("P2");
1585
			// remove old package fragment root so that names don't collide
1586
			env.removePackageFragmentRoot(p2, "");
1587
			IPath root2 = env.addPackageFragmentRoot(p2, "src");
1588
			env.setOutputFolder(p2, "bin");
1589
			env.addExternalJars(p2, Util.getJavaClassLibs());
1590
			env.addClassFolder(p2, brokenClassFolderPath);
1591
			/* IPath yPath = */ env.addClass(root2, "q", "Y",
1592
				"package q;\n" +
1593
				"public class Y extends l.Sub {\n" +
1594
				"  p.X m;\n" +
1595
				"}\n"
1596
				);
1597
			// Dependencies
1598
			env.addRequiredProject(p1, p2, null, null, false);
1599
			env.addRequiredProject(p2, p1, null, null, false);
1600
			// Re-launcher
1601
			class PostBuildJob extends WorkspaceJob implements IResourceChangeListener {
1602
				int invocationsNb = 0;
1603
				public PostBuildJob() {
1604
					super("Post build");
1605
				}
1606
				public void resourceChanged(IResourceChangeEvent event) {
1607
					invocationsNb++;
1608
					if (DEBUG) {
1609
						System.out.println("event #" + invocationsNb);
1610
					}
1611
					schedule(100);
1612
				}
1613
				public IStatus	 runInWorkspace(IProgressMonitor monitor) throws CoreException {
1614
					try {
1615
						Thread.sleep(500);
1616
					} catch (InterruptedException e) { /*  */ }
1617
					return Status.OK_STATUS;
1618
				}
1619
			}
1620
			PostBuildJob listener = new PostBuildJob();
1621
			try {
1622
				fullBuild();
1623
	// TODO the problems layout is changed by patches, hence they are deactivated for now
1624
	//			expectingOnlySpecificProblemsFor(p1, new Problem[] {
1625
	//				new Problem("p1", "A cycle was detected in the build path of project: P1", 
1626
	//					p1, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1627
	//				new Problem("p1", "The project was not built since its build path is incomplete. Cannot find the class file for l.Super. Fix the build path then try building this project", 
1628
	//					p1, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1629
	//				new Problem("p1", "The type l.Super cannot be resolved. It is indirectly referenced from required .class files", 
1630
	//					xPath, 34, 39, CategorizedProblem.CAT_BUILDPATH),
1631
	//			});
1632
	//			expectingOnlySpecificProblemsFor(p2, new Problem[] {
1633
	//				new Problem("p2", "A cycle was detected in the build path of project: P2", 
1634
	//					p2, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1635
	//				new Problem("p2", "The project was not built since its build path is incomplete. Cannot find the class file for l.Super. Fix the build path then try building this project", 
1636
	//					p2, -1, -1, CategorizedProblem.CAT_BUILDPATH),
1637
	//				new Problem("p2", "The type l.Super cannot be resolved. It is indirectly referenced from required .class files", 
1638
	//					yPath, 34, 39, CategorizedProblem.CAT_BUILDPATH),
1639
	//			});
1640
				IWorkspaceDescription description = brokenLibProject.getWorkspace().getDescription();
1641
				description.setAutoBuilding(true);
1642
				brokenLibProject.getWorkspace().setDescription(description);
1643
				brokenLibProject.getWorkspace().
1644
					addResourceChangeListener(listener, IResourceChangeEvent.POST_BUILD);
1645
				env.addClass(root1, "p", "X",
1646
					"package p;\n" +
1647
					"public class X extends l.Sub {\n" +
1648
					"  q.Y m;\n" +
1649
					"}\n"
1650
					);
1651
				try {
1652
					Thread.sleep(3000); // beware, too low a delay would miss the point
1653
				} catch (InterruptedException e) { /*  */ }
1654
				if (listener.invocationsNb > 1) {
1655
					fail("looping in build (" + listener.invocationsNb + " invocations)");
1656
				}
1657
			} finally {
1658
				brokenLibProject.getWorkspace().removeResourceChangeListener(listener);
1659
				brokenLibProject.getWorkspace().getDescription().setAutoBuilding(false);
1660
			}
1661
		} finally {
1662
			JavaCore.setOptions(options);
1663
		}
1664
	}		
1227
}
1665
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-1 / +41 lines)
Lines 144-150 Link Here
144
	return type;
144
	return type;
145
}
145
}
146
146
147
147
/**
148
 * Standard constructor for creating binary type bindings from binary models (classfiles)
149
 * @param packageBinding
150
 * @param binaryType
151
 * @param environment
152
 */
148
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment) {
153
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment) {
149
	this.compoundName = CharOperation.splitOn('/', binaryType.getName());
154
	this.compoundName = CharOperation.splitOn('/', binaryType.getName());
150
	computeId();
155
	computeId();
Lines 183-188 Link Here
183
	}	
188
	}	
184
}
189
}
185
190
191
/**
192
 * Special constructor for constructing proxies of missing binary types (114349)
193
 * @param packageBinding
194
 * @param compoundName
195
 * @param environment
196
 */
197
BinaryTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
198
	this.compoundName = compoundName;
199
	computeId();
200
	this.tagBits |= TagBits.IsBinaryBinding;
201
	this.environment = environment;
202
	this.fPackage = packageBinding;
203
	this.fileName = CharOperation.concatWith(compoundName, '/');
204
	this.sourceName = CharOperation.concatWith(compoundName, '.');
205
	this.modifiers = ClassFileConstants.AccPublic;
206
	this.superclass = null;
207
	this.superInterfaces = Binding.NO_SUPERINTERFACES;
208
	this.typeVariables = Binding.NO_TYPE_VARIABLES;
209
	this.memberTypes = Binding.NO_MEMBER_TYPES;
210
	this.fields = Binding.NO_FIELDS;
211
	this.methods = Binding.NO_METHODS;
212
}
213
186
public FieldBinding[] availableFields() {
214
public FieldBinding[] availableFields() {
187
	if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
215
	if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
188
		return fields;
216
		return fields;
Lines 899-907 Link Here
899
	method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
927
	method.modifiers &= ~ExtraCompilerModifiers.AccUnresolved;
900
	return method;
928
	return method;
901
}
929
}
930
902
AnnotationBinding[] retrieveAnnotations(Binding binding) {
931
AnnotationBinding[] retrieveAnnotations(Binding binding) {
903
	return AnnotationBinding.addStandardAnnotations(super.retrieveAnnotations(binding), binding.getAnnotationTagBits(), this.environment);
932
	return AnnotationBinding.addStandardAnnotations(super.retrieveAnnotations(binding), binding.getAnnotationTagBits(), this.environment);
904
}
933
}
934
935
/**
936
 * Only used to fixup the superclass hierarchy of proxy binary types
937
 * @param missingSuperclass
938
 * @see LookupEnvironment#cacheMissingBinaryType(char[][])
939
 */
940
void setMissingSuperclass(ReferenceBinding missingSuperclass) {
941
	this.superclass = missingSuperclass;
942
}
943
905
SimpleLookupTable storedAnnotations(boolean forceInitialize) {
944
SimpleLookupTable storedAnnotations(boolean forceInitialize) {
906
	if (forceInitialize && this.storedAnnotations == null) {
945
	if (forceInitialize && this.storedAnnotations == null) {
907
		if (!this.environment.globalOptions.storeAnnotations)
946
		if (!this.environment.globalOptions.storeAnnotations)
Lines 910-915 Link Here
910
	}
949
	}
911
	return this.storedAnnotations;
950
	return this.storedAnnotations;
912
}
951
}
952
913
/* Answer the receiver's superclass... null if the receiver is Object or an interface.
953
/* Answer the receiver's superclass... null if the receiver is Object or an interface.
914
*
954
*
915
* NOTE: superclass of a binary type is resolved when needed
955
* NOTE: superclass of a binary type is resolved when needed
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-5 / +41 lines)
Lines 16-21 Link Here
16
import org.eclipse.jdt.core.compiler.CharOperation;
16
import org.eclipse.jdt.core.compiler.CharOperation;
17
import org.eclipse.jdt.internal.compiler.ClassFilePool;
17
import org.eclipse.jdt.internal.compiler.ClassFilePool;
18
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
18
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
19
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
19
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
20
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
20
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
21
import org.eclipse.jdt.internal.compiler.env.*;
22
import org.eclipse.jdt.internal.compiler.env.*;
Lines 64-70 Link Here
64
	private SimpleLookupTable uniqueParameterizedGenericMethodBindings;
65
	private SimpleLookupTable uniqueParameterizedGenericMethodBindings;
65
	
66
	
66
	public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units
67
	public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units
67
68
	public TypeReference typeReferenceBeingResolved = null; // only set when resolving certain type references, to help locating problems
69
	
68
	private CompilationUnitDeclaration[] units = new CompilationUnitDeclaration[4];
70
	private CompilationUnitDeclaration[] units = new CompilationUnitDeclaration[4];
69
	private MethodVerifier verifier;
71
	private MethodVerifier verifier;
70
72
Lines 173-178 Link Here
173
		return createBinaryTypeFrom(binaryType, computePackageFrom(compoundName), needFieldsAndMethods, accessRestriction);
175
		return createBinaryTypeFrom(binaryType, computePackageFrom(compoundName), needFieldsAndMethods, accessRestriction);
174
	return null; // the type already exists & can be retrieved from the cache
176
	return null; // the type already exists & can be retrieved from the cache
175
}
177
}
178
179
public BinaryTypeBinding cacheMissingBinaryType(char[][] compoundName) {
180
	PackageBinding packageBinding = getPackage0(compoundName[0]);
181
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
182
		packageBinding = new PackageBinding(compoundName[0], this);
183
		knownPackages.put(compoundName[0], packageBinding);
184
	}
185
	for (int i = 1, packageLength = compoundName.length - 1; i < packageLength; i++) {
186
		PackageBinding subPackageBinding = packageBinding.getPackage0(compoundName[i]);
187
		if (subPackageBinding == null || subPackageBinding == TheNotFoundPackage) {
188
			char[][] subName = CharOperation.subarray(compoundName, 0, i + 1);
189
			subPackageBinding = new PackageBinding(subName, packageBinding, this);
190
			packageBinding.addPackage(subPackageBinding);
191
			packageBinding = subPackageBinding;
192
		}
193
	}
194
	// create a proxy for the missing BinaryType
195
	BinaryTypeBinding type = new BinaryTypeBinding(packageBinding, compoundName, this);
196
	if (type.id != TypeIds.T_JavaLangObject) {
197
		// make Object be its superclass - it could in turn be missing as well
198
		ReferenceBinding objectType = getType(TypeConstants.JAVA_LANG_OBJECT);
199
		if (objectType == null) {
200
			objectType = cacheMissingBinaryType(TypeConstants.JAVA_LANG_OBJECT);	// create a proxy for the missing Object type		
201
		}
202
		type.setMissingSuperclass(objectType);
203
	}
204
	packageBinding.addType(type);
205
	return type;	
206
}
176
/*
207
/*
177
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
208
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
178
* 2. Create the field bindings
209
* 2. Create the field bindings
Lines 859-866 Link Here
859
	ReferenceBinding type = getType(compoundName);
890
	ReferenceBinding type = getType(compoundName);
860
	if (type != null) return type;
891
	if (type != null) return type;
861
892
862
	problemReporter.isClassPathCorrect(compoundName, scope == null ? null : scope.referenceCompilationUnit());
893
	ClassScope classScope = scope == null ? null : scope.enclosingClassScope();
863
	return null; // will not get here since the above error aborts the compilation
894
	problemReporter.isClassPathCorrect(
895
			compoundName, 
896
			scope == null ? this.unitBeingCompleted : scope.referenceCompilationUnit(), 
897
			classScope == null ? this.typeReferenceBeingResolved : classScope.superTypeReference);
898
	return cacheMissingBinaryType(compoundName);	// create a proxy for the missing BinaryType
864
}
899
}
865
/* Answer the top level package named name.
900
/* Answer the top level package named name.
866
* Ask the oracle for the package if its not in the cache.
901
* Ask the oracle for the package if its not in the cache.
Lines 957-970 Link Here
957
		binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
992
		binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
958
		packageBinding.addType(binding);
993
		packageBinding.addType(binding);
959
	} else if (binding == TheNotFoundType) {
994
	} else if (binding == TheNotFoundType) {
960
		problemReporter.isClassPathCorrect(compoundName, null);
995
		problemReporter.isClassPathCorrect(compoundName, this.unitBeingCompleted, this.typeReferenceBeingResolved);
961
		return null; // will not get here since the above error aborts the compilation
996
		return cacheMissingBinaryType(compoundName);	// create a proxy for the missing BinaryType
962
	} else if (!isParameterized) {
997
	} else if (!isParameterized) {
963
	    // check raw type, only for resolved types
998
	    // check raw type, only for resolved types
964
        binding = (ReferenceBinding)convertUnresolvedBinaryToRawType(binding);
999
        binding = (ReferenceBinding)convertUnresolvedBinaryToRawType(binding);
965
	}
1000
	}
966
	return binding;
1001
	return binding;
967
}
1002
}
1003
968
/* Answer the type corresponding to the name from the binary file.
1004
/* Answer the type corresponding to the name from the binary file.
969
* Does not ask the oracle for the type if its not found in the cache... instead an
1005
* Does not ask the oracle for the type if its not found in the cache... instead an
970
* unresolved type is returned which must be resolved before used.
1006
* unresolved type is returned which must be resolved before used.
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-2 / +5 lines)
Lines 550-558 Link Here
550
		importBinding = ((PackageBinding) importBinding).getTypeOrPackage(JAVA_LANG[1]);
550
		importBinding = ((PackageBinding) importBinding).getTypeOrPackage(JAVA_LANG[1]);
551
551
552
	// abort if java.lang cannot be found...
552
	// abort if java.lang cannot be found...
553
	if (importBinding == null || !importBinding.isValidBinding())
553
	if (importBinding == null || !importBinding.isValidBinding()) {
554
		problemReporter().isClassPathCorrect(JAVA_LANG_OBJECT, referenceCompilationUnit());
554
		problemReporter().isClassPathCorrect(JAVA_LANG_OBJECT, referenceCompilationUnit(), null);
555
		BinaryTypeBinding missingObject = environment.cacheMissingBinaryType(JAVA_LANG_OBJECT);	// create a proxy for the missing BinaryType
556
		importBinding = missingObject.fPackage;
555
557
558
	}
556
	return environment.defaultImports = new ImportBinding[] {new ImportBinding(JAVA_LANG, true, importBinding, null)};
559
	return environment.defaultImports = new ImportBinding[] {new ImportBinding(JAVA_LANG, true, importBinding, null)};
557
}
560
}
558
// NOT Public API
561
// NOT Public API
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java (-5 / +4 lines)
Lines 41-52 Link Here
41
		targetType = this.fPackage.getType0(this.compoundName[this.compoundName.length - 1]);
41
		targetType = this.fPackage.getType0(this.compoundName[this.compoundName.length - 1]);
42
		if (targetType == this)
42
		if (targetType == this)
43
			targetType = environment.askForType(this.compoundName);
43
			targetType = environment.askForType(this.compoundName);
44
		if (targetType != null && targetType != this) { // could not resolve any better, error was already reported against it
44
		if (targetType == null || targetType == this) { // could not resolve any better, error was already reported against it
45
			setResolvedType(targetType, environment);
45
			environment.problemReporter.isClassPathCorrect(this.compoundName, environment.unitBeingCompleted, environment.typeReferenceBeingResolved);
46
		} else {
46
			targetType = environment.cacheMissingBinaryType(this.compoundName);	// create a proxy for the missing BinaryType
47
			environment.problemReporter.isClassPathCorrect(this.compoundName, null);
48
			return null; // will not get here since the above error aborts the compilation
49
		}
47
		}
48
		setResolvedType(targetType, environment);
50
	}
49
	}
51
	if (convertGenericToRawType) {
50
	if (convertGenericToRawType) {
52
		targetType = (ReferenceBinding) environment.convertUnresolvedBinaryToRawType(targetType);
51
		targetType = (ReferenceBinding) environment.convertUnresolvedBinaryToRawType(targetType);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (-2 / +6 lines)
Lines 1097-1115 Link Here
1097
	}
1097
	}
1098
1098
1099
	private ReferenceBinding findSupertype(TypeReference typeReference) {
1099
	private ReferenceBinding findSupertype(TypeReference typeReference) {
1100
		LookupEnvironment environment = environment();
1100
		try {
1101
		try {
1101
			typeReference.aboutToResolve(this); // allows us to trap completion & selection nodes
1102
			typeReference.aboutToResolve(this); // allows us to trap completion & selection nodes
1102
			compilationUnitScope().recordQualifiedReference(typeReference.getTypeName());
1103
			compilationUnitScope().recordQualifiedReference(typeReference.getTypeName());
1103
			this.superTypeReference = typeReference;
1104
			this.superTypeReference = typeReference;
1105
			environment.typeReferenceBeingResolved = typeReference;
1104
			ReferenceBinding superType = (ReferenceBinding) typeReference.resolveSuperType(this);
1106
			ReferenceBinding superType = (ReferenceBinding) typeReference.resolveSuperType(this);
1105
			this.superTypeReference = null;
1106
			return superType;
1107
			return superType;
1107
		} catch (AbortCompilation e) {
1108
		} catch (AbortCompilation e) {
1108
			SourceTypeBinding sourceType = this.referenceContext.binding;
1109
			SourceTypeBinding sourceType = this.referenceContext.binding;
1109
			if (sourceType.superInterfaces == null)  sourceType.superInterfaces = Binding.NO_SUPERINTERFACES; // be more resilient for hierarchies (144976)
1110
			if (sourceType.superInterfaces == null)  sourceType.superInterfaces = Binding.NO_SUPERINTERFACES; // be more resilient for hierarchies (144976)
1110
			e.updateContext(typeReference, referenceCompilationUnit().compilationResult);
1111
			e.updateContext(typeReference, referenceCompilationUnit().compilationResult);
1111
			throw e;
1112
			throw e;
1112
		}			
1113
		} finally {
1114
			environment.typeReferenceBeingResolved = null;
1115
			this.superTypeReference = null;
1116
		}
1113
	}
1117
	}
1114
1118
1115
	/* Answer the problem reporter to use for raising new problems.
1119
	/* Answer the problem reporter to use for raising new problems.
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-5 / +4 lines)
Lines 3387-3402 Link Here
3387
		argument.type.sourceStart,
3387
		argument.type.sourceStart,
3388
		argument.sourceEnd);
3388
		argument.sourceEnd);
3389
}
3389
}
3390
public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl) {
3390
public void isClassPathCorrect(char[][] expectedTypeName, CompilationUnitDeclaration compUnitDecl, ASTNode location) {
3391
	this.referenceContext = compUnitDecl;
3391
	this.referenceContext = compUnitDecl;
3392
	String[] arguments = new String[] {CharOperation.toString(wellKnownTypeName)};
3392
	String[] arguments = new String[] {CharOperation.toString(expectedTypeName)};
3393
	this.handle(
3393
	this.handle(
3394
		IProblem.IsClassPathCorrect,
3394
		IProblem.IsClassPathCorrect,
3395
		arguments, 
3395
		arguments, 
3396
		arguments,
3396
		arguments,
3397
		ProblemSeverities.AbortCompilation | ProblemSeverities.Error | ProblemSeverities.Fatal,
3397
		location == null ? 0 : location.sourceStart(),
3398
		0,
3398
		location == null ? 0 : location.sourceEnd());
3399
		0);
3400
}
3399
}
3401
private boolean isIdentifier(int token) {
3400
private boolean isIdentifier(int token) {
3402
	return token == TerminalTokens.TokenNameIdentifier;
3401
	return token == TerminalTokens.TokenNameIdentifier;
(-)model/org/eclipse/jdt/internal/core/builder/MissingClassFileException.java (-25 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.builder;
12
13
/**
14
 * Exception thrown when the build should be aborted because a referenced
15
 * class file cannot be found.
16
 */
17
public class MissingClassFileException extends RuntimeException {
18
19
	protected String missingClassFile;
20
	private static final long serialVersionUID = 3060418973806972616L; // backward compatible
21
22
public MissingClassFileException(String missingClassFile) {
23
	this.missingClassFile = missingClassFile;
24
}
25
}
(-)model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java (-10 / +27 lines)
Lines 50-55 Link Here
50
50
51
private boolean inCompiler;
51
private boolean inCompiler;
52
52
53
protected boolean keepStoringProblemMarkers;
53
protected SimpleSet filesWithAnnotations = null;
54
protected SimpleSet filesWithAnnotations = null;
54
55
55
public static int MAX_AT_ONCE = 2000; // best compromise between space used and speed
56
public static int MAX_AT_ONCE = 2000; // best compromise between space used and speed
Lines 84-89 Link Here
84
	this.nameEnvironment = javaBuilder.nameEnvironment;
85
	this.nameEnvironment = javaBuilder.nameEnvironment;
85
	this.sourceLocations = this.nameEnvironment.sourceLocations;
86
	this.sourceLocations = this.nameEnvironment.sourceLocations;
86
	this.notifier = javaBuilder.notifier;
87
	this.notifier = javaBuilder.notifier;
88
	this.keepStoringProblemMarkers = true; // may get disabled when missing classfiles are encountered
87
89
88
	if (buildStarting) {
90
	if (buildStarting) {
89
		this.newState = newState == null ? new State(javaBuilder) : newState;
91
		this.newState = newState == null ? new State(javaBuilder) : newState;
Lines 545-568 Link Here
545
 */
547
 */
546
protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException {
548
protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException {
547
	if (sourceFile == null || problems == null || problems.length == 0) return;
549
	if (sourceFile == null || problems == null || problems.length == 0) return;
550
	 // once a classpath error is found, ignore all other problems for this project so the user can see the main error
551
	// but still try to compile as many source files as possible to help the case when the base libraries are in source
552
	if (!this.keepStoringProblemMarkers) return; // only want the one error recorded on this source file
548
553
549
	String missingClassFile = null;
550
	IResource resource = sourceFile.resource;
554
	IResource resource = sourceFile.resource;
551
	HashSet managedMarkerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
555
	HashSet managedMarkerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
552
	for (int i = 0, l = problems.length; i < l; i++) {
556
	for (int i = 0, l = problems.length; i < l; i++) {
553
		CategorizedProblem problem = problems[i];
557
		CategorizedProblem problem = problems[i];
554
		int id = problem.getID();
558
		int id = problem.getID();
559
		
560
		// handle missing classfile situation
555
		if (id == IProblem.IsClassPathCorrect) {
561
		if (id == IProblem.IsClassPathCorrect) {
556
			JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project
562
			String missingClassfileName = problem.getArguments()[0];
557
			String[] args = problem.getArguments();
563
			if (JavaBuilder.DEBUG)
558
			missingClassFile = args[0];
564
				System.out.println(Messages.bind(Messages.build_incompleteClassPath, missingClassfileName));
565
			boolean isInvalidClasspathError = JavaCore.ERROR.equals(javaBuilder.javaProject.getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true));
566
			// insert extra classpath problem, and make it the only problem for this project (optional)
567
			if (isInvalidClasspathError && JavaCore.ABORT.equals(javaBuilder.javaProject.getOption(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, true))) {
568
				JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project
569
				this.keepStoringProblemMarkers = false;
570
			}
571
			IMarker marker = this.javaBuilder.currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
572
			marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_incompleteClassPath, missingClassfileName)); 
573
			marker.setAttribute(IMarker.SEVERITY, isInvalidClasspathError ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING);
574
			marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH);
575
			// if not keeping more markers, still fall through rest of the problem reporting, so that offending IsClassPathCorrect 
576
			// problem gets recorded since it may help locating the offending reference
559
		}
577
		}
560
		
578
561
		String markerType = problem.getMarkerType();
579
		String markerType = problem.getMarkerType();
562
		if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType)
580
		if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType) || managedMarkerTypes.contains(markerType)) {
563
				|| managedMarkerTypes.contains(markerType)) {			
564
			IMarker marker = resource.createMarker(markerType);
581
			IMarker marker = resource.createMarker(markerType);
565
			
582
566
			// standard attributes
583
			// standard attributes
567
			marker.setAttributes(
584
			marker.setAttributes(
568
				JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES,
585
				JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES,
Lines 583-591 Link Here
583
			if (extraLength > 0) {
600
			if (extraLength > 0) {
584
				marker.setAttributes(extraAttributeNames, problem.getExtraMarkerAttributeValues());
601
				marker.setAttributes(extraAttributeNames, problem.getExtraMarkerAttributeValues());
585
			}
602
			}
603
			
604
			if (!this.keepStoringProblemMarkers) return; // only want the one error recorded on this source file
586
		}
605
		}
587
		if (missingClassFile != null)
588
			throw new MissingClassFileException(missingClassFile);
589
	}
606
	}
590
}
607
}
591
608
(-)model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java (-8 lines)
Lines 209-222 Link Here
209
		marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); 
209
		marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); 
210
		marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
210
		marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
211
		marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH);
211
		marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH);
212
	} catch (MissingClassFileException e) {
213
		// do not log this exception since its thrown to handle aborted compiles because of missing class files
214
		if (DEBUG)
215
			System.out.println(Messages.bind(Messages.build_incompleteClassPath, e.missingClassFile)); 
216
		IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
217
		marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_incompleteClassPath, e.missingClassFile)); 
218
		marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
219
		marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH);
220
	} catch (MissingSourceFileException e) {
212
	} catch (MissingSourceFileException e) {
221
		// do not log this exception since its thrown to handle aborted compiles because of missing source files
213
		// do not log this exception since its thrown to handle aborted compiles because of missing source files
222
		if (DEBUG)
214
		if (DEBUG)

Return to bug 114349