From: Alexander Kriegisch Date: Thu, 11 Mar 2021 11:32:56 +0000 (+0700) Subject: Unify classpath handling in CompileSpec & RunSpec X-Git-Tag: java16-add-opens~36^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee2817f3e100444b38ed60a39bd745823985bc3e;p=aspectj.git Unify classpath handling in CompileSpec & RunSpec Replace directory separator '/' and surrogate path separator ',' by platform-specific separators File.separatorChar and File.pathSeparatorChar, respectively. Also make sure that replacement occurs during write access, not read access. This was handled differently in both sibling classes. I am not sure if that helps to fix any Linux CI tests, but it is worth a try. Signed-off-by: Alexander Kriegisch --- diff --git a/testing/src/test/java/org/aspectj/testing/CompileSpec.java b/testing/src/test/java/org/aspectj/testing/CompileSpec.java index 254f244a0..ac6ac6af2 100644 --- a/testing/src/test/java/org/aspectj/testing/CompileSpec.java +++ b/testing/src/test/java/org/aspectj/testing/CompileSpec.java @@ -85,7 +85,7 @@ public class CompileSpec implements ITestStep { * @param aspectpath The aspectpath to set. */ public void setAspectpath(String aspectpath) { - this.aspectpath = aspectpath.replace(',',File.pathSeparatorChar); + this.aspectpath = aspectpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } /** * @return Returns the classpath. @@ -97,7 +97,7 @@ public class CompileSpec implements ITestStep { * @param classpath The classpath to set. */ public void setClasspath(String classpath) { - this.classpath = classpath.replace(',',File.pathSeparatorChar); + this.classpath = classpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } public String getModulepath() { @@ -105,7 +105,7 @@ public class CompileSpec implements ITestStep { } public void setModulepath(String modulepath) { - this.modulepath = modulepath.replace(',', File.pathSeparatorChar); + this.modulepath = modulepath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } /** * @return Returns the files. diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java index 4f2b03cf8..2fc786593 100644 --- a/testing/src/test/java/org/aspectj/testing/RunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java @@ -135,23 +135,19 @@ public class RunSpec implements ITestStep { } public String getClasspath() { - if (cpath == null) - return null; - return this.cpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); + return cpath; } public String getModulepath() { - if (mpath == null) - return null; - return this.mpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); + return mpath; } public void setModulepath(String mpath) { - this.mpath = mpath; + this.mpath = mpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } public void setClasspath(String cpath) { - this.cpath = cpath; + this.cpath = cpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } public void addStdErrSpec(OutputSpec spec) {