Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayaprakash Arthanareeswaran2013-05-09 10:56:19 +0000
committerJayaprakash Arthanareeswaran2013-05-09 12:14:13 +0000
commit7888e9aab7a7900265cb9a598a42d6a1379c3e64 (patch)
treecca354549792ef1f1aee1c09d945f09baeee94d2
parent51122efdf7ea931a241be8fc43abbcb5ea6227c2 (diff)
downloadeclipse.jdt.core-7888e9aab7a7900265cb9a598a42d6a1379c3e64.tar.gz
eclipse.jdt.core-7888e9aab7a7900265cb9a598a42d6a1379c3e64.tar.xz
eclipse.jdt.core-7888e9aab7a7900265cb9a598a42d6a1379c3e64.zip
Fix for bug 386901 - Eclipse does not pass all annotated classes toI20130512-2000I20130511-1500I20130510-2000I20130509-2000
annotation processor
-rw-r--r--org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java39
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java6
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java15
3 files changed, 56 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
index 124aaafa18..bd64a00d9a 100644
--- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
+++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -37,7 +37,9 @@ public class BasicBuildTests extends BuilderTests {
static {
// TESTS_NAMES = new String[] { "testBug392727" };
}
-
+ {
+ System.setProperty(JavaModelManager.MAX_COMPILED_UNITS_AT_ONCE, "0");
+ }
public static Test suite() {
return buildTestSuite(BasicBuildTests.class);
}
@@ -569,4 +571,37 @@ public class BasicBuildTests extends BuilderTests {
org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = save;
}
}
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=386901
+ public void testbBug386901() throws JavaModelException {
+ IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$
+ env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$
+
+ env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$
+ "package p; \n"+ //$NON-NLS-1$
+ "public class AA {} \n"+ //$NON-NLS-1$
+ "class AZ {}"); //$NON-NLS-1$
+
+ IPath pathToAB = env.addClass(root, "p", "AB", //$NON-NLS-1$ //$NON-NLS-2$
+ "package p; \n"+ //$NON-NLS-1$
+ "public class AB extends AZ {}"); //$NON-NLS-1$
+
+ int previous = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE;
+ org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; // units compiled in batches of '1' unit
+ fullBuild(projectPath);
+ expectingProblemsFor(
+ pathToAB,
+ "Problem : AZ cannot be resolved to a type [ resource : </Project/src/p/AB.java> range : <36,38> category : <40> severity : <2>]"
+ );
+
+ org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 0; // All units compiled at once
+ fullBuild(projectPath);
+ expectingNoProblems();
+ assertEquals("Incorrect value", 0, previous);
+ }
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index 0d1635a325..c0e6303ced 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -224,6 +224,12 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
private static final String RESOLVE_REFERENCED_LIBRARIES_FOR_CONTAINERS = "resolveReferencedLibrariesForContainers"; //$NON-NLS-1$
/**
+ * Name of the JVM parameter to specify how many compilation units must be handled at once by the builder.
+ * The default value is represented by <code>AbstractImageBuilder#MAX_AT_ONCE</code>.
+ */
+ public static final String MAX_COMPILED_UNITS_AT_ONCE = "maxCompiledUnitsAtOnce"; //$NON-NLS-1$
+
+ /**
* Special value used for recognizing ongoing initialization and breaking initialization cycles
*/
public final static IPath VARIABLE_INITIALIZATION_IN_PROGRESS = new Path("Variable Initialization In Progress"); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
index 71c0c26723..b5ca8a58b3 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -84,6 +84,17 @@ public final static Integer P_HIGH = new Integer(IMarker.PRIORITY_HIGH);
public final static Integer P_NORMAL = new Integer(IMarker.PRIORITY_NORMAL);
public final static Integer P_LOW = new Integer(IMarker.PRIORITY_LOW);
+static {
+ String property = System.getProperty(JavaModelManager.MAX_COMPILED_UNITS_AT_ONCE);
+ if (property != null) {
+ try {
+ MAX_AT_ONCE = Integer.parseInt(property);
+ } catch (Exception e) {
+ // ignore and let the default value be used
+ }
+ }
+}
+
protected AbstractImageBuilder(JavaBuilder javaBuilder, boolean buildStarting, State newState) {
// local copies
this.javaBuilder = javaBuilder;
@@ -293,7 +304,7 @@ protected void compile(SourceFile[] units) {
}
int unitsLength = units.length;
- this.compiledAllAtOnce = unitsLength <= MAX_AT_ONCE;
+ this.compiledAllAtOnce = MAX_AT_ONCE == 0 || unitsLength <= MAX_AT_ONCE;
if (this.compiledAllAtOnce) {
// do them all now
if (JavaBuilder.DEBUG)

Back to the top