From b3bd5cde10c54f8e138c4611e80a1b84f1a4170b Mon Sep 17 00:00:00 2001 From: Daniel Holle Date: Mon, 15 Apr 2024 16:44:34 +0200 Subject: [PATCH] Fix tests --- src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index 2ef89904..ce45dd53 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -78,7 +78,7 @@ public class JavaTXCompiler { } public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException { - this(Arrays.asList(sourceFile), null, new File("")); + this(Arrays.asList(sourceFile), List.of(), new File(".")); } public JavaTXCompiler(File sourceFile, Boolean log) throws IOException, ClassNotFoundException { @@ -87,7 +87,7 @@ public class JavaTXCompiler { } public JavaTXCompiler(List sourceFiles) throws IOException, ClassNotFoundException { - this(sourceFiles, null, new File("")); + this(sourceFiles, List.of(), new File(".")); } public JavaTXCompiler(List sources, List contextPath, File outputPath) throws IOException, ClassNotFoundException { @@ -113,6 +113,7 @@ public class JavaTXCompiler { } public ClassOrInterface getClass(JavaClassName name) { + if (loadedClasses.containsKey(name)) return loadedClasses.get(name).cif(); for (var sf : sourceFiles.values()) { for (var clazz : sf.KlassenVektor) { if (clazz.getClassName().equals(name)) return clazz; @@ -685,7 +686,7 @@ public class JavaTXCompiler { public ClassOrInterface loadJavaTXClass(JavaClassName name) { var file = findFileForClass(name); if (file != null) { - if (classRegistry.contains(name)) return getClass(name); + if (loadedClasses.containsKey(name)) return loadedClasses.get(name).cif(); try { var tree = JavaTXParser.parse(file); classRegistry.addName(name.toString(), 0); // TODO This gets overwritten later, is it bad if we don't know this right away?