diff --git a/java/src/processing/mode/java/pdex/PreprocessingService.java b/java/src/processing/mode/java/pdex/PreprocessingService.java
index 6ee14d30e..5d24b12da 100644
--- a/java/src/processing/mode/java/pdex/PreprocessingService.java
+++ b/java/src/processing/mode/java/pdex/PreprocessingService.java
@@ -49,7 +49,7 @@ import processing.mode.java.JavaEditor;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.TextTransform.OffsetMapper;
import processing.mode.java.pdex.util.ProblemFactory;
-import processing.mode.java.pdex.util.runtime.RuntimePathBuilder;
+import processing.mode.java.pdex.util.RuntimePathBuilder;
import processing.mode.java.preproc.PdePreprocessor;
import processing.mode.java.preproc.PreprocessorResult;
import processing.mode.java.preproc.code.ImportUtil;
diff --git a/java/src/processing/mode/java/pdex/util/runtime/RuntimeConst.java b/java/src/processing/mode/java/pdex/util/runtime/RuntimeConst.java
deleted file mode 100644
index 58e41d184..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/RuntimeConst.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-Part of the Processing project - http://processing.org
-
-Copyright (c) 2019 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-package processing.mode.java.pdex.util.runtime;
-
-
-/**
- * Constants related to runtime component enumeration.
- */
-public class RuntimeConst {
-
- /**
- * The modules comprising the Java standard modules.
- */
- public static final String[] STANDARD_MODULES = {
- "java.base.jmod",
- "java.compiler.jmod",
- "java.datatransfer.jmod",
- "java.desktop.jmod",
- "java.instrument.jmod",
- "java.logging.jmod",
- "java.management.jmod",
- "java.management.rmi.jmod",
- "java.naming.jmod",
- "java.net.http.jmod",
- "java.prefs.jmod",
- "java.rmi.jmod",
- "java.scripting.jmod",
- "java.se.jmod",
- "java.security.jgss.jmod",
- "java.security.sasl.jmod",
- "java.smartcardio.jmod",
- "java.sql.jmod",
- "java.sql.rowset.jmod",
- "java.transaction.xa.jmod",
- "java.xml.crypto.jmod",
- "java.xml.jmod",
- "jdk.accessibility.jmod",
- "jdk.aot.jmod",
- "jdk.attach.jmod",
- "jdk.charsets.jmod",
- "jdk.compiler.jmod",
- "jdk.crypto.cryptoki.jmod",
- "jdk.crypto.ec.jmod",
- "jdk.dynalink.jmod",
- "jdk.editpad.jmod",
- "jdk.hotspot.agent.jmod",
- "jdk.httpserver.jmod",
- "jdk.internal.ed.jmod",
- "jdk.internal.jvmstat.jmod",
- "jdk.internal.le.jmod",
- "jdk.internal.opt.jmod",
- "jdk.internal.vm.ci.jmod",
- "jdk.internal.vm.compiler.jmod",
- "jdk.internal.vm.compiler.management.jmod",
- "jdk.jartool.jmod",
- "jdk.javadoc.jmod",
- "jdk.jcmd.jmod",
- "jdk.jconsole.jmod",
- "jdk.jdeps.jmod",
- "jdk.jdi.jmod",
- "jdk.jdwp.agent.jmod",
- "jdk.jfr.jmod",
- "jdk.jlink.jmod",
- "jdk.jshell.jmod",
- "jdk.jsobject.jmod",
- "jdk.jstatd.jmod",
- "jdk.localedata.jmod",
- "jdk.management.agent.jmod",
- "jdk.management.jfr.jmod",
- "jdk.management.jmod",
- "jdk.naming.dns.jmod",
- "jdk.naming.rmi.jmod",
- "jdk.net.jmod",
- "jdk.pack.jmod",
- "jdk.rmic.jmod",
- "jdk.scripting.nashorn.jmod",
- "jdk.scripting.nashorn.shell.jmod",
- "jdk.sctp.jmod",
- "jdk.security.auth.jmod",
- "jdk.security.jgss.jmod",
- "jdk.unsupported.desktop.jmod",
- "jdk.unsupported.jmod",
- "jdk.xml.dom.jmod",
- "jdk.zipfs.jmod"
- };
-
- /**
- * The jars required for OpenJFX.
- */
- public static final String[] JAVA_FX_JARS = {
- "javafx-swt.jar",
- "javafx.base.jar",
- "javafx.controls.jar",
- "javafx.fxml.jar",
- "javafx.graphics.jar",
- "javafx.media.jar",
- "javafx.swing.jar",
- "javafx.web.jar"
- };
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/RuntimePathBuilder.java b/java/src/processing/mode/java/pdex/util/runtime/RuntimePathBuilder.java
deleted file mode 100644
index 9128de09c..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/RuntimePathBuilder.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime;
-
-import com.google.classpath.ClassPathFactory;
-import processing.app.Messages;
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.PreprocessedSketch;
-import processing.mode.java.pdex.util.runtime.strategy.*;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Stream;
-
-
-/**
- * Builder which generates runtime paths using a series of caches.
- *
- *
- * Builder which helps generate classpath (and module path) entries for sketches using stateful
- * and individually invalidate-able caches to prevent duplicate work.
- *
- */
-public class RuntimePathBuilder {
- private final List libraryDependentCaches;
- private final List libraryImportsDependentCaches;
- private final List codeFolderDependentCaches;
-
- private final List sketchClassPathStrategies;
- private final List searchClassPathStrategies;
-
- private final ClassPathFactory classPathFactory;
-
- /**
- * Create a new runtime path builder with empty caches.
- */
- public RuntimePathBuilder() {
- classPathFactory = new ClassPathFactory();
-
- // Declare caches to be built
- CachedRuntimePathFactory javaRuntimePathFactory;
- CachedRuntimePathFactory modeSketchPathFactory;
- CachedRuntimePathFactory modeSearchPathFactory;
- CachedRuntimePathFactory librarySketchPathFactory;
- CachedRuntimePathFactory librarySearchPathFactory;
- CachedRuntimePathFactory coreLibraryPathFactory;
- CachedRuntimePathFactory codeFolderPathFactory;
-
- // Create collections
- sketchClassPathStrategies = new ArrayList<>();
- searchClassPathStrategies = new ArrayList<>();
-
- libraryDependentCaches = new ArrayList<>();
- libraryImportsDependentCaches = new ArrayList<>();
- codeFolderDependentCaches = new ArrayList<>();
-
- // Create strategies
- List runtimeStrategies = new ArrayList<>();
- runtimeStrategies.add(new JavaRuntimePathFactory());
- runtimeStrategies.add(new JavaFxRuntimePathFactory());
- javaRuntimePathFactory = new CachedRuntimePathFactory(
- new RuntimePathFactoryStrategyCollection(runtimeStrategies)
- );
-
- modeSketchPathFactory = new CachedRuntimePathFactory(new ModeSketchRuntimePathFactory());
- modeSearchPathFactory = new CachedRuntimePathFactory(new ModeSearchRuntimePathFactory());
-
- librarySketchPathFactory = new CachedRuntimePathFactory(new LibrarySketchRuntimePathFactory());
- librarySearchPathFactory = new CachedRuntimePathFactory(new LibrarySearchRuntimePathFactory());
-
- coreLibraryPathFactory = new CachedRuntimePathFactory(new CoreLibraryRuntimePathFactory());
- codeFolderPathFactory = new CachedRuntimePathFactory(new CodeFolderRuntimePathFactory());
-
- // Assign strategies to collections for producing paths
- sketchClassPathStrategies.add(javaRuntimePathFactory);
- sketchClassPathStrategies.add(modeSketchPathFactory);
- sketchClassPathStrategies.add(librarySketchPathFactory);
- sketchClassPathStrategies.add(coreLibraryPathFactory);
- sketchClassPathStrategies.add(codeFolderPathFactory);
-
- searchClassPathStrategies.add(javaRuntimePathFactory);
- searchClassPathStrategies.add(modeSearchPathFactory);
- searchClassPathStrategies.add(librarySearchPathFactory);
- searchClassPathStrategies.add(coreLibraryPathFactory);
- searchClassPathStrategies.add(codeFolderPathFactory);
-
- // Assign strategies to collections for cache invalidation
- libraryDependentCaches.add(coreLibraryPathFactory);
-
- libraryImportsDependentCaches.add(librarySketchPathFactory);
- libraryImportsDependentCaches.add(librarySearchPathFactory);
-
- codeFolderDependentCaches.add(codeFolderPathFactory);
- }
-
- /**
- * Invalidate all of the runtime path caches associated with sketch libraries.
- */
- public void markLibrariesChanged() {
- invalidateAll(libraryDependentCaches);
- }
-
- /**
- * Invalidate all of the runtime path caches associated with sketch library imports.
- */
- public void markLibraryImportsChanged() {
- invalidateAll(libraryImportsDependentCaches);
- }
-
- /**
- * Invalidate all of the runtime path caches associated with the code folder having changed.
- */
- public void markCodeFolderChanged() {
- invalidateAll(codeFolderDependentCaches);
- }
-
- /**
- * Generate a classpath and inject it into a {PreprocessedSketch.Builder}.
- *
- * @param result The {PreprocessedSketch.Builder} into which the classpath should be inserted.
- * @param mode The {JavaMode} for which the classpath should be generated.
- */
- public void prepareClassPath(PreprocessedSketch.Builder result, JavaMode mode) {
- List programImports = result.programImports;
- Sketch sketch = result.sketch;
-
- prepareSketchClassPath(result, mode, programImports, sketch);
- prepareSearchClassPath(result, mode, programImports, sketch);
- }
-
- /**
- * Invalidate all of the caches in a provided collection.
- *
- * @param caches The caches to invalidate so that, when their value is requested again, the value
- * is generated again.
- */
- private void invalidateAll(List caches) {
- for (CachedRuntimePathFactory cache : caches) {
- cache.invalidateCache();
- }
- }
-
- /**
- * Prepare the classpath required for the sketch's execution.
- *
- * @param result The PreprocessedSketch builder into which the classpath and class loader should
- * be injected.
- * @param mode The JavaMode for which a sketch classpath should be generated.
- * @param programImports The imports listed by the sketch (user imports).
- * @param sketch The sketch for which the classpath is being generated.
- */
- private void prepareSketchClassPath(PreprocessedSketch.Builder result, JavaMode mode,
- List programImports, Sketch sketch) {
-
- Stream sketchClassPath = sketchClassPathStrategies.stream()
- .flatMap((x) -> x.buildClasspath(mode, programImports, sketch).stream());
-
- String[] classPathArray = sketchClassPath.toArray(String[]::new);
- URL[] urlArray = Arrays.stream(classPathArray)
- .map(path -> {
- try {
- return Paths.get(path).toUri().toURL();
- } catch (MalformedURLException e) {
- Messages.loge("malformed URL when preparing sketch classloader", e);
- return null;
- }
- })
- .filter(Objects::nonNull)
- .toArray(URL[]::new);
-
- result.classLoader = new URLClassLoader(urlArray, null);
- result.classPath = classPathFactory.createFromPaths(classPathArray);
- result.classPathArray = classPathArray;
- }
-
- /**
- * Prepare the classpath for searching in case of import suggestions.
- *
- * @param result The PreprocessedSketch builder into which the search classpath should be
- * injected.
- * @param mode The JavaMode for which a sketch classpath should be generated.
- * @param programImports The imports listed by the sketch (user imports).
- * @param sketch The sketch for which the classpath is being generated.
- */
- private void prepareSearchClassPath(PreprocessedSketch.Builder result, JavaMode mode,
- List programImports, Sketch sketch) {
-
- Stream searchClassPath = searchClassPathStrategies.stream()
- .flatMap((x) -> x.buildClasspath(mode, programImports, sketch).stream());
-
- result.searchClassPathArray = searchClassPath.toArray(String[]::new);
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/RuntimePathUtil.java b/java/src/processing/mode/java/pdex/util/runtime/RuntimePathUtil.java
deleted file mode 100644
index 8d6abebde..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/RuntimePathUtil.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-
-/**
- * Common convenience functions for runtime path formulation.
- */
-public class RuntimePathUtil {
-
- /**
- * Remove invalid entries in a classpath string.
- *
- * @param classPathString The classpath to clean.
- * @return The cleaned classpath entries without invalid entries.
- */
- public static List sanitizeClassPath(String classPathString) {
- // Make sure class path does not contain empty string (home dir)
- return Arrays.stream(classPathString.split(File.pathSeparator))
- .filter(p -> p != null && !p.trim().isEmpty())
- .distinct()
- .collect(Collectors.toList());
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/CachedRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/CachedRuntimePathFactory.java
deleted file mode 100644
index 5a42eb00d..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/CachedRuntimePathFactory.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2019 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-
-/**
- * Runtime path factory which caches the results of another runtime path factory.
- *
- *
- * Runtime path factory which decorates another {RuntimePathFactoryStrategy} that caches the
- * results of another runtime path factory. This is a lazy cached getter so the value will not be
- * resolved until it is requested.
- *
- */
-public class CachedRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- private AtomicReference> cachedResult;
- private RuntimePathFactoryStrategy innerStrategy;
-
- /**
- * Create a new cache around {RuntimePathFactoryStrategy}.
- *
- * @param newInnerStrategy The strategy to cache.
- */
- public CachedRuntimePathFactory(RuntimePathFactoryStrategy newInnerStrategy) {
- cachedResult = new AtomicReference<>(null);
- innerStrategy = newInnerStrategy;
- }
-
- /**
- * Invalidate the cached path so that, when requested next time, it will be rebuilt from scratch.
- */
- public void invalidateCache() {
- cachedResult.set(null);
- }
-
- /**
- * Return the cached classpath or, if not cached, build a classpath using the inner strategy.
- *
- *
- * Return the cached classpath or, if not cached, build a classpath using the inner strategy.
- * Note that this getter will not check to see if mode, imports, or sketch have changed. If a
- * cached value is available, it will be returned without examining the identity of the
- * parameters.
- *
- *
- * @param mode The {JavaMode} for which the classpath should be built.
- * @param imports The sketch (user) imports.
- * @param sketch The sketch for which a classpath is to be returned.
- * @return Newly generated classpath.
- */
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- return cachedResult.updateAndGet((cachedValue) ->
- cachedValue == null ? innerStrategy.buildClasspath(mode, imports, sketch) : cachedValue
- );
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/CodeFolderRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/CodeFolderRuntimePathFactory.java
deleted file mode 100644
index 6c2a31856..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/CodeFolderRuntimePathFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.app.Util;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
-
-import java.io.File;
-import java.util.List;
-
-
-/**
- * Path factory which includes resources like jars within the sketch code folder.
- */
-public class CodeFolderRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- StringBuilder classPath = new StringBuilder();
-
- // Code folder
- if (sketch.hasCodeFolder()) {
- File codeFolder = sketch.getCodeFolder();
- String codeFolderClassPath = Util.contentsToClassPath(codeFolder);
- classPath.append(codeFolderClassPath);
- }
-
- return RuntimePathUtil.sanitizeClassPath(classPath.toString());
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/CoreLibraryRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/CoreLibraryRuntimePathFactory.java
deleted file mode 100644
index cf2d9c1f0..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/CoreLibraryRuntimePathFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Library;
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
-
-import java.io.File;
-import java.util.List;
-
-
-/**
- * Runtime path factory for libraries part of the processing mode (like {JavaMode}).
- */
-public class CoreLibraryRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- StringBuilder classPath = new StringBuilder();
-
- for (Library lib : mode.coreLibraries) {
- classPath.append(File.pathSeparator).append(lib.getClassPath());
- }
-
- return RuntimePathUtil.sanitizeClassPath(classPath.toString());
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/JavaFxRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/JavaFxRuntimePathFactory.java
deleted file mode 100644
index 343394b19..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/JavaFxRuntimePathFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimeConst;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.StringJoiner;
-import java.util.stream.Collectors;
-
-
-/**
- * Runtime path factory which generates classpath entries for JavaFX / OpenFX.
- */
-public class JavaFxRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- return Arrays.stream(RuntimeConst.JAVA_FX_JARS)
- .map(this::buildEntry)
- .collect(Collectors.toList());
- }
-
- /**
- * Build a single classpath entry for OpenJFX.
- *
- * @param jarName The jar name like "javafx.base.jar" for which a fully qualified entry should be
- * created.
- * @return The fully qualified classpath entry like ".../Processing.app/Contents/PlugIns/
- * adoptopenjdk-11.0.1.jdk/Contents/Home/lib/javafx.base.jar"
- */
- private String buildEntry(String jarName) {
- StringJoiner joiner = new StringJoiner(File.separator);
- joiner.add(System.getProperty("java.home"));
- joiner.add("lib");
- joiner.add(jarName);
-
- return joiner.toString();
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/JavaRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/JavaRuntimePathFactory.java
deleted file mode 100644
index 535275800..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/JavaRuntimePathFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimeConst;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.StringJoiner;
-import java.util.stream.Collectors;
-
-
-/**
- * Runtime path factory which enumerates the modules as part of the java runtime.
- */
-public class JavaRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- return Arrays.stream(RuntimeConst.STANDARD_MODULES)
- .map(this::buildForModule)
- .collect(Collectors.toList());
- }
-
- /**
- * Build a classpath entry for a module.
- *
- * @param moduleName The name of the module like "java.base.jmod".
- * @return The fully qualified classpath entry like ".../Processing.app/Contents/PlugIns/
- * * adoptopenjdk-11.0.1.jdk/Contents/Home/jmods/java.base.jmod"
- */
- private String buildForModule(String moduleName) {
- StringJoiner jmodPathJoiner = new StringJoiner(File.separator);
- jmodPathJoiner.add(System.getProperty("java.home"));
- jmodPathJoiner.add("jmods");
- jmodPathJoiner.add(moduleName);
- return jmodPathJoiner.toString();
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/LibrarySearchRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/LibrarySearchRuntimePathFactory.java
deleted file mode 100644
index 6ce1a01d3..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/LibrarySearchRuntimePathFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Library;
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
-
-import java.io.File;
-import java.util.List;
-import java.util.StringJoiner;
-
-
-/**
- * Runtime path factory to generate search classpath entries for third party libraries.
- *
- *
- * Runtime path factory to generate classpath entries for third party libraries that are used when
- * generating import recommendations.
- *
- */
-public class LibrarySearchRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- StringJoiner classPathBuilder = new StringJoiner(File.pathSeparator);
-
- for (Library lib : mode.contribLibraries) {
- classPathBuilder.add(lib.getClassPath());
- }
-
- return RuntimePathUtil.sanitizeClassPath(classPathBuilder.toString());
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/LibrarySketchRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/LibrarySketchRuntimePathFactory.java
deleted file mode 100644
index 240dc5966..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/LibrarySketchRuntimePathFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Library;
-import processing.app.Sketch;
-import processing.app.SketchException;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
-
-import java.io.File;
-import java.util.List;
-import java.util.StringJoiner;
-
-
-/**
- * Runtime path factory to generate sketch classpath entries for third party libraries.
- *
- *
- * Runtime path factory to generate classpath entries for third party libraries that are required
- * for running the sketch.
- *
- */
-public class LibrarySketchRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- StringJoiner classPathBuilder = new StringJoiner(File.pathSeparator);
-
- imports.stream()
- .map(ImportStatement::getPackageName)
- .filter(pckg -> !isIgnorable(pckg))
- .map(pckg -> {
- try {
- return mode.getLibrary(pckg);
- } catch (SketchException e) {
- return null;
- }
- })
- .filter(lib -> lib != null)
- .map(Library::getClassPath)
- .forEach(cp -> classPathBuilder.add(cp));
-
- return RuntimePathUtil.sanitizeClassPath(classPathBuilder.toString());
- }
-
- /**
- * Determine if a package is ignorable.
- *
- * @param packageName The name of the package to evaluate.
- * @return True if the package is part of standard Java (like java.lang.*). False otherwise.
- */
- private boolean isIgnorable(String packageName) {
- return (packageName.startsWith("java.") || packageName.startsWith("javax."));
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/ModeSearchRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/ModeSearchRuntimePathFactory.java
deleted file mode 100644
index e368c09ab..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/ModeSearchRuntimePathFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * Runtime path factory to generate search classpath entries for the processing mode.
- *
- *
- * Runtime path factory to generate classpath entries for the processing mode (like {JavaMode}) used
- * when generating import recommendations.
- *
- */
-public class ModeSearchRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- String searchClassPath = mode.getSearchPath();
-
- if (searchClassPath != null) {
- return RuntimePathUtil.sanitizeClassPath(searchClassPath);
- } else {
- return new ArrayList<>();
- }
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/ModeSketchRuntimePathFactory.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/ModeSketchRuntimePathFactory.java
deleted file mode 100644
index 0751139f4..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/ModeSketchRuntimePathFactory.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2012-19 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Library;
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * Runtime path factory for classpath entries required by the processing mode like {JavaMode}.
- */
-public class ModeSketchRuntimePathFactory implements RuntimePathFactoryStrategy {
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- Library coreLibrary = mode.getCoreLibrary();
- String coreClassPath = coreLibrary != null ?
- coreLibrary.getClassPath() : mode.getSearchPath();
- if (coreClassPath != null) {
- return RuntimePathUtil.sanitizeClassPath(coreClassPath);
- } else {
- return new ArrayList<>();
- }
- }
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategy.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategy.java
deleted file mode 100644
index bb053c79d..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2019 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-
-import java.util.List;
-
-
-/**
- * Strategy which generates part of the classpath and/or module path.
- *
- *
- * Strategy for factories each of which generate part of the classpath and/or module path required
- * by a sketch through user supplied requirements, mode (as in JavaMode) requirements, or transitive
- * requirements imposed by third party libraries.
- *
- */
-public interface RuntimePathFactoryStrategy {
-
- /**
- * Create classpath and/or module path entries.
- *
- * @param mode The mode engaged by the user like JavaMode.
- * @param programImports The program imports imposed by the user within their sketch.
- * @param sketch The sketch provided by the user.
- * @return List of classpath and/or module path entries.
- */
- List buildClasspath(JavaMode mode, List programImports, Sketch sketch);
-
-}
diff --git a/java/src/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategyCollection.java b/java/src/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategyCollection.java
deleted file mode 100644
index 28cd4870d..000000000
--- a/java/src/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategyCollection.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 20119 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-
-/**
- * Strategy which concatenates paths generated from a collection of RuntimePathFactoryStrategies.
- */
-public class RuntimePathFactoryStrategyCollection implements RuntimePathFactoryStrategy {
-
- private final List strategies;
-
- /**
- * Create a new path concatenation operation.
- *
- * @param newStrategies
- */
- public RuntimePathFactoryStrategyCollection(List newStrategies) {
- strategies = newStrategies;
- }
-
- @Override
- public List buildClasspath(JavaMode mode, List imports, Sketch sketch) {
- return strategies.stream()
- .flatMap((strategy) -> strategy.buildClasspath(mode, imports, sketch).stream())
- .collect(Collectors.toList());
- }
-
-}
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/CachedRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/CachedRuntimePathFactoryTest.java
similarity index 76%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/CachedRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/CachedRuntimePathFactoryTest.java
index 15eb763d6..7508c539d 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/CachedRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/CachedRuntimePathFactoryTest.java
@@ -18,14 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimePathUtilTest;
import java.io.IOException;
import java.util.ArrayList;
@@ -36,29 +35,30 @@ import static org.junit.Assert.*;
public class CachedRuntimePathFactoryTest {
- private CachedRuntimePathFactory cachedRuntimePathFactory;
+ private RuntimePathBuilder.CachedRuntimePathFactory cachedRuntimePathFactory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@Before
public void setUp() throws Exception {
- cachedRuntimePathFactory = new CachedRuntimePathFactory(new RuntimePathFactoryStrategy() {
+ cachedRuntimePathFactory = new RuntimePathBuilder.CachedRuntimePathFactory(
+ new RuntimePathBuilder.RuntimePathFactoryStrategy() {
+ private int calls = 0;
- private int calls = 0;
+ @Override
+ public List buildClasspath(JavaMode mode, List imports,
+ Sketch sketch) {
- @Override
- public List buildClasspath(JavaMode mode, List imports,
- Sketch sketch) {
+ String retVal = String.format("Test%d", calls);
+ calls++;
- String retVal = String.format("Test%d", calls);
- calls++;
-
- List retList = new ArrayList<>();
- retList.add(retVal);
- return retList;
- }
- });
+ List retList = new ArrayList<>();
+ retList.add(retVal);
+ return retList;
+ }
+ }
+ );
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
@@ -97,4 +97,4 @@ public class CachedRuntimePathFactoryTest {
assertEquals("Test1", classpath.get(0));
}
-}
\ No newline at end of file
+}
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/CodeFolderRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/CodeFolderRuntimePathFactoryTest.java
similarity index 87%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/CodeFolderRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/CodeFolderRuntimePathFactoryTest.java
index afe2cddb6..679357553 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/CodeFolderRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/CodeFolderRuntimePathFactoryTest.java
@@ -18,23 +18,23 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
+import processing.mode.java.pdex.util.RuntimePathFactoryTestUtil;
import java.io.File;
-import java.io.IOException;
import java.util.List;
import static org.junit.Assert.*;
public class CodeFolderRuntimePathFactoryTest {
- private CodeFolderRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -43,7 +43,8 @@ public class CodeFolderRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new CodeFolderRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildCodeFolderPath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/CoreLibraryRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/CoreLibraryRuntimePathFactoryTest.java
similarity index 86%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/CoreLibraryRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/CoreLibraryRuntimePathFactoryTest.java
index e038c18eb..bddb4a5af 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/CoreLibraryRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/CoreLibraryRuntimePathFactoryTest.java
@@ -18,22 +18,22 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
+import processing.mode.java.pdex.util.RuntimePathFactoryTestUtil;
-import java.io.IOException;
import java.util.List;
import static org.junit.Assert.*;
public class CoreLibraryRuntimePathFactoryTest {
- private CoreLibraryRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -41,7 +41,8 @@ public class CoreLibraryRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new CoreLibraryRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildCoreLibraryPath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/JavaFxRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/JavaFxRuntimePathFactoryTest.java
similarity index 86%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/JavaFxRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/JavaFxRuntimePathFactoryTest.java
index 3b478e218..1afe124da 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/JavaFxRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/JavaFxRuntimePathFactoryTest.java
@@ -18,14 +18,13 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimeConst;
import java.util.List;
@@ -34,7 +33,7 @@ import static org.junit.Assert.*;
public class JavaFxRuntimePathFactoryTest {
- private JavaFxRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -42,7 +41,8 @@ public class JavaFxRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new JavaFxRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildJavaFxRuntimePath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
@@ -52,7 +52,7 @@ public class JavaFxRuntimePathFactoryTest {
@Test
public void testBuildClasspathSize() {
- assertEquals(RuntimeConst.JAVA_FX_JARS.length, classpath.size());
+ assertEquals(RuntimePathBuilder.JAVA_FX_JARS.length, classpath.size());
}
@Test
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/JavaRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/JavaRuntimePathFactoryTest.java
similarity index 85%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/JavaRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/JavaRuntimePathFactoryTest.java
index 695209cfb..2357fcb61 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/JavaRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/JavaRuntimePathFactoryTest.java
@@ -18,16 +18,14 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.util.runtime.RuntimeConst;
-import java.io.IOException;
import java.util.List;
import static org.junit.Assert.*;
@@ -35,7 +33,7 @@ import static org.junit.Assert.*;
public class JavaRuntimePathFactoryTest {
- private JavaRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -44,7 +42,8 @@ public class JavaRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new JavaRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildJavaRuntimePath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
@@ -54,7 +53,7 @@ public class JavaRuntimePathFactoryTest {
@Test
public void testBuildClasspathSize() {
- assertEquals(RuntimeConst.STANDARD_MODULES.length, classpath.size());
+ assertEquals(RuntimePathBuilder.STANDARD_MODULES.length, classpath.size());
}
@Test
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/LibrarySearchRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/LibrarySearchRuntimePathFactoryTest.java
similarity index 89%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/LibrarySearchRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/LibrarySearchRuntimePathFactoryTest.java
index e36b3a317..6d87c7a84 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/LibrarySearchRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/LibrarySearchRuntimePathFactoryTest.java
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
@@ -26,14 +26,13 @@ import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
-import java.io.IOException;
import java.util.List;
import static org.junit.Assert.*;
public class LibrarySearchRuntimePathFactoryTest {
- private LibrarySearchRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -42,7 +41,8 @@ public class LibrarySearchRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new LibrarySearchRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildLibrarySearchPath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/LibrarySketchRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/LibrarySketchRuntimePathFactoryTest.java
similarity index 89%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/LibrarySketchRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/LibrarySketchRuntimePathFactoryTest.java
index 9f756fa44..a40f57649 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/LibrarySketchRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/LibrarySketchRuntimePathFactoryTest.java
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
@@ -26,7 +26,6 @@ import processing.app.Sketch;
import processing.mode.java.JavaMode;
import processing.mode.java.pdex.ImportStatement;
-import java.io.IOException;
import java.util.List;
import static org.junit.Assert.*;
@@ -34,7 +33,7 @@ import static org.junit.Assert.*;
public class LibrarySketchRuntimePathFactoryTest {
- private LibrarySketchRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -42,7 +41,8 @@ public class LibrarySketchRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new LibrarySketchRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildLibrarySketchPath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/ModeSearchRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/ModeSearchRuntimePathFactoryTest.java
similarity index 89%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/ModeSearchRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/ModeSearchRuntimePathFactoryTest.java
index ff3ad21df..46bdb54fc 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/ModeSearchRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/ModeSearchRuntimePathFactoryTest.java
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
@@ -30,9 +30,10 @@ import java.util.List;
import static org.junit.Assert.*;
+
public class ModeSearchRuntimePathFactoryTest {
- private ModeSearchRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -40,7 +41,8 @@ public class ModeSearchRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new ModeSearchRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildModeSearchPath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/ModeSketchRuntimePathFactoryTest.java b/java/test/processing/mode/java/pdex/util/ModeSketchRuntimePathFactoryTest.java
similarity index 89%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/ModeSketchRuntimePathFactoryTest.java
rename to java/test/processing/mode/java/pdex/util/ModeSketchRuntimePathFactoryTest.java
index e119bd565..a24f63f48 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/ModeSketchRuntimePathFactoryTest.java
+++ b/java/test/processing/mode/java/pdex/util/ModeSketchRuntimePathFactoryTest.java
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.junit.Before;
import org.junit.Test;
@@ -30,9 +30,10 @@ import java.util.List;
import static org.junit.Assert.*;
+
public class ModeSketchRuntimePathFactoryTest {
- private ModeSketchRuntimePathFactory factory;
+ private RuntimePathBuilder.RuntimePathFactoryStrategy factory;
private JavaMode testMode;
private List testImports;
private Sketch testSketch;
@@ -40,7 +41,8 @@ public class ModeSketchRuntimePathFactoryTest {
@Before
public void setUp() throws Exception {
- factory = new ModeSketchRuntimePathFactory();
+ RuntimePathBuilder builder = new RuntimePathBuilder();
+ factory = builder::buildModeSketchPath;
testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
testImports = RuntimePathFactoryTestUtil.createTestImports();
testSketch = RuntimePathFactoryTestUtil.createTestSketch();
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryTestUtil.java b/java/test/processing/mode/java/pdex/util/RuntimePathFactoryTestUtil.java
similarity index 98%
rename from java/test/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryTestUtil.java
rename to java/test/processing/mode/java/pdex/util/RuntimePathFactoryTestUtil.java
index cf0ab57fd..f2ad94d66 100644
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryTestUtil.java
+++ b/java/test/processing/mode/java/pdex/util/RuntimePathFactoryTestUtil.java
@@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package processing.mode.java.pdex.util.runtime.strategy;
+package processing.mode.java.pdex.util;
import org.mockito.Mockito;
import processing.app.Library;
diff --git a/java/test/processing/mode/java/pdex/util/runtime/RuntimePathBuilderTest.java b/java/test/processing/mode/java/pdex/util/runtime/RuntimePathBuilderTest.java
deleted file mode 100644
index f29756e2c..000000000
--- a/java/test/processing/mode/java/pdex/util/runtime/RuntimePathBuilderTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2019 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime;
-
-import org.junit.Before;
-import org.junit.Test;
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-import processing.mode.java.pdex.PreprocessedSketch;
-import processing.mode.java.pdex.util.runtime.strategy.RuntimePathFactoryTestUtil;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-
-public class RuntimePathBuilderTest {
-
- private RuntimePathBuilder builder;
- private JavaMode testMode;
- private List testImports;
- private Sketch testSketch;
- private PreprocessedSketch.Builder result;
-
- @Before
- public void setUp() throws Exception {
- builder = new RuntimePathBuilder();
- testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
- testImports = RuntimePathFactoryTestUtil.createTestImports();
- testSketch = RuntimePathFactoryTestUtil.createTestSketch();
-
- result = new PreprocessedSketch.Builder();
- result.programImports.addAll(testImports);
- result.sketch = testSketch;
-
- builder.prepareClassPath(result, testMode);
- }
-
- @Test
- public void testClassPathLoader() {
- assertNotNull(result.classLoader);
- }
-
- @Test
- public void testClassPathObj() {
- assertNotNull(result.classPath);
- }
-
- @Test
- public void testSketchClassPathStrategiesJava() {
- checkPresent(result.classPathArray, "java.base.jmod");
- }
-
- @Test
- public void testSketchClassPathStrategiesLibrary() {
- checkPresent(result.classPathArray, "library3");
- }
-
- @Test
- public void testSketchClassPathStrategiesCore() {
- checkPresent(result.classPathArray, "library3");
- }
-
- @Test
- public void testSketchClassPathStrategiesMode() {
- checkPresent(result.classPathArray, "library6");
- }
-
- @Test
- public void testSketchClassPathStrategiesCodeFolder() {
- checkPresent(result.classPathArray, "file1.jar");
- }
-
- @Test
- public void testSearchClassPathStrategiesCodeJava() {
- checkPresent(result.searchClassPathArray, "java.base.jmod");
- }
-
- @Test
- public void testSearchClassPathStrategiesCodeMode() {
- checkPresent(result.classPathArray, "library6");
- }
-
- @Test
- public void testSearchClassPathStrategiesCodeLibrary() {
- checkPresent(result.classPathArray, "library3");
- }
-
- @Test
- public void testSearchClassPathStrategiesCodeCore() {
- checkPresent(result.classPathArray, "library1");
- }
-
- @Test
- public void testSearchClassPathStrategiesCodeCodeFolder() {
- checkPresent(result.classPathArray, "file3.zip");
- }
-
- private void checkPresent(String[] classPathArray, String target) {
- long count = Arrays.stream(classPathArray)
- .filter((x) -> x.contains(target))
- .count();
-
- assertTrue(count > 0);
- }
-
-}
\ No newline at end of file
diff --git a/java/test/processing/mode/java/pdex/util/runtime/RuntimePathUtilTest.java b/java/test/processing/mode/java/pdex/util/runtime/RuntimePathUtilTest.java
deleted file mode 100644
index 6b9cd4c87..000000000
--- a/java/test/processing/mode/java/pdex/util/runtime/RuntimePathUtilTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2019 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime;
-
-import org.junit.Test;
-
-import java.io.File;
-import java.util.List;
-import java.util.StringJoiner;
-
-import static org.junit.Assert.*;
-
-
-public class RuntimePathUtilTest {
-
- @Test
- public void sanitizeClassPath() {
- StringJoiner testStrJoiner = new StringJoiner(File.pathSeparator);
- testStrJoiner.add("test1");
- testStrJoiner.add("");
- testStrJoiner.add("test2");
-
- List classPath = RuntimePathUtil.sanitizeClassPath(testStrJoiner.toString());
- assertEquals(2, classPath.size());
- assertEquals("test1", classPath.get(0));
- assertEquals("test2", classPath.get(1));
- }
-
- @Test
- public void sanitizeClassPathNoDuplicate() {
- StringJoiner testStrJoiner = new StringJoiner(File.pathSeparator);
- testStrJoiner.add("test1");
- testStrJoiner.add("");
- testStrJoiner.add("test2");
- testStrJoiner.add("test2");
-
- List classPath = RuntimePathUtil.sanitizeClassPath(testStrJoiner.toString());
- assertEquals(2, classPath.size());
- assertEquals("test1", classPath.get(0));
- assertEquals("test2", classPath.get(1));
- }
-
-}
\ No newline at end of file
diff --git a/java/test/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategyCollectionTest.java b/java/test/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategyCollectionTest.java
deleted file mode 100644
index 30fc309cc..000000000
--- a/java/test/processing/mode/java/pdex/util/runtime/strategy/RuntimePathFactoryStrategyCollectionTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
-
-/*
-Part of the Processing project - http://processing.org
-Copyright (c) 2019 The Processing Foundation
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2
-as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-package processing.mode.java.pdex.util.runtime.strategy;
-
-import org.junit.Before;
-import org.junit.Test;
-import processing.app.Sketch;
-import processing.mode.java.JavaMode;
-import processing.mode.java.pdex.ImportStatement;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-
-public class RuntimePathFactoryStrategyCollectionTest {
-
- private RuntimePathFactoryStrategyCollection factory;
- private JavaMode testMode;
- private List testImports;
- private Sketch testSketch;
- private List classpath;
-
- @Before
- public void setUp() throws Exception {
- List innerFactories = new ArrayList<>();
- innerFactories.add(createInnerFactory("test1"));
- innerFactories.add(createInnerFactory("test2"));
- factory = new RuntimePathFactoryStrategyCollection(innerFactories);
-
- testMode = RuntimePathFactoryTestUtil.createTestJavaMode();
- testImports = RuntimePathFactoryTestUtil.createTestImports();
- testSketch = RuntimePathFactoryTestUtil.createTestSketch();
-
- classpath = factory.buildClasspath(testMode, testImports, testSketch);
- }
-
- private RuntimePathFactoryStrategy createInnerFactory(String retStr) {
- return (mode, imports, sketch) -> {
- List retList = new ArrayList<>();
- retList.add(retStr);
- return retList;
- };
- }
-
- @Test
- public void testBuildClasspathLength() {
- assertEquals(2, classpath.size());
- }
-
- @Test
- public void testBuildClasspathContent() {
- assertEquals("test1", classpath.get(0));
- assertEquals("test2", classpath.get(1));
- }
-
-}
\ No newline at end of file