diff options
author | Andy Clement <aclement@pivotal.io> | 2017-10-20 12:48:41 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2017-10-20 12:48:41 -0700 |
commit | a24d15f5e7538985ca9718d9e78635bb53372736 (patch) | |
tree | ae5fec85a2442cc94a59127fc4c964723c69c6d0 /ajde.core/src | |
parent | e9c279bc3e974f57053b718c895ad69194cd1dc0 (diff) | |
download | aspectj-a24d15f5e7538985ca9718d9e78635bb53372736.tar.gz aspectj-a24d15f5e7538985ca9718d9e78635bb53372736.zip |
Adjust how classpath entries manipulated for Java9 support
Prior to this AspectJ would discard ignore the ClasspathEntry
objects built by JDT and just work with the classpath as a string,
driving the JDT FileSystem to rebuild classpath entries again at
a later date using the string. This is more complex in Java9 because
the string representation was losing whether some entries came in
via modulepath. ClasspathEntry construction for modulepath entries
is non trivial (since the module-info must be processed).
The new version will cache some of the ClasspathEntry objects (those
built for modulepaths) and do more work on the AspectJ side building
classpath entries in general. It now passes these entries to a
different FileSystem entry point rather than the entry point that
takes a string path.
Diffstat (limited to 'ajde.core/src')
-rw-r--r-- | ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java b/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java index 4ab05c968..5577a01af 100644 --- a/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java +++ b/ajde.core/src/org/aspectj/ajde/core/internal/AjdeCoreBuildManager.java @@ -37,6 +37,7 @@ import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.SourceLocation; import org.aspectj.bridge.context.CompilationAndWeavingContext; +import org.aspectj.org.eclipse.jdt.internal.compiler.batch.FileSystem.Classpath; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.aspectj.util.LangUtil; @@ -277,6 +278,14 @@ public class AjdeCoreBuildManager { both.addAll(configClasspath); both.addAll(toAdd); config.setClasspath(both); + Classpath[] checkedClasspaths = config.getCheckedClasspaths(); + ArrayList<Classpath> cps = parser.handleClasspath(toAdd, compilerConfig.getProjectEncoding()); + Classpath[] newCheckedClasspaths = new Classpath[checkedClasspaths.length+cps.size()]; + System.arraycopy(checkedClasspaths, 0, newCheckedClasspaths, 0, checkedClasspaths.length); + for (int i=0;i<cps.size();i++) { + newCheckedClasspaths[checkedClasspaths.length+i] = cps.get(i); + } + config.setCheckedClasspaths(newCheckedClasspaths); } } @@ -295,18 +304,18 @@ public class AjdeCoreBuildManager { } // Process the INPATH - mergeInto(config.getInpath(), compilerConfig.getInpath()); + config.addToInpath(compilerConfig.getInpath()); // bug 168840 - calling 'setInPath(..)' creates BinarySourceFiles which // are used to see if there have been changes in classes on the inpath if (config.getInpath() != null) { - config.setInPath(config.getInpath()); + config.processInPath(); } // Process the SOURCE PATH RESOURCES config.setSourcePathResources(compilerConfig.getSourcePathResources()); // Process the ASPECTPATH - mergeInto(config.getAspectpath(), compilerConfig.getAspectPath()); + config.addToAspectpath(compilerConfig.getAspectPath()); // Process the JAVA OPTIONS MAP Map<String,String> jom = compilerConfig.getJavaOptionsMap(); @@ -347,17 +356,6 @@ public class AjdeCoreBuildManager { return config; } - private <T> void mergeInto(Collection<T> target, Collection<T> source) { - if ((null == target) || (null == source)) { - return; - } - for (T next : source) { - if (!target.contains(next)) { - target.add(next); - } - } - } - /** * Helper method for configure build options. This reads all command-line options specified in the non-standard options text * entry and sets any corresponding unset values in config. |