Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayaprakash Arthanareeswaran2013-01-29 05:06:23 +0000
committerStephan Herrmann2013-02-06 23:11:15 +0000
commit9aed9859a94bf206c8453cc75850962ebd2f7bb8 (patch)
treecf006c1dc4c8cd3b710624cb029dbb82cfafc6b6
parent140596097ba440199665d3376620ff6eaa9d20bd (diff)
downloadeclipse.jdt.core-9aed9859a94bf206c8453cc75850962ebd2f7bb8.tar.gz
eclipse.jdt.core-9aed9859a94bf206c8453cc75850962ebd2f7bb8.tar.xz
eclipse.jdt.core-9aed9859a94bf206c8453cc75850962ebd2f7bb8.zip
Fix for bug 396299 - Incompatible required libraries problem is not
updated when compliance changes
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java42
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java5
3 files changed, 46 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
index c00cad277b..ecd021f042 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.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
@@ -344,6 +344,7 @@ public static Test suite() {
suite.addTest(new ClasspathTests("testBug287164"));
suite.addTest(new ClasspathTests("testBug220928a"));
suite.addTest(new ClasspathTests("testBug220928b"));
+ suite.addTest(new ClasspathTests("testBug396299"));
return suite;
}
public void setUpSuite() throws Exception {
@@ -7420,4 +7421,43 @@ public void testBug220928b() throws CoreException {
deleteProject("P");
}
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=396299
+public void testBug396299() throws Exception {
+ boolean autoBuild = getWorkspace().isAutoBuilding();
+ IWorkspaceDescription preferences = getWorkspace().getDescription();
+ try {
+ JavaModelManager.EclipsePreferencesListener prefListener = new JavaModelManager.EclipsePreferencesListener();
+ preferences.setAutoBuilding(true);
+ getWorkspace().setDescription(preferences);
+
+ JavaProject proj1 = (JavaProject) this.createJavaProject("P1", new String[] {}, "");
+ addLibrary(proj1, "abc.jar", null, new String[] {
+ "p/X.java",
+ "package p;\n" +
+ "public class X {}\n"},
+ JavaCore.VERSION_1_4);
+ proj1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_4);
+
+ Map map = proj1.getOptions(false);
+ map.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.WARNING);
+ proj1.setOptions(map);
+
+ IEclipsePreferences eclipsePreferences = proj1.getEclipsePreferences();
+ eclipsePreferences.addPreferenceChangeListener(prefListener);
+ simulateExitRestart();
+ waitForAutoBuild();
+ assertMarkers("Unexpected markers", "", proj1);
+ map = proj1.getOptions(false);
+ map.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1);
+ proj1.setOptions(map);
+
+ assertMarkers("Unexpected markers",
+ "Incompatible .class files version in required binaries. Project \'P1\' is targeting a 1.1 runtime, but is compiled against \'P1/abc.jar\' which requires a 1.4 runtime", proj1);
+ eclipsePreferences.removePreferenceChangeListener(prefListener);
+ } finally {
+ preferences.setAutoBuilding(autoBuild);
+ getWorkspace().setDescription(preferences);
+ deleteProject("P1");
+ }
+}
}
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 57aa94c736..191e5eccb9 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
@@ -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
@@ -1481,6 +1481,7 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL) ||
+ propertyName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM) ||
propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE)) {
JavaModelManager manager = JavaModelManager.getJavaModelManager();
IJavaModel model = manager.getJavaModel();
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index c78c6971dd..4ac2ed7935 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.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
@@ -1528,7 +1528,8 @@ public class JavaProject
propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE) ||
- propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL))
+ propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL) ||
+ propertyName.equals(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))
{
manager.deltaState.addClasspathValidation(JavaProject.this);
}

Back to the top