Add warning for Javap disassembler and Java 16+

This commit is contained in:
Nico Mexis 2021-09-16 13:57:06 +02:00
parent 756b3b3336
commit c8af835fb5
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78

View file

@ -12,6 +12,7 @@ import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.gui.components.JFrameConsolePrintStream;
import the.bytecode.club.bytecodeviewer.resources.ExternalResources;
import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import static the.bytecode.club.bytecodeviewer.Constants.fs;
@ -75,7 +76,6 @@ public class JavapDisassembler extends InternalDecompiler
//setup reflection
Class<?> javap = child.loadClass("com.sun.tools.javap.Main");
Method main = javap.getMethod("main", String[].class);
Object cl = javap.newInstance();
//pipe sys out
sysOutBuffer = new JFrameConsolePrintStream("", false);
@ -84,13 +84,17 @@ public class JavapDisassembler extends InternalDecompiler
BytecodeViewer.sm.silenceExec(true);
//invoke Javap
main.invoke(cl, (Object) new String[]{
main.invoke(null, (Object) new String[]{
"-p", //Shows all classes and members
"-c", //Prints out disassembled code
//"-l", //Prints out line and local variable tables
"-constants", //Shows static final constants
tempClass.getAbsolutePath()});
}
catch (IllegalAccessException e)
{
return TranslatedStrings.ILLEGAL_ACCESS_ERROR.toString();
}
catch (Exception e)
{
e.printStackTrace();