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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-1 / +29 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;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-4 / +26 lines)
Lines 173-178 Link Here
173
		return createBinaryTypeFrom(binaryType, computePackageFrom(compoundName), needFieldsAndMethods, accessRestriction);
173
		return createBinaryTypeFrom(binaryType, computePackageFrom(compoundName), needFieldsAndMethods, accessRestriction);
174
	return null; // the type already exists & can be retrieved from the cache
174
	return null; // the type already exists & can be retrieved from the cache
175
}
175
}
176
177
public BinaryTypeBinding cacheMissingBinaryType(char[][] compoundName) {
178
	PackageBinding packageBinding = getPackage0(compoundName[0]);
179
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
180
		packageBinding = new PackageBinding(compoundName[0], this);
181
		knownPackages.put(compoundName[0], packageBinding);
182
	}
183
	for (int i = 1, packageLength = compoundName.length - 1; i < packageLength; i++) {
184
		PackageBinding subPackageBinding = packageBinding.getPackage0(compoundName[i]);
185
		if (subPackageBinding == null || subPackageBinding == TheNotFoundPackage) {
186
			char[][] subName = CharOperation.subarray(compoundName, 0, i + 1);
187
			subPackageBinding = new PackageBinding(subName, packageBinding, this);
188
			packageBinding.addPackage(subPackageBinding);
189
			packageBinding = subPackageBinding;
190
		}
191
	}
192
	// create a proxy for the missing BinaryType
193
	BinaryTypeBinding type = new BinaryTypeBinding(packageBinding, compoundName, this);
194
	packageBinding.addType(type);
195
	return type;	
196
}
176
/*
197
/*
177
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
198
* 1. Connect the type hierarchy for the type bindings created for parsedUnits.
178
* 2. Create the field bindings
199
* 2. Create the field bindings
Lines 859-866 Link Here
859
	ReferenceBinding type = getType(compoundName);
880
	ReferenceBinding type = getType(compoundName);
860
	if (type != null) return type;
881
	if (type != null) return type;
861
882
862
	problemReporter.isClassPathCorrect(compoundName, scope == null ? null : scope.referenceCompilationUnit());
883
	problemReporter.isClassPathCorrect(compoundName, scope == null ? this.unitBeingCompleted : scope.referenceCompilationUnit());
863
	return null; // will not get here since the above error aborts the compilation
884
	return cacheMissingBinaryType(compoundName);	// create a proxy for the missing BinaryType
864
}
885
}
865
/* Answer the top level package named name.
886
/* Answer the top level package named name.
866
* Ask the oracle for the package if its not in the cache.
887
* Ask the oracle for the package if its not in the cache.
Lines 957-970 Link Here
957
		binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
978
		binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
958
		packageBinding.addType(binding);
979
		packageBinding.addType(binding);
959
	} else if (binding == TheNotFoundType) {
980
	} else if (binding == TheNotFoundType) {
960
		problemReporter.isClassPathCorrect(compoundName, null);
981
		problemReporter.isClassPathCorrect(compoundName, this.unitBeingCompleted);
961
		return null; // will not get here since the above error aborts the compilation
982
		return cacheMissingBinaryType(compoundName);	// create a proxy for the missing BinaryType
962
	} else if (!isParameterized) {
983
	} else if (!isParameterized) {
963
	    // check raw type, only for resolved types
984
	    // check raw type, only for resolved types
964
        binding = (ReferenceBinding)convertUnresolvedBinaryToRawType(binding);
985
        binding = (ReferenceBinding)convertUnresolvedBinaryToRawType(binding);
965
	}
986
	}
966
	return binding;
987
	return binding;
967
}
988
}
989
968
/* Answer the type corresponding to the name from the binary file.
990
/* 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
991
* 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.
992
* unresolved type is returned which must be resolved before used.
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-1 / +4 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());
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);
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/problem/ProblemReporter.java (-3 / +2 lines)
Lines 3387-3400 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) {
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,
3398
		0,
3397
		0,
3399
		0);
3398
		0);
3400
}
3399
}
(-)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)
(-)src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java (+172 lines)
Lines 780-785 Link Here
780
		}
780
		}
781
	}
781
	}
782
	
782
	
783
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349
784
//	 this one fails; compare with testCycle7 (only one change in Object source),
785
//	 which passes
786
	public void testCycle6() throws JavaModelException {
787
		Hashtable options = JavaCore.getOptions();
788
		Hashtable newOptions = JavaCore.getOptions();
789
		newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
790
		
791
		JavaCore.setOptions(newOptions);
792
		
793
		//----------------------------
794
		//         Project1
795
		//----------------------------
796
		IPath p1 = env.addProject("P1");
797
		// remove old package fragment root so that names don't collide
798
		env.removePackageFragmentRoot(p1, "");
799
		IPath root1 = env.addPackageFragmentRoot(p1, "src");
800
		env.setOutputFolder(p1, "bin");
801
		
802
		env.addClass(root1, "java/lang", "Object",
803
			"package java.lang;\n" +
804
			"public class Object {\n" +
805
			"  Class getClass() { return null; }\n" +
806
			"  String toString() { return \"\"; }\n" +	// the line that changes
807
			"}\n"
808
			);
809
			
810
		//----------------------------
811
		//         Project2
812
		//----------------------------
813
		IPath p2 = env.addProject("P2");
814
		// remove old package fragment root so that names don't collide
815
		env.removePackageFragmentRoot(p2, "");
816
		IPath root2 = env.addPackageFragmentRoot(p2, "src");
817
		env.setOutputFolder(p2, "bin");
818
		
819
		env.addClass(root2, "java/lang", "Class",
820
			"package java.lang;\n" +
821
			"public class Class {\n" +
822
			"  String getName() { return \"\"; };\n" +
823
			"}\n"
824
			);
825
826
		//----------------------------
827
		//         Project3
828
		//----------------------------
829
		IPath p3 = env.addProject("P3");
830
		// remove old package fragment root so that names don't collide
831
		env.removePackageFragmentRoot(p3, "");
832
		IPath root3 = env.addPackageFragmentRoot(p3, "src");
833
		env.setOutputFolder(p3, "bin");
834
		
835
		env.addClass(root3, "java/lang", "String",
836
			"package java.lang;\n" +
837
			"public class String {\n" +
838
			"}\n"
839
			);
840
841
		// Dependencies
842
		IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")};
843
		IPath[] forbiddenPaths = new IPath[] {new Path("**/*")};
844
		env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false);
845
		env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false);
846
		env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false);
847
		env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false);
848
		env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false);
849
		env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false);
850
851
		try {
852
			fullBuild();
853
854
			expectingOnlySpecificProblemsFor(p1,new Problem[]{
855
				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$
856
			});
857
			expectingOnlySpecificProblemsFor(p2,new Problem[]{
858
				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$
859
			});
860
			expectingOnlySpecificProblemsFor(p3,new Problem[]{
861
				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$
862
			});
863
			
864
		} finally {
865
			JavaCore.setOptions(options);
866
		}
867
	}
868
869
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349
870
//	 this one passes; compare with testCycle6 (only one change in Object source),
871
//	 which fails
872
	public void testCycle7() throws JavaModelException {
873
		Hashtable options = JavaCore.getOptions();
874
		Hashtable newOptions = JavaCore.getOptions();
875
		newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
876
		
877
		JavaCore.setOptions(newOptions);
878
		
879
		//----------------------------
880
		//         Project1
881
		//----------------------------
882
		IPath p1 = env.addProject("P1");
883
		// remove old package fragment root so that names don't collide
884
		env.removePackageFragmentRoot(p1, "");
885
		IPath root1 = env.addPackageFragmentRoot(p1, "src");
886
		env.setOutputFolder(p1, "bin");
887
		
888
		env.addClass(root1, "java/lang", "Object",
889
			"package java.lang;\n" +
890
			"public class Object {\n" +
891
			"  Class getClass() { return null; }\n" +
892
			"  String toString() { return null; }\n" +	// the line that changes
893
			"}\n"
894
			);
895
			
896
		//----------------------------
897
		//         Project2
898
		//----------------------------
899
		IPath p2 = env.addProject("P2");
900
		// remove old package fragment root so that names don't collide
901
		env.removePackageFragmentRoot(p2, "");
902
		IPath root2 = env.addPackageFragmentRoot(p2, "src");
903
		env.setOutputFolder(p2, "bin");
904
		
905
		env.addClass(root2, "java/lang", "Class",
906
			"package java.lang;\n" +
907
			"public class Class {\n" +
908
			"  String getName() { return \"\"; };\n" +
909
			"}\n"
910
			);
911
912
		//----------------------------
913
		//         Project3
914
		//----------------------------
915
		IPath p3 = env.addProject("P3");
916
		// remove old package fragment root so that names don't collide
917
		env.removePackageFragmentRoot(p3, "");
918
		IPath root3 = env.addPackageFragmentRoot(p3, "src");
919
		env.setOutputFolder(p3, "bin");
920
		
921
		env.addClass(root3, "java/lang", "String",
922
			"package java.lang;\n" +
923
			"public class String {\n" +
924
			"}\n"
925
			);
926
927
		// Dependencies
928
		IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")};
929
		IPath[] forbiddenPaths = new IPath[] {new Path("**/*")};
930
		env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false);
931
		env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false);
932
		env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false);
933
		env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false);
934
		env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false);
935
		env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false);
936
937
		try {
938
			fullBuild();
939
940
			expectingOnlySpecificProblemsFor(p1,new Problem[]{
941
				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$
942
			});
943
			expectingOnlySpecificProblemsFor(p2,new Problem[]{
944
				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$
945
			});
946
			expectingOnlySpecificProblemsFor(p3,new Problem[]{
947
				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$
948
			});
949
			
950
		} finally {
951
			JavaCore.setOptions(options);
952
		}
953
	}
954
	
783
	/*
955
	/*
784
	 * Full buid case
956
	 * Full buid case
785
	 */
957
	 */

Return to bug 114349