Skip to content

Commit 2175437

Browse files
committed
Beta 1.3.1 (Lightweight and Speed updates)
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon. 10/29/2014 - Added a new decompiler option to append brackets to labels. 10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled. This update removes JSyntaxPane and replaces it with RSyntaxAreaPane, this change improves speed greatly for bigger class files, there is literally zero delay for syntax highlighting now.
1 parent 7baee5d commit 2175437

9 files changed

Lines changed: 64 additions & 54 deletions

File tree

BytecodeViewer Beta 1.3.1.jar

38.6 MB
Binary file not shown.

README.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,8 @@ Changelog:
107107
10/29/2014 - When saving as jars or zips, it'll automatically append the file extension if it's not added.
108108
10/29/2014 - All the built in plugins no longer set the cursor to busy.
109109
10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
110-
10/29/2014 - Sped up start up time
110+
10/29/2014 - Sped up start up time
111+
--- Beta 1.3.1 ---:
112+
10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
113+
10/29/2014 - Added a new decompiler option to append brackets to labels.
114+
10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Beta 1.3
1+
Beta 1.3.1

src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@
137137
* 10/29/2014 - All the built in plugins no longer set the cursor to busy.
138138
* 10/29/2014 - Tried to fix the issue with JSyntaxPane by making it create the object in a background thread, it still freezes the UI. Changes kept for later implementation of another syntax highlighter.
139139
* 10/29/2014 - Sped up start up time.
140+
* ----Beta 1.3.1-----:
141+
* 10/29/2014 - Replaced JSyntaxPane with RSyntaxArea, this sadly removes the search feature inside of source/bytecode files, I'll implement a search function soon.
142+
* 10/29/2014 - Added a new decompiler option to append brackets to labels.
143+
* 10/31/2014 - Fixed an issue with the decompiler still running when the source code pane isn't toggled.
140144
*
141145
* @author Konloch
142146
*
@@ -155,7 +159,7 @@ public class BytecodeViewer {
155159
public static String tempDirectory = "bcv_temp";
156160
public static String fs = System.getProperty("file.separator");
157161
public static String nl = System.getProperty("line.separator");
158-
public static String version = "Beta 1.3";
162+
public static String version = "Beta 1.3.1";
159163

160164
public static void main(String[] args) {
161165
cleanup();
@@ -176,7 +180,7 @@ public void run() {
176180
String version = reader.readLine();
177181
reader.close();
178182
if(!BytecodeViewer.version.equals(version))
179-
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version);
183+
showMessage("You're running an outdated version of Bytecode Viewer, current version: " + BytecodeViewer.version + ", latest version: " + version+nl+nl+"https://github.com/Konloch/bytecode-viewer");
180184
} catch(Exception e) {
181185
e.printStackTrace();
182186
}

src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/InstructionPrinter.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public InstructionPrinter(MethodNode m, InstructionPattern pattern, TypeAndName[
8383
public ArrayList<String> createPrint() {
8484
ArrayList<String> info = new ArrayList<String>();
8585
ListIterator<?> it = mNode.instructions.iterator();
86+
boolean firstLabel = false;
8687
while (it.hasNext()) {
8788
AbstractInsnNode ain = (AbstractInsnNode) it.next();
8889
String line = "";
@@ -103,7 +104,16 @@ public ArrayList<String> createPrint() {
103104
} else if (ain instanceof LineNumberNode) {
104105
line = printLineNumberNode((LineNumberNode) ain, it);
105106
} else if (ain instanceof LabelNode) {
107+
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
108+
info.add("}");
109+
106110
line = printLabelnode((LabelNode) ain);
111+
112+
if(BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()) {
113+
if(!firstLabel)
114+
firstLabel = true;
115+
line += " {";
116+
}
107117
} else if (ain instanceof TypeInsnNode) {
108118
line = printTypeInsnNode((TypeInsnNode) ain);
109119
} else if (ain instanceof FrameNode) {
@@ -125,6 +135,8 @@ public ArrayList<String> createPrint() {
125135
info.add(line);
126136
}
127137
}
138+
if(firstLabel && BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected())
139+
info.add("}");
128140
return info;
129141
}
130142

src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class AboutWindow extends JFrame {
1010
public AboutWindow() {
11-
setSize(new Dimension(403, 484));
11+
setSize(new Dimension(403, 374));
1212
setType(Type.UTILITY);
1313
setTitle("Bytecode Viewer - About");
1414
getContentPane().setLayout(new CardLayout(0, 0));
@@ -17,7 +17,7 @@ public AboutWindow() {
1717
txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK);
1818
txtrBytecodeViewerIs.setWrapStyleWord(true);
1919
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
20-
txtrBytecodeViewerIs.setText("Bytecode Viewer is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n JSyntaxPane by Ayman Al\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nLimitations:\r\n Syntax highlighting on files that are\r\nbigger than 10K lines can take a while to\r\nload, you may want to disable the syntax\r\nhighlighting for large files.\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
20+
txtrBytecodeViewerIs.setText("Bytecode Viewer is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n JSyntaxPane by Ayman Al\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttp://the.bytecode.club");
2121
txtrBytecodeViewerIs.setEnabled(false);
2222
this.setResizable(false);
2323
this.setLocationRelativeTo(null);

src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import static javax.swing.ScrollPaneConstants.*;
1212

13-
import javax.swing.JEditorPane;
1413
import javax.swing.JPanel;
1514
import javax.swing.JScrollPane;
1615
import javax.swing.JSplitPane;
@@ -27,6 +26,9 @@
2726
import javax.swing.text.ViewFactory;
2827
import javax.swing.text.html.ParagraphView;
2928

29+
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
30+
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
31+
import org.fife.ui.rtextarea.RTextScrollPane;
3032
import org.objectweb.asm.ClassWriter;
3133
import org.objectweb.asm.Type;
3234
import org.objectweb.asm.tree.ClassNode;
@@ -101,8 +103,6 @@ public ClassViewer(final String name, final ClassNode cn) {
101103
sourcePane = BytecodeViewer.viewer.sourcePane.isSelected();
102104
bytecodePane = BytecodeViewer.viewer.bytecodePane.isSelected();
103105
hexPane = BytecodeViewer.viewer.hexPane.isSelected();
104-
boolean bytecodeSyntax = BytecodeViewer.viewer.bycSyntax.isSelected();
105-
boolean sourcecodeSyntax = BytecodeViewer.viewer.srcSyntax.isSelected();
106106
this.name = name;
107107
this.cn = cn;
108108
this.setName(name);
@@ -127,8 +127,6 @@ public ClassViewer(final String name, final ClassNode cn) {
127127
resetDivider();
128128
BytecodeViewer.viewer.setIcon(true);
129129

130-
//
131-
132130
startPaneUpdater();
133131
this.addComponentListener(new ComponentAdapter() {
134132
public void componentResized(ComponentEvent e) {
@@ -166,38 +164,39 @@ public void startPaneUpdater() {
166164
public void doShit() {
167165
final String b = ClassNodeDecompiler.decompile(cn);
168166

169-
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
170-
s = ff_dc.decompileClassNode(cn);
171-
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
172-
s = proc_dc.decompileClassNode(cn);
173-
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
174-
s = cfr_dc.decompileClassNode(cn);
167+
if(BytecodeViewer.viewer.sourcePane.isSelected()) {
168+
if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.fernflowerDec.getModel()))
169+
s = ff_dc.decompileClassNode(cn);
170+
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.procyonDec.getModel()))
171+
s = proc_dc.decompileClassNode(cn);
172+
else if(BytecodeViewer.viewer.decompilerGroup.isSelected(BytecodeViewer.viewer.cfrDec.getModel()))
173+
s = cfr_dc.decompileClassNode(cn);
174+
}
175175

176176
SwingUtilities.invokeLater(new Runnable() {
177177
public void run() {
178-
JEditorPane
179-
bytecode = new JEditorPane(),
180-
decomp = new JEditorPane();
181-
JScrollPane
182-
bytecodeScroll = new JScrollPane(bytecode),
183-
decompScroll = new JScrollPane(decomp);
184-
185-
if(bytecodePane && BytecodeViewer.viewer.bycSyntax.isSelected())
186-
bytecode.setContentType("text/java");
187-
if(sourcePane && BytecodeViewer.viewer.srcSyntax.isSelected())
188-
decomp.setContentType("text/java");
189-
190-
if(bytecodePane)
191-
bytecode.setText(b);
192-
if(sourcePane)
193-
decomp.setText(s);
178+
RSyntaxTextArea bytecodeArea = new RSyntaxTextArea();
179+
bytecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
180+
bytecodeArea.setCodeFoldingEnabled(true);
181+
bytecodeArea.setAntiAliasingEnabled(true);
182+
RTextScrollPane bytecodeSPane = new RTextScrollPane(bytecodeArea);
183+
bytecodeArea.setText(b);
194184

195-
bytePanel.add(bytecodeScroll);
196-
decompPanel.add(decompScroll);
185+
RSyntaxTextArea sourcecodeArea = new RSyntaxTextArea();
186+
sourcecodeArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
187+
sourcecodeArea.setCodeFoldingEnabled(true);
188+
sourcecodeArea.setAntiAliasingEnabled(true);
189+
RTextScrollPane sourcecodeSPane = new RTextScrollPane(sourcecodeArea);
190+
sourcecodeArea.setText(s);
191+
192+
if(BytecodeViewer.viewer.bytecodePane.isSelected())
193+
bytePanel.add(bytecodeSPane);
194+
if(BytecodeViewer.viewer.sourcePane.isSelected())
195+
decompPanel.add(sourcecodeSPane);
196+
197+
bytecodeArea.setCaretPosition(0);
198+
sourcecodeArea.setCaretPosition(0);
197199

198-
bytecode.setCaretPosition(0);
199-
decomp.setCaretPosition(0);
200-
201200
BytecodeViewer.viewer.setIcon(false);
202201
}
203202
});

src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
9999
private final JMenuItem mntmShowMainMethods = new JMenuItem("Show Main Methods");
100100
private final JMenuItem mntmNewMenuItem_3 = new JMenuItem("Save As Jar..");
101101
private JMenuBar menuBar = new JMenuBar();
102-
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow only ASCII characters in strings");
102+
public JCheckBoxMenuItem chckbxmntmNewCheckItem = new JCheckBoxMenuItem("Allow Only ASCII Characters In Strings");
103103
private final JMenuItem mntmReplaceStrings = new JMenuItem("Replace Strings");
104104
private final JMenuItem mntmNewMenuItem_4 = new JMenuItem("");
105105
private final JMenu mnNewMenu_2 = new JMenu("Java Decompiler");
@@ -167,6 +167,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
167167
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_9 = new JCheckBoxMenuItem("Force Explicit Imports");
168168
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_10 = new JCheckBoxMenuItem("Flatten Switch Blocks");
169169
public final JCheckBoxMenuItem chckbxmntmNewCheckItem_11 = new JCheckBoxMenuItem("Exclude Nested Types");
170+
public final JCheckBoxMenuItem chckbxmntmAppendBrackets = new JCheckBoxMenuItem("Append Brackets To Labels");
170171

171172

172173
public void setC(boolean busy) {
@@ -308,6 +309,9 @@ public MainViewerGUI() {
308309
forceturningifs.setSelected(true);
309310
forloopaggcapture.setSelected(true);
310311
//procyon
312+
/*none*/
313+
//other
314+
chckbxmntmAppendBrackets.setSelected(true);
311315

312316
setJMenuBar(menuBar);
313317

@@ -600,6 +604,8 @@ public void actionPerformed(ActionEvent arg0) {
600604

601605
mnBytecodeDecompilerSettings.add(debugHelpers);
602606

607+
mnBytecodeDecompilerSettings.add(chckbxmntmAppendBrackets);
608+
603609
mnBytecodeDecompilerSettings.add(chckbxmntmNewCheckItem);
604610

605611
menuBar.add(mnNewMenu_1);

src/the/bytecode/club/bytecodeviewer/gui/WorkPane.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import java.awt.BorderLayout;
44
import java.awt.Component;
55
import java.awt.FlowLayout;
6-
import java.awt.Font;
76
import java.awt.event.ActionEvent;
87
import java.awt.event.ActionListener;
98
import java.awt.event.ContainerEvent;
109
import java.awt.event.ContainerListener;
11-
import java.lang.reflect.Field;
1210
import java.util.HashMap;
1311

1412
import javax.swing.JButton;
@@ -17,8 +15,6 @@
1715
import javax.swing.event.ChangeEvent;
1816
import javax.swing.event.ChangeListener;
1917

20-
import jsyntaxpane.DefaultSyntaxKit;
21-
2218
import org.objectweb.asm.tree.ClassNode;
2319

2420
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
@@ -51,17 +47,6 @@ public WorkPane(final FileChangeNotifier fcn) {
5147
super("WorkPanel");
5248
setTitle("Work Space");
5349

54-
DefaultSyntaxKit.initKit();
55-
Font defFont = null;
56-
try {
57-
final Field defFontField = DefaultSyntaxKit.class.getDeclaredField("DEFAULT_FONT");
58-
defFontField.setAccessible(true);
59-
defFont = (Font) defFontField.get(null);
60-
} catch (final Exception e) {
61-
e.printStackTrace();
62-
}
63-
SyntaxFontHeight = defFont.getSize();
64-
6550
this.tabs = new JTabbedPane();
6651
this.fcn = fcn;
6752

0 commit comments

Comments
 (0)