forked from JavaTX/JavaCompilerCore
Don't append new class files, overwrite them
This commit is contained in:
parent
a7720fbf20
commit
baec9999db
@ -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");
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user