diff --git a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java index ce312d01d..67e553e65 100644 --- a/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java +++ b/src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java @@ -909,7 +909,7 @@ public class JavaTXCompiler { // "/testBytecode/generatedBC/" +name+".class")); File outputFile = new File(path, name.getClassName() + ".class"); outputFile.getAbsoluteFile().getParentFile().mkdirs(); - output = new FileOutputStream(outputFile, false); + output = new FileOutputStream(outputFile); output.write(bytecode); output.close(); System.out.println(name + ".class file generated"); diff --git a/src/test/java/targetast/TestCodegen.java b/src/test/java/targetast/TestCodegen.java index c1c2a5ee7..acfa46d9f 100644 --- a/src/test/java/targetast/TestCodegen.java +++ b/src/test/java/targetast/TestCodegen.java @@ -31,7 +31,7 @@ public class TestCodegen { private static void writeClassFile(String name, byte[] code) throws IOException { var path = Path.of(System.getProperty("user.dir"), "src/test/resources/target/"); Files.createDirectories(path); - Files.write(path.resolve(name + ".class"), code, StandardOpenOption.CREATE); + Files.write(path.resolve(name + ".class"), code, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); } public static Class generateClass(TargetClass clazz, IByteArrayClassLoader classLoader) throws IOException {