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 (+18 lines)
Lines 171-176 Link Here
171
	}	
171
	}	
172
}
172
}
173
173
174
BinaryTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
175
	this.compoundName = compoundName;
176
	computeId();
177
178
	this.tagBits |= TagBits.IsBinaryBinding;
179
	this.environment = environment;
180
	this.fPackage = packageBinding;
181
	this.fileName = CharOperation.concatWith(compoundName, '/');
182
	this.sourceName = CharOperation.concatWith(compoundName, '.');
183
	this.modifiers = ClassFileConstants.AccPublic;
184
	this.superclass = null;
185
	this.superInterfaces = Binding.NO_SUPERINTERFACES;
186
	this.typeVariables = Binding.NO_TYPE_VARIABLES;
187
	this.memberTypes = Binding.NO_MEMBER_TYPES;
188
	this.fields = Binding.NO_FIELDS;
189
	this.methods = Binding.NO_METHODS;
190
}
191
174
public FieldBinding[] availableFields() {
192
public FieldBinding[] availableFields() {
175
	if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
193
	if ((this.tagBits & TagBits.AreFieldsComplete) != 0)
176
		return fields;
194
		return fields;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-1 / +20 lines)
Lines 860-866 Link Here
860
	if (type != null) return type;
860
	if (type != null) return type;
861
861
862
	problemReporter.isClassPathCorrect(compoundName, scope == null ? null : scope.referenceCompilationUnit());
862
	problemReporter.isClassPathCorrect(compoundName, scope == null ? null : scope.referenceCompilationUnit());
863
	return null; // will not get here since the above error aborts the compilation
863
864
	PackageBinding packageBinding = getPackage0(compoundName[0]);
865
	if (packageBinding == null || packageBinding == TheNotFoundPackage) {
866
		packageBinding = new PackageBinding(compoundName[0], this);
867
		knownPackages.put(compoundName[0], packageBinding);
868
	}
869
	for (int i = 1, packageLength = compoundName.length - 1; i < packageLength; i++) {
870
		PackageBinding subPackageBinding = packageBinding.getPackage0(compoundName[i]);
871
		if (subPackageBinding == null || subPackageBinding == TheNotFoundPackage) {
872
			char[][] subName = CharOperation.subarray(compoundName, 0, i + 1);
873
			subPackageBinding = new PackageBinding(subName, packageBinding, this);
874
			packageBinding.addPackage(subPackageBinding);
875
			packageBinding = subPackageBinding;
876
		}
877
	}
878
879
	// create a proxy for the missing BinaryType
880
	type = new BinaryTypeBinding(packageBinding, compoundName, this);
881
	packageBinding.addType(type);
882
	return type;
864
}
883
}
865
/* Answer the top level package named name.
884
/* Answer the top level package named name.
866
* Ask the oracle for the package if its not in the cache.
885
* Ask the oracle for the package if its not in the cache.
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +1 lines)
Lines 3438-3444 Link Here
3438
		IProblem.IsClassPathCorrect,
3438
		IProblem.IsClassPathCorrect,
3439
		arguments, 
3439
		arguments, 
3440
		arguments,
3440
		arguments,
3441
		ProblemSeverities.AbortCompilation | ProblemSeverities.Error | ProblemSeverities.Fatal,
3441
		ProblemSeverities.Error,
3442
		0,
3442
		0,
3443
		0);
3443
		0);
3444
}
3444
}
(-)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 (-8 / +17 lines)
Lines 50-55 Link Here
50
50
51
private boolean inCompiler;
51
private boolean inCompiler;
52
52
53
protected String missingClassFileName;
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.missingClassFileName = null;
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 546-553 Link Here
546
 */
548
 */
547
protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException {
549
protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException {
548
	if (sourceFile == null || problems == null || problems.length == 0) return;
550
	if (sourceFile == null || problems == null || problems.length == 0) return;
551
	 // once a classpath error is found, ignore all other problems for this project so the user can see the main error
552
	// but still try to compile as many source files as possible to help the case when the base libraries are in source
553
	if (this.missingClassFileName != null) return;
549
554
550
	String missingClassFile = null;
551
	IResource resource = sourceFile.resource;
555
	IResource resource = sourceFile.resource;
552
	HashSet managedMarkerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
556
	HashSet managedMarkerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
553
	for (int i = 0, l = problems.length; i < l; i++) {
557
	for (int i = 0, l = problems.length; i < l; i++) {
Lines 556-569 Link Here
556
		if (id == IProblem.IsClassPathCorrect) {
560
		if (id == IProblem.IsClassPathCorrect) {
557
			JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project
561
			JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project
558
			String[] args = problem.getArguments();
562
			String[] args = problem.getArguments();
559
			missingClassFile = args[0];
563
			this.missingClassFileName = args[0];
564
565
			if (JavaBuilder.DEBUG)
566
				System.out.println(Messages.bind(Messages.build_incompleteClassPath, this.missingClassFileName));
567
			IMarker marker = this.javaBuilder.currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER);
568
			marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_incompleteClassPath, this.missingClassFileName)); 
569
			marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
570
			marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH);
560
		}
571
		}
561
		
572
562
		String markerType = problem.getMarkerType();
573
		String markerType = problem.getMarkerType();
563
		if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType)
574
		if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType) || managedMarkerTypes.contains(markerType)) {
564
				|| managedMarkerTypes.contains(markerType)) {			
565
			IMarker marker = resource.createMarker(markerType);
575
			IMarker marker = resource.createMarker(markerType);
566
			
576
567
			// standard attributes
577
			// standard attributes
568
			marker.setAttributes(
578
			marker.setAttributes(
569
				JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES,
579
				JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES,
Lines 585-592 Link Here
585
				marker.setAttributes(extraAttributeNames, problem.getExtraMarkerAttributeValues());
595
				marker.setAttributes(extraAttributeNames, problem.getExtraMarkerAttributeValues());
586
			}
596
			}
587
		}
597
		}
588
		if (missingClassFile != null)
598
		if (this.missingClassFileName != null) return; // only want the one error recorded on this source file
589
			throw new MissingClassFileException(missingClassFile);
590
	}
599
	}
591
}
600
}
592
601
(-)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 (-1 / +1 lines)
Lines 783-789 Link Here
783
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349
783
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349
784
// this one fails; compare with testCycle7 (only one change in Object source),
784
// this one fails; compare with testCycle7 (only one change in Object source),
785
// which passes
785
// which passes
786
public void _testCycle6() throws JavaModelException {
786
public void testCycle6() throws JavaModelException {
787
	Hashtable options = JavaCore.getOptions();
787
	Hashtable options = JavaCore.getOptions();
788
	Hashtable newOptions = JavaCore.getOptions();
788
	Hashtable newOptions = JavaCore.getOptions();
789
	newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);
789
	newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);

Return to bug 114349