From 056b30ee9530790ade82bb92251d3fa658ebb38a Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sat, 18 Nov 2023 22:12:25 +0100 Subject: [PATCH] Replace org.eclipse.core.runtime.Path by IPath --- .../m2e/tests/BuildPathManagerTest.java | 38 ++++---- .../m2e/tests/ClasspathProviderTest.java | 86 +++++++++---------- .../ProjectConfigurationManagerTest.java | 23 +++-- .../TestFancyClassifierClasspathProvider.java | 9 +- ...rSettingsWithEncodingConfiguratorTest.java | 24 +++--- .../ResourcesEncodingConfiguratorTest.java | 38 ++++---- .../TestProjectConfigurator3.java | 3 +- .../m2e/tests/embedder/MavenModelUtil.java | 4 +- .../m2e/tests/jdt/JavaClasspathTest.java | 4 +- .../ClasspathEntryDescriptorTest.java | 4 +- ...MavenClasspathContainerSaveHelperTest.java | 12 +-- .../m2e/tests/launch/LaunchingUtilsTest.java | 3 +- 12 files changed, 124 insertions(+), 124 deletions(-) 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 bb5a1ef37..a73b36856 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 @@ -46,7 +46,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IAccessRule; import org.eclipse.jdt.core.IClasspathAttribute; import org.eclipse.jdt.core.IClasspathContainer; @@ -90,6 +89,7 @@ public class BuildPathManagerTest extends AbstractMavenProjectTestCase { private ProjectRegistryManager manager; + private boolean initialDownloadSources; @Override @@ -265,7 +265,7 @@ public void testProjectImport001_useMavenOutputFolders() throws Exception { IJavaProject javaProject = JavaCore.create(project); String outputPath = "/projectimport-p001/target/classes"; - assertEquals(new Path(outputPath), javaProject.getOutputLocation()); + assertEquals(IPath.fromOSString(outputPath), javaProject.getOutputLocation()); String srcMain = "/projectimport-p001/src/main/java"; String srcTest = "/projectimport-p001/src/test/java"; @@ -273,8 +273,8 @@ public void testProjectImport001_useMavenOutputFolders() throws Exception { IClasspathEntry cp0 = map.get(srcMain); IClasspathEntry cp1 = map.get(srcTest); - assertEquals(new Path(outputPath), cp0.getOutputLocation()); - assertEquals(new Path("/projectimport-p001/target/test-classes"), cp1.getOutputLocation()); + assertEquals(IPath.fromOSString(outputPath), cp0.getOutputLocation()); + assertEquals(IPath.fromOSString("/projectimport-p001/target/test-classes"), cp1.getOutputLocation()); } // disabled nested modules tests @@ -290,12 +290,12 @@ public void _testProjectImport002_useMavenOutputFolders() throws Exception { IJavaProject javaProject = JavaCore.create(project); - assertEquals(new Path("/projectimport-p002/target/classes"), javaProject.getOutputLocation()); + assertEquals(IPath.fromOSString("/projectimport-p002/target/classes"), javaProject.getOutputLocation()); IClasspathEntry[] cp = javaProject.getRawClasspath(); assertEquals(3, cp.length); - assertEquals(new Path("/projectimport-p002/p002-m1/src/main/java"), cp[0].getPath()); - assertEquals(new Path("/projectimport-p002/p002-m1/target/classes"), cp[0].getOutputLocation()); + assertEquals(IPath.fromOSString("/projectimport-p002/p002-m1/src/main/java"), cp[0].getPath()); + assertEquals(IPath.fromOSString("/projectimport-p002/p002-m1/target/classes"), cp[0].getOutputLocation()); } @Test @@ -319,7 +319,7 @@ public void testClasspathOrderWorkspace001() throws Exception { // order according to mvn -X assertEquals(4, cp.length); - assertEquals(new Path("/p2"), cp[0].getPath()); + assertEquals(IPath.fromOSString("/p2"), cp[0].getPath()); assertEquals("junit-4.13.1.jar", cp[2].getPath().lastSegment()); assertEquals("easymock-1.0.jar", cp[1].getPath().lastSegment()); @@ -449,8 +449,8 @@ public void testDownloadSources_001_sourceAttachment() throws Exception { IPath entryPath = getClasspathEntries(project)[0].getPath(); - IPath srcPath = new Path("/a"); - IPath srcRoot = new Path("/b"); + IPath srcPath = IPath.fromOSString("/a"); + IPath srcRoot = IPath.fromOSString("/b"); String javaDocUrl = "c"; IClasspathAttribute attribute = JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, @@ -1066,14 +1066,14 @@ public void testSimpleProjectInExternalLocation() throws CoreException, IOExcept tmp.delete(); //deleting a tmp file so we can use the name for a folder final String projectName1 = "external-simple-project-1"; - createSimpleProject(projectName1, new Path(tmp.getAbsolutePath()).append(projectName1)); + createSimpleProject(projectName1, IPath.fromOSString(tmp.getAbsolutePath()).append(projectName1)); final String projectName2 = "external-simple-project-2"; File existingFolder = new File(tmp, projectName2); existingFolder.mkdirs(); new File(existingFolder, IMavenConstants.POM_FILE_NAME).createNewFile(); try { - createSimpleProject(projectName2, new Path(tmp.getAbsolutePath()).append(projectName2)); + createSimpleProject(projectName2, IPath.fromOSString(tmp.getAbsolutePath()).append(projectName2)); fail("Project creation should fail if the POM exists in the target folder"); } catch(CoreException e) { final String msg = IMavenConstants.POM_FILE_NAME + " already exists"; @@ -1108,7 +1108,7 @@ public void testArchetypeProjectInExternalLocation() throws CoreException, IOExc tmp.delete(); //deleting a tmp file so we can use the name for a folder final String projectName1 = "external-archetype-project-1"; - IProject project1 = createArchetypeProject(projectName1, new Path(tmp.getAbsolutePath()).append(projectName1), + IProject project1 = createArchetypeProject(projectName1, IPath.fromOSString(tmp.getAbsolutePath()).append(projectName1), quickStart); assertNotNull(JavaCore.create(project1)); // TODO more meaningful assertion @@ -1117,7 +1117,7 @@ public void testArchetypeProjectInExternalLocation() throws CoreException, IOExc existingFolder.mkdirs(); new File(existingFolder, IMavenConstants.POM_FILE_NAME).createNewFile(); try { - createArchetypeProject(projectName2, new Path(tmp.getAbsolutePath()).append(projectName2), quickStart); + createArchetypeProject(projectName2, IPath.fromOSString(tmp.getAbsolutePath()).append(projectName2), quickStart); fail("Project creation should fail if the POM exists in the target folder"); } catch(CoreException e) { // this is supposed to happen @@ -1178,20 +1178,20 @@ public void testMNGECLIPSE_696_compiler_includes_excludes() throws Exception { final IPath[] inclusionsMain = cpMain.getInclusionPatterns(); assertEquals(2, inclusionsMain.length); - assertEquals(new Path("org/apache/maven/"), inclusionsMain[0]); - assertEquals(new Path("org/maven/ide/eclipse/"), inclusionsMain[1]); + assertEquals(IPath.fromOSString("org/apache/maven/"), inclusionsMain[0]); + assertEquals(IPath.fromOSString("org/maven/ide/eclipse/"), inclusionsMain[1]); final IPath[] exclusionsMain = cpMain.getExclusionPatterns(); assertEquals(1, exclusionsMain.length); - assertEquals(new Path("org/maven/ide/eclipse/tests/"), exclusionsMain[0]); + assertEquals(IPath.fromOSString("org/maven/ide/eclipse/tests/"), exclusionsMain[0]); final IPath[] inclusionsTest = cpTest.getInclusionPatterns(); assertEquals(1, inclusionsTest.length); - assertEquals(new Path("org/apache/maven/tests/"), inclusionsTest[0]); + assertEquals(IPath.fromOSString("org/apache/maven/tests/"), inclusionsTest[0]); final IPath[] exclusionsTest = cpTest.getExclusionPatterns(); assertEquals(1, exclusionsTest.length); - assertEquals(new Path("org/apache/maven/tests/Excluded.java"), exclusionsTest[0]); + assertEquals(IPath.fromOSString("org/apache/maven/tests/Excluded.java"), exclusionsTest[0]); } @Test diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ClasspathProviderTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ClasspathProviderTest.java index 5f8da117f..bbe314903 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ClasspathProviderTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/ClasspathProviderTest.java @@ -32,7 +32,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.IPath; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; @@ -86,10 +86,10 @@ public void test() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 4, userClasspath.length); - assertEquals(new Path("/cptest/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/cptest/target/classes"), userClasspath[0].getPath()); assertEquals("testlib-2.0.jar", userClasspath[1].getPath().lastSegment()); assertEquals("commons-logging-1.0.2.jar", userClasspath[2].getPath().lastSegment()); - assertEquals(new Path("/cptest2/target/classes"), userClasspath[3].getPath()); + assertEquals(IPath.fromOSString("/cptest2/target/classes"), userClasspath[3].getPath()); } @Test @@ -112,8 +112,8 @@ public void testNonDefaultTestSource() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 2, userClasspath.length); - assertEquals(new Path("/515398/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/515398/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/515398/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/515398/target/classes"), userClasspath[1].getPath()); } @Test @@ -137,11 +137,11 @@ public void testSourcePath() throws Exception { // source path contains project entries assertEquals(Arrays.asList(userClasspath).toString(), 4, userClasspath.length); - assertEquals(new Path("/cptest"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/cptest"), userClasspath[0].getPath()); assertEquals(IRuntimeClasspathEntry.PROJECT, userClasspath[0].getType()); assertEquals("testlib-2.0.jar", userClasspath[1].getPath().lastSegment()); assertEquals("commons-logging-1.0.2.jar", userClasspath[2].getPath().lastSegment()); - assertEquals(new Path("/cptest2"), userClasspath[3].getPath()); + assertEquals(IPath.fromOSString("/cptest2"), userClasspath[3].getPath()); assertEquals(IRuntimeClasspathEntry.PROJECT, userClasspath[3].getType()); } @@ -170,7 +170,7 @@ public void testNoFilterResources() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 1, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-nofilterresources/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-nofilterresources/target/classes"), userClasspath[0].getPath()); } @Test @@ -205,8 +205,8 @@ public void testJunitClasspathOrder() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-junit/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-junit/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-junit/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-junit/target/classes"), userClasspath[1].getPath()); } // This require TestNG plugin to be present @@ -226,8 +226,8 @@ public void testJunitClasspathOrder() throws Exception { // IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); // // assertEquals(Arrays.asList(userClasspath).toString(), 4, userClasspath.length); -// assertEquals(new Path("/runtimeclasspath-testng/target/test-classes"), userClasspath[0].getPath()); -// assertEquals(new Path("/runtimeclasspath-testng/target/classes"), userClasspath[1].getPath()); +// assertEquals(IPath.fromOSString("/runtimeclasspath-testng/target/test-classes"), userClasspath[0].getPath()); +// assertEquals(IPath.fromOSString("/runtimeclasspath-testng/target/classes"), userClasspath[1].getPath()); // assertEquals("testng-5.8-jdk15.jar", userClasspath[2].getPath().lastSegment()); // assertEquals("junit-3.8.1.jar", userClasspath[3].getPath().lastSegment()); // } @@ -245,7 +245,7 @@ public void testProvidedScopeApp() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 2, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-providedscope/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-providedscope/target/classes"), userClasspath[0].getPath()); assertEquals("junit-4.13.1.jar", userClasspath[1].getPath().lastSegment()); } @@ -263,8 +263,8 @@ public void testProvidedScopeTestApp() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-providedscope/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-providedscope/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-providedscope/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-providedscope/target/classes"), userClasspath[1].getPath()); assertEquals("junit-4.13.1.jar", userClasspath[2].getPath().lastSegment()); } @@ -282,8 +282,8 @@ public void testProvidedScopeAppTest() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-providedscope/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-providedscope/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-providedscope/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-providedscope/target/classes"), userClasspath[1].getPath()); assertEquals("junit-4.13.1.jar", userClasspath[2].getPath().lastSegment()); } @@ -322,7 +322,7 @@ public void testSystemScope() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 2, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-systemscope/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-systemscope/target/classes"), userClasspath[0].getPath()); assertEquals("log4j-1.2.13.jar", userClasspath[1].getPath().lastSegment()); } @@ -378,7 +378,7 @@ public void testCustomBuildpath() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-custombuildpath/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-custombuildpath/target/classes"), userClasspath[0].getPath()); assertEquals(javaproject.getFullPath(), userClasspath[1].getPath()); assertEquals("custom.jar", userClasspath[2].getPath().lastSegment()); } @@ -400,9 +400,9 @@ public void testTestClassesDefaultClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope02/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope02/target/classes"), userClasspath[1].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/target/classes"), userClasspath[2].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope02/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope02/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/target/classes"), userClasspath[2].getPath()); } @Test @@ -422,9 +422,9 @@ public void testTestClassesTestsClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope03/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope03/target/classes"), userClasspath[1].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/target/test-classes"), userClasspath[2].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope03/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope03/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/target/test-classes"), userClasspath[2].getPath()); } @Test @@ -444,10 +444,10 @@ public void testTestClassesDefaultAndTestsClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 4, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope04/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope04/target/classes"), userClasspath[1].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/target/classes"), userClasspath[2].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/target/test-classes"), userClasspath[3].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope04/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope04/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/target/classes"), userClasspath[2].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/target/test-classes"), userClasspath[3].getPath()); } @Test @@ -467,10 +467,10 @@ public void testTestClassesTestScopeAndTestType() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals(Arrays.asList(userClasspath).toString(), 4, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope05/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope05/target/classes"), userClasspath[1].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/target/classes"), userClasspath[2].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/target/test-classes"), userClasspath[3].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope05/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope05/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/target/classes"), userClasspath[2].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/target/test-classes"), userClasspath[3].getPath()); } @Test @@ -531,9 +531,9 @@ public void test368230_FancyClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals("Invalid runtime classpath :" + Arrays.asList(userClasspath).toString(), 3, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope06/target/classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/src/main/java"), userClasspath[1].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/src/main/resources"), userClasspath[2].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope06/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/src/main/java"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/src/main/resources"), userClasspath[2].getPath()); } /*check test classpath*/{ @@ -545,10 +545,10 @@ public void test368230_FancyClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals("Invalid test classpath :" + Arrays.asList(userClasspath).toString(), 4, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope06/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope06/target/classes"), userClasspath[1].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/src/test/java"), userClasspath[2].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope01/src/test/resources"), userClasspath[3].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope06/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope06/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/src/test/java"), userClasspath[2].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope01/src/test/resources"), userClasspath[3].getPath()); } } @@ -571,7 +571,7 @@ public void test368230_unknownClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals("Invalid runtime classpath :" + Arrays.asList(userClasspath).toString(), 1, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope07/target/classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope07/target/classes"), userClasspath[0].getPath()); } /*check test classpath*/{ @@ -583,8 +583,8 @@ public void test368230_unknownClassifier() throws Exception { IRuntimeClasspathEntry[] userClasspath = getUserClasspathEntries(resolvedClasspath); assertEquals("Invalid test classpath :" + Arrays.asList(userClasspath).toString(), 2, userClasspath.length); - assertEquals(new Path("/runtimeclasspath-testscope07/target/test-classes"), userClasspath[0].getPath()); - assertEquals(new Path("/runtimeclasspath-testscope07/target/classes"), userClasspath[1].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope07/target/test-classes"), userClasspath[0].getPath()); + assertEquals(IPath.fromOSString("/runtimeclasspath-testscope07/target/classes"), userClasspath[1].getPath()); } } 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 72a6088b6..cf1b020c3 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 @@ -45,7 +45,6 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.core.runtime.jobs.Job; @@ -399,7 +398,7 @@ public void test447460MultipleUpdateConfiguration() throws Exception { IPath[] exclusions = cpEntry.getExclusionPatterns(); assertNotNull(exclusions); assertEquals("Classpath resource entry contains more or less than one exclusion pattern.", 1, exclusions.length); - assertEquals("Exclusion pattern is supposed to be '**' !", new Path("**"), exclusions[0]); + assertEquals("Exclusion pattern is supposed to be '**' !", IPath.fromOSString("**"), exclusions[0]); } } } @@ -423,7 +422,7 @@ public void testConfigureProjectEncodingForBasicProject() throws Exception { String projectEncoding = project.getDefaultCharset(); assertEquals("Encoding configured through Maven property not set on project", "ISO-8859-1", projectEncoding); - String testfolderEncoding = project.getFolder(new Path("testfolder")).getDefaultCharset(); + String testfolderEncoding = project.getFolder(IPath.fromOSString("testfolder")).getDefaultCharset(); assertEquals("Encoding for folder should have been inherited from project", "ISO-8859-1", testfolderEncoding); copyContent(project, new File("projects/projectEncoding/p001/pom2.xml"), "pom.xml"); @@ -432,7 +431,7 @@ public void testConfigureProjectEncodingForBasicProject() throws Exception { String projectEncodingChanged = project.getDefaultCharset(); assertEquals("Encoding configured through Maven property not set on project", "UTF-16", projectEncodingChanged); - String testfolderEncodingChanged = project.getFolder(new Path("testfolder")).getDefaultCharset(); + String testfolderEncodingChanged = project.getFolder(IPath.fromOSString("testfolder")).getDefaultCharset(); assertEquals("Encoding for folder should have been inherited from project", "UTF-16", testfolderEncodingChanged); } @@ -442,7 +441,7 @@ public void testRevertToContainerDefinedEncoding() throws Exception { WorkspaceHelpers.assertNoErrors(project); String containerProjectEncoding = project.getDefaultCharset(); - String containerTestfolderEncoding = project.getFolder(new Path("testfolder")).getDefaultCharset(); + String containerTestfolderEncoding = project.getFolder(IPath.fromOSString("testfolder")).getDefaultCharset(); assertEquals("Encoding for folder should be the same as project encoding", containerProjectEncoding, containerTestfolderEncoding); @@ -459,7 +458,7 @@ public void testRevertToContainerDefinedEncoding() throws Exception { String projectEncodingReverted = project.getDefaultCharset(); assertEquals("Project encoding not reverted to container defined", containerProjectEncoding, projectEncodingReverted); - String testfolderEncodingReverted = project.getFolder(new Path("testfolder")).getDefaultCharset(); + String testfolderEncodingReverted = project.getFolder(IPath.fromOSString("testfolder")).getDefaultCharset(); assertEquals("Folder encoding not reverted to container defined", containerTestfolderEncoding, testfolderEncodingReverted); } @@ -469,14 +468,14 @@ public void testKeepEncodingSetByUserForSubfoldersAndFiles() throws Exception { IProject project = importProject("projects/projectEncoding/p003/pom.xml"); WorkspaceHelpers.assertNoErrors(project); - project.getFolder(new Path("testfolder")).setDefaultCharset("ISO-8859-1", monitor); - project.getFile(new Path("testfolder/testfile.txt")).setCharset("UTF-16", monitor); + project.getFolder(IPath.fromOSString("testfolder")).setDefaultCharset("ISO-8859-1", monitor); + project.getFile(IPath.fromOSString("testfolder/testfile.txt")).setCharset("UTF-16", monitor); MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String testfolderEncoding = project.getFolder(new Path("testfolder")).getDefaultCharset(); + String testfolderEncoding = project.getFolder(IPath.fromOSString("testfolder")).getDefaultCharset(); assertEquals("Folder encoding set by user not kept", "ISO-8859-1", testfolderEncoding); - String testfileEncoding = project.getFile(new Path("testfolder/testfile.txt")).getCharset(); + String testfileEncoding = project.getFile(IPath.fromOSString("testfolder/testfile.txt")).getCharset(); assertEquals("File encoding set by user not kept", "UTF-16", testfileEncoding); } @@ -542,7 +541,7 @@ public void testHiddenFolderForSimpleModule() throws Exception { visibleModuleModel.setArtifactId(moduleName); IProject moduleProject = createSimpleProject(moduleName, - parentProject.getLocation().append(new Path(moduleName)), visibleModuleModel); + parentProject.getLocation().append(IPath.fromOSString(moduleName)), visibleModuleModel); assertNoErrors(moduleProject); parentProject.refreshLocal(IResource.DEPTH_ONE, monitor); @@ -562,7 +561,7 @@ public void testHiddenFolderForSimpleModule() throws Exception { hiddenModuleModel.setArtifactId(moduleName); IProject moduleProject = createSimpleProject(moduleName, - parentProject.getLocation().append(new Path(moduleName)), hiddenModuleModel); + parentProject.getLocation().append(IPath.fromOSString(moduleName)), hiddenModuleModel); assertNoErrors(moduleProject); parentProject.refreshLocal(IResource.DEPTH_ONE, monitor); diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/TestFancyClassifierClasspathProvider.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/TestFancyClassifierClasspathProvider.java index 1f5eacee1..e7ae1f43b 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/TestFancyClassifierClasspathProvider.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/TestFancyClassifierClasspathProvider.java @@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; import org.eclipse.jdt.launching.IRuntimeClasspathEntry; import org.eclipse.m2e.core.project.IMavenProjectFacade; @@ -41,8 +40,8 @@ public String getClassifier() { public void setRuntimeClasspath(Set runtimeClasspath, IMavenProjectFacade mavenProjectFacade, IProgressMonitor monitor, int classpathProperty) { Set folders = new LinkedHashSet<>(); - folders.add(new Path("src/main/java")); - folders.add(new Path("src/main/resources")); + folders.add(IPath.fromOSString("src/main/java")); + folders.add(IPath.fromOSString("src/main/resources")); addFolders(runtimeClasspath, mavenProjectFacade.getProject(), folders, classpathProperty); } @@ -50,8 +49,8 @@ public void setRuntimeClasspath(Set runtimeClasspath, IM public void setTestClasspath(Set testClasspath, IMavenProjectFacade mavenProjectFacade, IProgressMonitor monitor, int classpathProperty) { Set folders = new LinkedHashSet<>(); - folders.add(new Path("src/test/java")); - folders.add(new Path("src/test/resources")); + folders.add(IPath.fromOSString("src/test/java")); + folders.add(IPath.fromOSString("src/test/resources")); addFolders(testClasspath, mavenProjectFacade.getProject(), folders, classpathProperty); } diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/CompilerSettingsWithEncodingConfiguratorTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/CompilerSettingsWithEncodingConfiguratorTest.java index a9ba685c9..f3570b0e1 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/CompilerSettingsWithEncodingConfiguratorTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/CompilerSettingsWithEncodingConfiguratorTest.java @@ -22,7 +22,6 @@ import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; @@ -38,14 +37,15 @@ public void test001_shouldSetEncodingForBasicProject() throws Exception { IJavaProject javaProject = JavaCore.create(project); WorkspaceHelpers.assertNoErrors(project); - String encoding = javaProject.getProject().getFolder(new Path("src/main/java")).getDefaultCharset(); + String encoding = javaProject.getProject().getFolder(IPath.fromOSString("src/main/java")).getDefaultCharset(); assertEquals("Encoding should match", "ISO-8859-1", encoding); copyContent(project, new File("projects/compilerSettingsWithEncoding/p001/pom-UTF-16.xml"), "pom.xml"); MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String encodingChanged = javaProject.getProject().getFolder(new Path("src/main/java")).getDefaultCharset(); + String encodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/main/java")) + .getDefaultCharset(); assertEquals("Encoding (changed) should match", "UTF-16", encodingChanged); } @@ -55,26 +55,30 @@ public void test002_shouldResetToContainerDefinedEncoding() throws Exception { IJavaProject javaProject = JavaCore.create(project); WorkspaceHelpers.assertNoErrors(project); - String containerMainJavaEncoding = javaProject.getProject().getFolder(new Path("src/main/java")) + String containerMainJavaEncoding = javaProject.getProject().getFolder(IPath.fromOSString("src/main/java")) .getDefaultCharset(); - String containerTestJavaEncoding = javaProject.getProject().getFolder(new Path("src/test/java")) + String containerTestJavaEncoding = javaProject.getProject().getFolder(IPath.fromOSString("src/test/java")) .getDefaultCharset(); copyContent(project, new File("projects/compilerSettingsWithEncoding/p002/pom2.xml"), "pom.xml"); MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String mainJavaEncodingChanged = javaProject.getProject().getFolder(new Path("src/main/java")).getDefaultCharset(); + String mainJavaEncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/main/java")) + .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", mainJavaEncodingChanged); - String testJavaEncodingChanged = javaProject.getProject().getFolder(new Path("src/test/java")).getDefaultCharset(); + String testJavaEncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/test/java")) + .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", testJavaEncodingChanged); copyContent(project, new File("projects/compilerSettingsWithEncoding/p002/pom.xml"), "pom.xml"); MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String mainJavaEncodingReverted = javaProject.getProject().getFolder(new Path("src/main/java")).getDefaultCharset(); + String mainJavaEncodingReverted = javaProject.getProject().getFolder(IPath.fromOSString("src/main/java")) + .getDefaultCharset(); assertEquals("Folder encoding not reverted to container defined", containerMainJavaEncoding, mainJavaEncodingReverted); - String testJavaEncodingReverted = javaProject.getProject().getFolder(new Path("src/test/java")).getDefaultCharset(); + String testJavaEncodingReverted = javaProject.getProject().getFolder(IPath.fromOSString("src/test/java")) + .getDefaultCharset(); assertEquals("Folder encoding not reverted to container defined", containerTestJavaEncoding, testJavaEncodingReverted); } @@ -93,7 +97,7 @@ protected IPath getProjectRelativePath(IProject project, String absolutePath) { } else { relative = absolutePath; } - return new Path(relative.replace('\\', '/')); //$NON-NLS-1$ //$NON-NLS-2$ + return IPath.fromOSString(relative.replace('\\', '/')); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/ResourcesEncodingConfiguratorTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/ResourcesEncodingConfiguratorTest.java index 7ede89737..a22267793 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/ResourcesEncodingConfiguratorTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/ResourcesEncodingConfiguratorTest.java @@ -20,7 +20,7 @@ import org.junit.Test; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; @@ -40,10 +40,10 @@ public void test001_shouldConfigureEncodingForBasicProject() throws Exception { IJavaProject javaProject = JavaCore.create(project); WorkspaceHelpers.assertNoErrors(project); - String mainResourceEncoding = javaProject.getProject().getFolder(new Path("src/main/resources")) + String mainResourceEncoding = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", mainResourceEncoding); - String testResourceEncoding = javaProject.getProject().getFolder(new Path("src/test/resources")) + String testResourceEncoding = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", testResourceEncoding); @@ -51,10 +51,10 @@ public void test001_shouldConfigureEncodingForBasicProject() throws Exception { MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String mainResourceEncodingChanged = javaProject.getProject().getFolder(new Path("src/main/resources")) + String mainResourceEncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", mainResourceEncodingChanged); - String testResourceEncodingChanged = javaProject.getProject().getFolder(new Path("src/test/resources")) + String testResourceEncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", testResourceEncodingChanged); } @@ -65,15 +65,15 @@ public void test002_shouldConfigureEncodingForProjectWithSeveralResourceFolders( IJavaProject javaProject = JavaCore.create(project); WorkspaceHelpers.assertNoErrors(project); - String mainResource1Encoding = javaProject.getProject().getFolder(new Path("src/main/resources")) + String mainResource1Encoding = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", mainResource1Encoding); - String mainResource2Encoding = javaProject.getProject().getFolder(new Path("extra-resources")).getDefaultCharset(); + String mainResource2Encoding = javaProject.getProject().getFolder(IPath.fromOSString("extra-resources")).getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", mainResource2Encoding); - String testResource1Encoding = javaProject.getProject().getFolder(new Path("src/test/resources")) + String testResource1Encoding = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", testResource1Encoding); - String testResource2Encoding = javaProject.getProject().getFolder(new Path("extra-test-resources")) + String testResource2Encoding = javaProject.getProject().getFolder(IPath.fromOSString("extra-test-resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", testResource2Encoding); @@ -81,16 +81,16 @@ public void test002_shouldConfigureEncodingForProjectWithSeveralResourceFolders( MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String mainResource1EncodingChanged = javaProject.getProject().getFolder(new Path("src/main/resources")) + String mainResource1EncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", mainResource1EncodingChanged); - String mainResource2EncodingChanged = javaProject.getProject().getFolder(new Path("extra-resources")) + String mainResource2EncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("extra-resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", mainResource2EncodingChanged); - String testResource1EncodingChanged = javaProject.getProject().getFolder(new Path("src/test/resources")) + String testResource1EncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", testResource1EncodingChanged); - String testResource2EncodingChanged = javaProject.getProject().getFolder(new Path("extra-test-resources")) + String testResource2EncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("extra-test-resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", testResource2EncodingChanged); } @@ -101,19 +101,19 @@ public void test003_shouldResetToContainerDefinedEncoding() throws Exception { IJavaProject javaProject = JavaCore.create(project); WorkspaceHelpers.assertNoErrors(project); - String containerMainResourceEncoding = javaProject.getProject().getFolder(new Path("src/main/resources")) + String containerMainResourceEncoding = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); - String containerTestResourceEncoding = javaProject.getProject().getFolder(new Path("src/test/resources")) + String containerTestResourceEncoding = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); copyContent(project, new File("projects/resourcesEncoding/p003/pom2.xml"), "pom.xml"); MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String mainResourceEncodingChanged = javaProject.getProject().getFolder(new Path("src/main/resources")) + String mainResourceEncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "ISO-8859-1", mainResourceEncodingChanged); - String testResourceEncodingChanged = javaProject.getProject().getFolder(new Path("src/test/resources")) + String testResourceEncodingChanged = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); assertEquals("Encoding configured for plugin not set on folder", "UTF-16", testResourceEncodingChanged); @@ -121,11 +121,11 @@ public void test003_shouldResetToContainerDefinedEncoding() throws Exception { MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor); - String mainResourceEncodingReverted = javaProject.getProject().getFolder(new Path("src/main/resources")) + String mainResourceEncodingReverted = javaProject.getProject().getFolder(IPath.fromOSString("src/main/resources")) .getDefaultCharset(); assertEquals("Folder encoding not reverted to container defined", containerMainResourceEncoding, mainResourceEncodingReverted); - String testResourceEncodingReverted = javaProject.getProject().getFolder(new Path("src/test/resources")) + String testResourceEncodingReverted = javaProject.getProject().getFolder(IPath.fromOSString("src/test/resources")) .getDefaultCharset(); assertEquals("Folder encoding not reverted to container defined", containerTestResourceEncoding, testResourceEncodingReverted); diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/TestProjectConfigurator3.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/TestProjectConfigurator3.java index b3f5299ff..0eca8d001 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/TestProjectConfigurator3.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/configurators/TestProjectConfigurator3.java @@ -23,7 +23,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.codehaus.plexus.util.IOUtil; @@ -48,7 +47,7 @@ public void configure(ProjectConfigurationRequest request, IProgressMonitor moni System.err.println("running " + getName()); - IPath logPath = new Path("target/configurator-log.txt"); + IPath logPath = IPath.fromOSString("target/configurator-log.txt"); IFile file = request.mavenProjectFacade().getProject().getFile(logPath); String text = null; diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/embedder/MavenModelUtil.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/embedder/MavenModelUtil.java index d1617fd3e..bd2bc714d 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/embedder/MavenModelUtil.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/embedder/MavenModelUtil.java @@ -25,9 +25,9 @@ import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; @@ -71,7 +71,7 @@ public static String toString(Resource resource) throws IOException, Exception { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); - IFile file = root.getFile(new Path(uri.toPlatformString(true))); + IFile file = root.getFile(IPath.fromOSString(uri.toPlatformString(true))); StringWriter sw = new StringWriter(); diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/JavaClasspathTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/JavaClasspathTest.java index 5b290ebba..7478cfe99 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/JavaClasspathTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/JavaClasspathTest.java @@ -36,7 +36,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.IAccessRule; import org.eclipse.jdt.core.IClasspathAttribute; import org.eclipse.jdt.core.IClasspathEntry; @@ -558,7 +558,7 @@ private Predicate mavenClasspathEntryDescriptor() { } private void addAccessRule(IClasspathEntryDescriptor entry) { - entry.addAccessRule(JavaCore.newAccessRule(Path.fromPortableString("**/internal/**"), IAccessRule.K_DISCOURAGED)); + entry.addAccessRule(JavaCore.newAccessRule(IPath.fromPortableString("**/internal/**"), IAccessRule.K_DISCOURAGED)); } private IExecutionEnvironment getLatestExecutionEnvironment() { diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/ClasspathEntryDescriptorTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/ClasspathEntryDescriptorTest.java index 2e760efc8..e80ab705b 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/ClasspathEntryDescriptorTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/ClasspathEntryDescriptorTest.java @@ -16,7 +16,7 @@ import org.junit.Assert; import org.junit.Test; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.m2e.core.embedder.ArtifactKey; @@ -29,7 +29,7 @@ public class ClasspathEntryDescriptorTest { public void testArtifactKeyDeserialization() throws Exception { final ArtifactKey key = new ArtifactKey("g", "a", "v", "c"); - ClasspathEntryDescriptor original = new ClasspathEntryDescriptor(IClasspathEntry.CPE_LIBRARY, new Path("/path")); + ClasspathEntryDescriptor original = new ClasspathEntryDescriptor(IClasspathEntry.CPE_LIBRARY, IPath.fromOSString("/path")); original.setArtifactKey(key); ClasspathEntryDescriptor deserelized = new ClasspathEntryDescriptor(original.toClasspathEntry()); diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/MavenClasspathContainerSaveHelperTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/MavenClasspathContainerSaveHelperTest.java index cd8ac5b73..b25301382 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/MavenClasspathContainerSaveHelperTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/jdt/internal/MavenClasspathContainerSaveHelperTest.java @@ -20,7 +20,7 @@ import org.junit.Test; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.IAccessRule; import org.eclipse.jdt.core.IClasspathAttribute; import org.eclipse.jdt.core.IClasspathContainer; @@ -41,28 +41,28 @@ public void testClasspathContainerSace() throws Exception { { IAccessRule[] accessRules = new IAccessRule[1]; - accessRules[0] = JavaCore.newAccessRule(new Path("aa/**"), IAccessRule.K_ACCESSIBLE); + accessRules[0] = JavaCore.newAccessRule(IPath.fromOSString("aa/**"), IAccessRule.K_ACCESSIBLE); IClasspathAttribute[] attributes = new IClasspathAttribute[2]; attributes[0] = JavaCore.newClasspathAttribute("foo", "11"); attributes[1] = JavaCore.newClasspathAttribute("moo", "22"); - entries[0] = JavaCore.newProjectEntry(new Path("/foo"), accessRules, true, attributes, false); + entries[0] = JavaCore.newProjectEntry(IPath.fromOSString("/foo"), accessRules, true, attributes, false); } { IAccessRule[] accessRules = new IAccessRule[1]; - accessRules[0] = JavaCore.newAccessRule(new Path("bb/**"), IAccessRule.K_DISCOURAGED); + accessRules[0] = JavaCore.newAccessRule(IPath.fromOSString("bb/**"), IAccessRule.K_DISCOURAGED); IClasspathAttribute[] attributes = new IClasspathAttribute[1]; attributes[0] = JavaCore.newClasspathAttribute("foo", "aa"); - entries[1] = JavaCore.newLibraryEntry(new Path("/foo/moo.jar"), new Path("/foo/moo-sources.jar"), new Path( + entries[1] = JavaCore.newLibraryEntry(IPath.fromOSString("/foo/moo.jar"), IPath.fromOSString("/foo/moo-sources.jar"), IPath.fromOSString( "/foo/moo-javadoc.jar"), accessRules, attributes, false); } ByteArrayOutputStream os = new ByteArrayOutputStream(); - helper.writeContainer(new MavenClasspathContainer(new Path(IClasspathManager.CONTAINER_ID), entries), os); + helper.writeContainer(new MavenClasspathContainer(IPath.fromOSString(IClasspathManager.CONTAINER_ID), entries), os); IClasspathContainer container = helper.readContainer(new ByteArrayInputStream(os.toByteArray())); diff --git a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/launch/LaunchingUtilsTest.java b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/launch/LaunchingUtilsTest.java index 1dfa71b92..d10496bdb 100644 --- a/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/launch/LaunchingUtilsTest.java +++ b/org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/launch/LaunchingUtilsTest.java @@ -25,7 +25,6 @@ import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; import org.eclipse.m2e.internal.launch.LaunchingUtils; import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase; @@ -65,7 +64,7 @@ protected void moveExistingProjectLocation(IProject project, File projectTargetF project.delete(true, monitor); // create new project with same name but in a different location IProjectDescription projectDescription = workspace.newProjectDescription(project.getName()); - IPath location = Path.fromOSString(projectTargetFolder.getAbsolutePath()); + IPath location = IPath.fromOSString(projectTargetFolder.getAbsolutePath()); projectDescription.setLocation(location); project.create(projectDescription, monitor); project.open(IResource.NONE, monitor);