From 0d3bb29ac7f93789b0b6162a91ff9fc01a83ff35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Fri, 27 Sep 2024 11:22:02 +0300 Subject: [PATCH] Even more updates for pre 1.8 target removal Continuation of https://github.com/tesla/m2e-core-tests/pull/230 --- .../.settings/org.eclipse.jdt.core.prefs | 1 - .../projects/compilerSettings14/pom.xml | 29 --------- .../projects/compilerSettings18/pom.xml | 30 ---------- .../projects/compilerSettingsJsr14/pom.xml | 43 -------------- .../m2e/tests/BuildPathManagerTest.java | 59 ------------------- .../ProjectConfigurationManagerTest.java | 4 +- .../tests/project/CompilerSettings18Test.java | 33 ----------- 7 files changed, 2 insertions(+), 197 deletions(-) delete mode 100644 org.eclipse.m2e.tests/projects/compilerSettings14/.settings/org.eclipse.jdt.core.prefs delete mode 100644 org.eclipse.m2e.tests/projects/compilerSettings14/pom.xml delete mode 100644 org.eclipse.m2e.tests/projects/compilerSettings18/pom.xml delete mode 100644 org.eclipse.m2e.tests/projects/compilerSettingsJsr14/pom.xml delete mode 100644 org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/project/CompilerSettings18Test.java diff --git a/org.eclipse.m2e.tests/projects/compilerSettings14/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.m2e.tests/projects/compilerSettings14/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 73fb638b0..000000000 --- a/org.eclipse.m2e.tests/projects/compilerSettings14/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.jdt.core.compiler.maxProblemPerUnit=123 diff --git a/org.eclipse.m2e.tests/projects/compilerSettings14/pom.xml b/org.eclipse.m2e.tests/projects/compilerSettings14/pom.xml deleted file mode 100644 index 7fade8f0b..000000000 --- a/org.eclipse.m2e.tests/projects/compilerSettings14/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - - org.eclipse.m2e.test - m2e-test-parent - 1.0.0 - - - org.eclipse.m2e.projects - compilerSettings14 - 1.0.0-SNAPSHOT - jar - test project for MNGECLIPSE-646 - - - - - maven-compiler-plugin - - 1.4 - 1.4 - - - - - diff --git a/org.eclipse.m2e.tests/projects/compilerSettings18/pom.xml b/org.eclipse.m2e.tests/projects/compilerSettings18/pom.xml deleted file mode 100644 index 1afc7f716..000000000 --- a/org.eclipse.m2e.tests/projects/compilerSettings18/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - 4.0.0 - - - org.eclipse.m2e.test - m2e-test-parent - 1.0.0 - - - org.eclipse.m2e.projects - compilerSettings18 - 1.0.0-SNAPSHOT - jar - test project for bug 420848 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - diff --git a/org.eclipse.m2e.tests/projects/compilerSettingsJsr14/pom.xml b/org.eclipse.m2e.tests/projects/compilerSettingsJsr14/pom.xml deleted file mode 100644 index baea7f602..000000000 --- a/org.eclipse.m2e.tests/projects/compilerSettingsJsr14/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - - - org.eclipse.m2e.test - m2e-test-parent - 1.0.0 - - - org.eclipse.m2e.projects - compilerSettingsJsr14 - 1.0.0-SNAPSHOT - jar - test project for MNGECLIPSE-639 - - - package - - - maven-compiler-plugin - - 1.5 - jsr14 - - - - test-compiler - process-test-sources - - testCompile - - - 1.5 - 1.5 - - - - - - - diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/BuildPathManagerTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/BuildPathManagerTest.java index a73b36856..e9f679e17 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/BuildPathManagerTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/BuildPathManagerTest.java @@ -54,7 +54,6 @@ import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.launching.JavaRuntime; import org.apache.maven.archetype.catalog.Archetype; import org.apache.maven.artifact.Artifact; @@ -873,64 +872,6 @@ public void testProjectNameWithNameTemplate() throws Exception { assertTrue(workspace.getRoot().getProject("My super awesome project-0.0.1-SNAPSHOT").exists()); } - @Test - public void testCompilerSettingsJsr14() throws Exception { - deleteProject("compilerSettingsJsr14"); - - ResolverConfiguration configuration = new ResolverConfiguration(); - ProjectImportConfiguration projectImportConfiguration = new ProjectImportConfiguration(configuration); - importProject("compilerSettingsJsr14", "projects/compilerSettingsJsr14", projectImportConfiguration); - - waitForJobsToComplete(); - - IProject project = workspace.getRoot().getProject("compilerSettingsJsr14"); - assertTrue(project.exists()); - - WorkspaceHelpers.assertNoErrors(project); - - IJavaProject javaProject = JavaCore.create(project); - assertEquals("1.5", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); - assertEquals("1.5", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); - - IClasspathEntry jreEntry = getJreContainer(javaProject.getRawClasspath()); - assertEquals("J2SE-1.5", JavaRuntime.getExecutionEnvironmentId(jreEntry.getPath())); - } - - @Test - public void testCompilerSettings14() throws Exception { - deleteProject("compilerSettings14"); - - ResolverConfiguration configuration = new ResolverConfiguration(); - ProjectImportConfiguration projectImportConfiguration = new ProjectImportConfiguration(configuration); - importProject("compilerSettings14", "projects/compilerSettings14", projectImportConfiguration); - - waitForJobsToComplete(); - - IProject project = workspace.getRoot().getProject("compilerSettings14"); - assertTrue(project.exists()); - - // Build path specifies execution environment J2SE-1.4. - // There are no JREs in the workspace strictly compatible with this environment. - WorkspaceHelpers.assertNoErrors(project); - - IJavaProject javaProject = JavaCore.create(project); - assertEquals("1.4", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); - assertEquals("1.4", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); - assertEquals("123", javaProject.getOption(JavaCore.COMPILER_PB_MAX_PER_UNIT, true)); - - IClasspathEntry jreEntry = getJreContainer(javaProject.getRawClasspath()); - assertEquals("J2SE-1.4", JavaRuntime.getExecutionEnvironmentId(jreEntry.getPath())); - } - - private IClasspathEntry getJreContainer(IClasspathEntry[] entries) { - for(IClasspathEntry entry : entries) { - if(JavaRuntime.newDefaultJREContainerPath().isPrefixOf(entry.getPath())) { - return entry; - } - } - return null; - } - @Test public void testMavenBuilderOrder() throws Exception { IProject project = createExisting("builderOrder", "projects/builderOrder"); diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ProjectConfigurationManagerTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ProjectConfigurationManagerTest.java index cf1b020c3..9a108ebc1 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ProjectConfigurationManagerTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ProjectConfigurationManagerTest.java @@ -220,8 +220,8 @@ public void testExtractionOfCompilerSettingsDespiteErrorsInExecutionPlan() throw }); IJavaProject javaProject = JavaCore.create(project); - assertEquals("1.6", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); - assertEquals("1.5", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); + assertEquals("11", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); + assertEquals("11", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); } @Test diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/project/CompilerSettings18Test.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/project/CompilerSettings18Test.java deleted file mode 100644 index 6bd251cf1..000000000 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/project/CompilerSettings18Test.java +++ /dev/null @@ -1,33 +0,0 @@ - -package org.eclipse.m2e.tests.project; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; - -import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase; - - -public class CompilerSettings18Test extends AbstractMavenProjectTestCase { - @Test - public void testCompilerSettings18() throws Exception { - // this test is meaningless on java 7 (and we don't support 6 and earlier) - // sadly, junit 3 does not support junit4's "Assume", have to make test pass - if("1.7".equals(System.getProperty("java.specification.version"))) { - return; - } - - IProject project = importProject("projects/compilerSettings18/pom.xml"); - assertNoErrors(project); - waitForJobsToComplete(); - - IJavaProject javaProject = JavaCore.create(project); - assertEquals("1.8", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); - assertEquals("1.8", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); - } - -}