### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v retrieving revision 1.99 diff -u -r1.99 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 6 Sep 2006 18:14:13 -0000 1.99 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 18 Sep 2006 14:27:53 -0000 @@ -171,6 +171,24 @@ } } +BinaryTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) { + this.compoundName = compoundName; + computeId(); + + this.tagBits |= TagBits.IsBinaryBinding; + this.environment = environment; + this.fPackage = packageBinding; + this.fileName = CharOperation.concatWith(compoundName, '/'); + this.sourceName = CharOperation.concatWith(compoundName, '.'); + this.modifiers = ClassFileConstants.AccPublic; + this.superclass = null; + this.superInterfaces = Binding.NO_SUPERINTERFACES; + this.typeVariables = Binding.NO_TYPE_VARIABLES; + this.memberTypes = Binding.NO_MEMBER_TYPES; + this.fields = Binding.NO_FIELDS; + this.methods = Binding.NO_METHODS; +} + public FieldBinding[] availableFields() { if ((this.tagBits & TagBits.AreFieldsComplete) != 0) return fields; Index: compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java,v retrieving revision 1.72 diff -u -r1.72 LookupEnvironment.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 11 May 2006 10:14:34 -0000 1.72 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java 18 Sep 2006 14:27:53 -0000 @@ -860,7 +860,26 @@ if (type != null) return type; problemReporter.isClassPathCorrect(compoundName, scope == null ? null : scope.referenceCompilationUnit()); - return null; // will not get here since the above error aborts the compilation + + PackageBinding packageBinding = getPackage0(compoundName[0]); + if (packageBinding == null || packageBinding == TheNotFoundPackage) { + packageBinding = new PackageBinding(compoundName[0], this); + knownPackages.put(compoundName[0], packageBinding); + } + for (int i = 1, packageLength = compoundName.length - 1; i < packageLength; i++) { + PackageBinding subPackageBinding = packageBinding.getPackage0(compoundName[i]); + if (subPackageBinding == null || subPackageBinding == TheNotFoundPackage) { + char[][] subName = CharOperation.subarray(compoundName, 0, i + 1); + subPackageBinding = new PackageBinding(subName, packageBinding, this); + packageBinding.addPackage(subPackageBinding); + packageBinding = subPackageBinding; + } + } + + // create a proxy for the missing BinaryType + type = new BinaryTypeBinding(packageBinding, compoundName, this); + packageBinding.addType(type); + return type; } /* Answer the top level package named name. * Ask the oracle for the package if its not in the cache. Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v retrieving revision 1.319 diff -u -r1.319 ProblemReporter.java --- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 15 Sep 2006 17:36:28 -0000 1.319 +++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 18 Sep 2006 14:27:54 -0000 @@ -3438,7 +3438,7 @@ IProblem.IsClassPathCorrect, arguments, arguments, - ProblemSeverities.AbortCompilation | ProblemSeverities.Error | ProblemSeverities.Fatal, + ProblemSeverities.Error, 0, 0); } Index: model/org/eclipse/jdt/internal/core/builder/MissingClassFileException.java =================================================================== RCS file: model/org/eclipse/jdt/internal/core/builder/MissingClassFileException.java diff -N model/org/eclipse/jdt/internal/core/builder/MissingClassFileException.java --- model/org/eclipse/jdt/internal/core/builder/MissingClassFileException.java 10 May 2006 18:03:50 -0000 1.8 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.internal.core.builder; - -/** - * Exception thrown when the build should be aborted because a referenced - * class file cannot be found. - */ -public class MissingClassFileException extends RuntimeException { - - protected String missingClassFile; - private static final long serialVersionUID = 3060418973806972616L; // backward compatible - -public MissingClassFileException(String missingClassFile) { - this.missingClassFile = missingClassFile; -} -} Index: model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java,v retrieving revision 1.99 diff -u -r1.99 AbstractImageBuilder.java --- model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java 13 Sep 2006 18:41:05 -0000 1.99 +++ model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java 18 Sep 2006 14:27:54 -0000 @@ -50,6 +50,7 @@ private boolean inCompiler; +protected String missingClassFileName; protected SimpleSet filesWithAnnotations = null; public static int MAX_AT_ONCE = 2000; // best compromise between space used and speed @@ -84,6 +85,7 @@ this.nameEnvironment = javaBuilder.nameEnvironment; this.sourceLocations = this.nameEnvironment.sourceLocations; this.notifier = javaBuilder.notifier; + this.missingClassFileName = null; if (buildStarting) { this.newState = newState == null ? new State(javaBuilder) : newState; @@ -546,8 +548,10 @@ */ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException { if (sourceFile == null || problems == null || problems.length == 0) return; + // once a classpath error is found, ignore all other problems for this project so the user can see the main error + // but still try to compile as many source files as possible to help the case when the base libraries are in source + if (this.missingClassFileName != null) return; - String missingClassFile = null; IResource resource = sourceFile.resource; HashSet managedMarkerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes(); for (int i = 0, l = problems.length; i < l; i++) { @@ -556,14 +560,20 @@ if (id == IProblem.IsClassPathCorrect) { JavaBuilder.removeProblemsAndTasksFor(javaBuilder.currentProject); // make this the only problem for this project String[] args = problem.getArguments(); - missingClassFile = args[0]; + this.missingClassFileName = args[0]; + + if (JavaBuilder.DEBUG) + System.out.println(Messages.bind(Messages.build_incompleteClassPath, this.missingClassFileName)); + IMarker marker = this.javaBuilder.currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); + marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_incompleteClassPath, this.missingClassFileName)); + marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); + marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); } - + String markerType = problem.getMarkerType(); - if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType) - || managedMarkerTypes.contains(markerType)) { + if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType) || managedMarkerTypes.contains(markerType)) { IMarker marker = resource.createMarker(markerType); - + // standard attributes marker.setAttributes( JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES, @@ -585,8 +595,7 @@ marker.setAttributes(extraAttributeNames, problem.getExtraMarkerAttributeValues()); } } - if (missingClassFile != null) - throw new MissingClassFileException(missingClassFile); + if (this.missingClassFileName != null) return; // only want the one error recorded on this source file } } Index: model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java,v retrieving revision 1.123 diff -u -r1.123 JavaBuilder.java --- model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java 13 Jun 2006 13:00:44 -0000 1.123 +++ model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java 18 Sep 2006 14:27:54 -0000 @@ -209,14 +209,6 @@ marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_inconsistentProject, e.getLocalizedMessage())); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); - } catch (MissingClassFileException e) { - // do not log this exception since its thrown to handle aborted compiles because of missing class files - if (DEBUG) - System.out.println(Messages.bind(Messages.build_incompleteClassPath, e.missingClassFile)); - IMarker marker = currentProject.createMarker(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); - marker.setAttribute(IMarker.MESSAGE, Messages.bind(Messages.build_incompleteClassPath, e.missingClassFile)); - marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); - marker.setAttribute(IJavaModelMarker.CATEGORY_ID, CategorizedProblem.CAT_BUILDPATH); } catch (MissingSourceFileException e) { // do not log this exception since its thrown to handle aborted compiles because of missing source files if (DEBUG) #P org.eclipse.jdt.core.tests.builder Index: src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java,v retrieving revision 1.42 diff -u -r1.42 MultiProjectTests.java --- src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java 7 Sep 2006 10:30:15 -0000 1.42 +++ src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java 18 Sep 2006 14:27:55 -0000 @@ -783,7 +783,7 @@ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349 // this one fails; compare with testCycle7 (only one change in Object source), // which passes -public void _testCycle6() throws JavaModelException { +public void testCycle6() throws JavaModelException { Hashtable options = JavaCore.getOptions(); Hashtable newOptions = JavaCore.getOptions(); newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING);