From 4ccfb6021f8522a3eed0d256face0352c70b9a49 Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Fri, 25 Feb 2022 15:52:53 +0100 Subject: [PATCH] General code quality changes --- src/main/java/me/konloch/kontainer/io/DiskReader.java | 2 +- .../club/bytecodeviewer/gui/components/RunOptions.java | 2 +- .../plugin/strategies/JavaPluginLaunchStrategy.java | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/konloch/kontainer/io/DiskReader.java b/src/main/java/me/konloch/kontainer/io/DiskReader.java index 03df2662..7d676f1f 100644 --- a/src/main/java/me/konloch/kontainer/io/DiskReader.java +++ b/src/main/java/me/konloch/kontainer/io/DiskReader.java @@ -64,7 +64,7 @@ public class DiskReader { try (FileReader fr = new FileReader(fileName); BufferedReader reader = new BufferedReader(fr)) { for (String add = reader.readLine(); add != null; add = reader.readLine()) { - s.append(EncodeUtils.unicodeToString(add)).append(System.getProperty("line.separator")); + s.append(EncodeUtils.unicodeToString(add)).append(System.lineSeparator()); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java index 0579d01d..6e2266a8 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/RunOptions.java @@ -79,7 +79,7 @@ public class RunOptions extends JFrame getContentPane().add(mainMethodFQN); mainMethodFQN.setColumns(10); - JLabel lblNewLabel = new JLabel("Debug Classes (Seperate with , ):"); + JLabel lblNewLabel = new JLabel("Debug Classes (Separated with , ):"); lblNewLabel.setBounds(10, 89, 228, 14); getContentPane().add(lblNewLabel); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java index a3db6b8a..b2da658c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavaPluginLaunchStrategy.java @@ -1,7 +1,6 @@ package the.bytecode.club.bytecodeviewer.plugin.strategies; import java.io.File; -import me.konloch.kontainer.io.DiskReader; import org.codehaus.janino.SimpleCompiler; import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; @@ -35,13 +34,10 @@ public class JavaPluginLaunchStrategy implements PluginLaunchStrategy @Override public Plugin run(File file) throws Throwable { - SimpleCompiler compiler = new SimpleCompiler(); - - //compile the Java source - compiler.cook(DiskReader.loadAsString(file.getAbsolutePath())); + SimpleCompiler compiler = new SimpleCompiler(file.getCanonicalPath()); //debug - System.out.println(file.getName().substring(0, file.getName().length() - (".java".length()))); + //System.out.println(file.getName().substring(0, file.getName().length() - (".java".length()))); //get the class object from the compiler classloader Class clazz = Class.forName(