From 49803385cf1da21ac83c9dcd75117a458e3ce1e0 Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Fri, 12 Apr 2024 13:58:11 +0200 Subject: [PATCH] Fix optional parameters --- .../java/de/dhbwstuttgart/core/ConsoleInterface.java | 2 +- src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java b/src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java index af803571..84874f75 100644 --- a/src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java +++ b/src/main/java/de/dhbwstuttgart/core/ConsoleInterface.java @@ -37,7 +37,7 @@ public class ConsoleInterface { input.add(new File(arg)); } } - JavaTXCompiler compiler = new JavaTXCompiler(input, classpath, new File(outputPath)); + JavaTXCompiler compiler = new JavaTXCompiler(input, classpath, outputPath != null ? new File(outputPath) : null); //compiler.typeInference(); compiler.generateBytecode(); } diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 1fa11f29..d39dd50a 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -49,12 +49,7 @@ import de.dhbwstuttgart.typeinference.unify.UnifyResultListenerImpl; import de.dhbwstuttgart.typeinference.unify.UnifyResultModel; import de.dhbwstuttgart.typeinference.unify.UnifyTaskModel; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; +import java.io.*; import java.lang.reflect.Modifier; import java.nio.file.Path; import java.util.*; @@ -101,7 +96,7 @@ public class JavaTXCompiler { // When no contextPaths are given, the working directory is the sources root path.add(new File(System.getProperty("user.dir"))); } - path.add(outputPath); + if (outputPath != null) path.add(outputPath); classLoader = new DirectoryClassLoader(path, ClassLoader.getSystemClassLoader()); environment = new CompilationEnvironment(sources); classPath = contextPath;