From c02116fb56dd0a3481878357bd5240438d1cd08f Mon Sep 17 00:00:00 2001 From: Konloch Date: Wed, 21 Aug 2024 09:26:54 -0600 Subject: [PATCH] Fix Overzealous Final Usage --- .../club/bytecodeviewer/BytecodeViewer.java | 2 +- .../bytecodeviewer/api/ASMResourceUtil.java | 3 +- .../club/bytecodeviewer/api/ASMUtil.java | 2 +- .../bootloader/loader/LibraryClassLoader.java | 2 +- .../compilers/impl/SmaliAssembler.java | 2 +- .../impl/FernFlowerDecompiler.java | 4 +- .../decompilers/impl/JADXDecompiler.java | 2 +- .../decompilers/impl/JDGUIDecompiler.java | 2 +- .../decompilers/impl/ProcyonDecompiler.java | 7 +- .../decompilers/impl/SmaliDisassembler.java | 2 +- .../bytecodeviewer/gui/MainViewerGUI.java | 2 +- .../gui/components/ButtonHoverAnimation.java | 4 +- .../gui/components/ExportJar.java | 2 +- .../gui/components/JFrameConsole.java | 2 +- .../gui/components/VisibleComponent.java | 2 +- .../gui/hexviewer/ValuesPanel.java | 4 +- .../gui/resourcelist/ResourceListPane.java | 21 +++-- .../gui/resourcelist/ResourceTree.java | 4 +- .../gui/resourcelist/ResourceTreeNode.java | 10 +-- .../gui/resourcelist/SearchKeyAdapter.java | 2 +- .../gui/resourcesearch/SearchBoxPane.java | 4 +- .../gui/resourcesearch/SearchType.java | 2 +- .../resourceviewer/CloseButtonComponent.java | 2 +- .../resourceviewer/DraggableTabbedPane.java | 2 +- .../gui/resourceviewer/TabExitButton.java | 4 +- .../gui/resourceviewer/TabbedPane.java | 2 +- .../gui/resourceviewer/Workspace.java | 6 +- .../resourceviewer/viewer/ClassViewer.java | 7 +- .../gui/resourceviewer/viewer/FileViewer.java | 2 +- .../resourceviewer/viewer/ResourceViewer.java | 2 +- .../mapping/RemappingAnnotationAdapter.java | 8 +- .../mapping/RemappingClassAdapter.java | 5 +- .../mapping/RemappingFieldAdapter.java | 5 +- .../mapping/RemappingMethodAdapter.java | 12 +-- .../mapping/RemappingSignatureAdapter.java | 6 +- .../preinstalled/AllatoriStringDecrypter.java | 2 +- .../resources/importing/ImportResource.java | 4 +- .../searching/RegexInsnFinder.java | 39 +++++----- .../searching/impl/LDCSearch.java | 3 +- .../impl/MemberWithAnnotationSearch.java | 2 +- .../searching/impl/MethodCallSearch.java | 2 +- .../searching/impl/RegexSearch.java | 2 +- .../club/bytecodeviewer/util/FileDrop.java | 78 +++++++++---------- .../club/bytecodeviewer/util/JarUtils.java | 10 +-- .../club/bytecodeviewer/util/MiscUtils.java | 2 +- 45 files changed, 137 insertions(+), 157 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 8da7b7ff..717b165a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -522,7 +522,7 @@ public class BytecodeViewer * @param files the file(s) you wish to open * @param recentFiles if it should append to the recent files menu */ - public static void openFiles(final File[] files, boolean recentFiles) + public static void openFiles(File[] files, boolean recentFiles) { if (recentFiles) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMResourceUtil.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMResourceUtil.java index 2646b38d..4c23acc1 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMResourceUtil.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMResourceUtil.java @@ -143,8 +143,7 @@ public final class ASMResourceUtil } } - public static void renameClassNode(final String oldName, - final String newName) + public static void renameClassNode(String oldName, String newName) { for (ClassNode c : BytecodeViewer.getLoadedClasses()) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil.java index b06def09..d4facff1 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/ASMUtil.java @@ -32,7 +32,7 @@ public class ASMUtil /** * Creates a new ClassNode instances from the provided byte[] */ - public static ClassNode bytesToNode(final byte[] b) + public static ClassNode bytesToNode(byte[] b) { ClassReader cr = new ClassReader(b); ClassNode cn = new ClassNode(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java index 5fd830a2..e549771f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/bootloader/loader/LibraryClassLoader.java @@ -118,7 +118,7 @@ public class LibraryClassLoader extends ClassLoader implements ILoader { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java index a40d9342..46919096 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java @@ -30,7 +30,7 @@ import javax.swing.AbstractButton; public class ButtonHoverAnimation extends MouseAdapter { @Override - public void mouseEntered(final MouseEvent e) + public void mouseEntered(MouseEvent e) { final Component component = e.getComponent(); if (component instanceof AbstractButton) @@ -41,7 +41,7 @@ public class ButtonHoverAnimation extends MouseAdapter } @Override - public void mouseExited(final MouseEvent e) + public void mouseExited(MouseEvent e) { final Component component = e.getComponent(); if (component instanceof AbstractButton) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java index efae12f0..cb0c1065 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ExportJar.java @@ -36,7 +36,7 @@ import the.bytecode.club.bytecodeviewer.util.JarUtils; public class ExportJar extends JFrame { - public ExportJar(final String jarPath) + public ExportJar(String jarPath) { setSize(new Dimension(250, 277)); setResizable(false); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java index 4597d506..e821e02b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java @@ -123,7 +123,7 @@ public class JFrameConsole extends JFrame /** * Trims the console text to prevent killing the swing thread */ - public String trimConsoleText(final String s) + public String trimConsoleText(String s) { int len = s.length(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java index 8b2b017f..6521f114 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java @@ -35,7 +35,7 @@ import the.bytecode.club.bytecodeviewer.resources.IconResources; public abstract class VisibleComponent extends JInternalFrame { - public VisibleComponent(final String title) + public VisibleComponent(String title) { super(title, false, false, false, false); this.setDefaultIcon(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java index eb2f0d6f..bd419e1d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/hexviewer/ValuesPanel.java @@ -762,7 +762,7 @@ public class ValuesPanel extends javax.swing.JPanel { } } - private void scheduleNextStep(final ValuesPanelField valuesPanelField) { + private void scheduleNextStep(ValuesPanelField valuesPanelField) { SwingUtilities.invokeLater(() -> updateValue(valuesPanelField)); } @@ -770,7 +770,7 @@ public class ValuesPanel extends javax.swing.JPanel { return updateInProgress; } - private void updateValue(final ValuesPanelField valuesPanelField) { + private void updateValue(ValuesPanelField valuesPanelField) { if (valuesPanelField.ordinal() == 0) { long dataSize = codeArea.getDataSize(); clearFields = dataPosition >= dataSize; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListPane.java index faa4b2f0..c24deecf 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListPane.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceListPane.java @@ -134,7 +134,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File } @Override - public void filesDropped(final File[] files) + public void filesDropped(File[] files) { if (files.length < 1) return; @@ -204,7 +204,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File if (!container.resourceFiles.isEmpty()) { - for (final Entry entry : container.resourceFiles.entrySet()) + for (Entry entry : container.resourceFiles.entrySet()) { String name = entry.getKey(); final String[] spl = name.split("/"); @@ -215,7 +215,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File else { ResourceTreeNode parent = root; - for (final String s : spl) + for (String s : spl) { ResourceTreeNode child = parent.getChildByUserObject(s); @@ -233,14 +233,13 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File } @SuppressWarnings("rawtypes") - public void expandAll(final JTree tree, final TreePath parent, - final boolean expand) { + public void expandAll(JTree tree, TreePath parent, boolean expand) { // Traverse children final TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { - for (final Enumeration e = node.children(); e.hasMoreElements(); ) { - final TreeNode n = (TreeNode) e.nextElement(); - final TreePath path = parent.pathByAddingChild(n); + for (Enumeration e = node.children(); e.hasMoreElements(); ) { + TreeNode n = (TreeNode) e.nextElement(); + TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } @@ -253,7 +252,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File } } - public void removeNode(final JTree tree, final TreePath nodePath) + public void removeNode(JTree tree, TreePath nodePath) { MutableTreeNode node = findNodeByPath(nodePath); @@ -542,7 +541,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File quickSearch.addFocusListener(new FocusListener() { @Override - public void focusGained(final FocusEvent arg0) + public void focusGained(FocusEvent arg0) { if (quickSearch.getText().equals(TranslatedStrings.QUICK_FILE_SEARCH_NO_FILE_EXTENSION.toString())) { @@ -554,7 +553,7 @@ public class ResourceListPane extends TranslatedVisibleComponent implements File } @Override - public void focusLost(final FocusEvent arg0) + public void focusLost(FocusEvent arg0) { if (quickSearch.getText().isEmpty()) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java index 0150ab88..2bfa7504 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTree.java @@ -36,7 +36,7 @@ public class ResourceTree extends JTree private static final long serialVersionUID = -2355167326094772096L; DefaultMutableTreeNode treeRoot; - public ResourceTree(final DefaultMutableTreeNode treeRoot) + public ResourceTree(DefaultMutableTreeNode treeRoot) { super(treeRoot); this.treeRoot = treeRoot; @@ -45,7 +45,7 @@ public class ResourceTree extends JTree StringMetricsUtil m = null; @Override - public void paint(final Graphics graphics) + public void paint(Graphics graphics) { try { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTreeNode.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTreeNode.java index ef18444d..d5493f33 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTreeNode.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/ResourceTreeNode.java @@ -36,13 +36,13 @@ public class ResourceTreeNode extends DefaultMutableTreeNode private static final int CHILD_MAP_BUILD_THRESHOLD = 3; private HashMap userObjectToChildMap = null; - public ResourceTreeNode(final Object o) + public ResourceTreeNode(Object o) { super(o); } @Override - public void insert(final MutableTreeNode newChild, final int childIndex) + public void insert(MutableTreeNode newChild, int childIndex) { super.insert(newChild, childIndex); addToMap((ResourceTreeNode) newChild); @@ -54,7 +54,7 @@ public class ResourceTreeNode extends DefaultMutableTreeNode } @SuppressWarnings("unchecked") - private void recursiveSort(final ResourceTreeNode node) + private void recursiveSort(ResourceTreeNode node) { node.children.sort(nodeComparator); for (TreeNode nextNode : (Iterable) node.children) @@ -145,7 +145,7 @@ public class ResourceTreeNode extends DefaultMutableTreeNode protected Comparator nodeComparator = new Comparator() { @Override - public int compare(final TreeNode o1, final TreeNode o2) + public int compare(TreeNode o1, TreeNode o2) { // To make sure nodes with children are always on top final int firstOffset = o1.getChildCount() > 0 ? -1000 : 0; @@ -155,7 +155,7 @@ public class ResourceTreeNode extends DefaultMutableTreeNode } @Override - public boolean equals(final Object obj) + public boolean equals(Object obj) { return false; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/SearchKeyAdapter.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/SearchKeyAdapter.java index a11bd6c3..03799689 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/SearchKeyAdapter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcelist/SearchKeyAdapter.java @@ -41,7 +41,7 @@ public class SearchKeyAdapter extends KeyAdapter } @Override - public void keyPressed(final KeyEvent ke) + public void keyPressed(KeyEvent ke) { //only trigger on enter if (ke.getKeyCode() != KeyEvent.VK_ENTER) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchBoxPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchBoxPane.java index c8df46b8..db338c09 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchBoxPane.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchBoxPane.java @@ -76,7 +76,7 @@ public class SearchBoxPane extends TranslatedVisibleComponent DefaultComboBoxModel radiusModel = new DefaultComboBoxModel<>(); - for (final SearchRadius st : SEARCH_RADII) + for (SearchRadius st : SEARCH_RADII) radiusModel.addElement(st); searchRadiusBox = new JComboBox<>(radiusModel); @@ -84,7 +84,7 @@ public class SearchBoxPane extends TranslatedVisibleComponent searchOpts.add(searchRadiusOpt); DefaultComboBoxModel typeModel = new DefaultComboBoxModel<>(); - for (final SearchType st : SEARCH_TYPES) + for (SearchType st : SEARCH_TYPES) typeModel.addElement(st); typeBox = new JComboBox<>(typeModel); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchType.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchType.java index ec3cd451..09e8536c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchType.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourcesearch/SearchType.java @@ -36,7 +36,7 @@ public enum SearchType public final SearchPanel panel; - SearchType(final SearchPanel panel) + SearchType(SearchPanel panel) { this.panel = panel; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java index e6563dd8..e1d1d0f4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/CloseButtonComponent.java @@ -12,7 +12,7 @@ public class CloseButtonComponent extends JPanel { private final JTabbedPane pane; - public CloseButtonComponent(final JTabbedPane pane) { + public CloseButtonComponent(JTabbedPane pane) { super(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (pane == null) { throw new NullPointerException("TabbedPane is null"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DraggableTabbedPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DraggableTabbedPane.java index 97a62943..b8ae1c38 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DraggableTabbedPane.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/DraggableTabbedPane.java @@ -238,7 +238,7 @@ public class DraggableTabbedPane extends JTabbedPane { public void dropActionChanged(DropTargetDragEvent e) { } - public void dragOver(final DropTargetDragEvent e) { + public void dragOver(DropTargetDragEvent e) { TabTransferData data = getTabTransferData(e); if (data == null) return; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabExitButton.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabExitButton.java index 07828705..e06bb4f0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabExitButton.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabExitButton.java @@ -69,7 +69,7 @@ public class TabExitButton extends JButton implements ActionListener { } @Override - public void actionPerformed(final ActionEvent e) { + public void actionPerformed(ActionEvent e) { final int i = tabbedPane.tabs.indexOfTabComponent(tabbedPane); if (i != -1) { tabbedPane.tabs.remove(i); @@ -83,7 +83,7 @@ public class TabExitButton extends JButton implements ActionListener { // paint the cross @Override - protected void paintComponent(final Graphics g) { + protected void paintComponent(Graphics g) { super.paintComponent(g); final Graphics2D g2 = (Graphics2D) g.create(); // shift the image for pressed buttons diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabbedPane.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabbedPane.java index a0215fd0..73fff32e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabbedPane.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/TabbedPane.java @@ -47,7 +47,7 @@ public class TabbedPane extends JPanel { public final static MouseListener buttonHoverAnimation = new ButtonHoverAnimation(); public static final Color BLANK_COLOR = new Color(0, 0, 0, 0); - public TabbedPane(int tabIndex, String tabWorkingName, String fileContainerName, String name, final JTabbedPane existingTabs, ResourceViewer resource) { + public TabbedPane(int tabIndex, String tabWorkingName, String fileContainerName, String name, JTabbedPane existingTabs, ResourceViewer resource) { // unset default FlowLayout' gaps super(new FlowLayout(FlowLayout.LEFT, 0, 0)); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java index 8db0c739..497e4a18 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/Workspace.java @@ -90,16 +90,16 @@ public class Workspace extends TranslatedVisibleComponent { } //load class resources - public void addClassResource(final ResourceContainer container, final String name) { + public void addClassResource(ResourceContainer container, String name) { addResource(container, name, new ClassViewer(container, name)); } //Load file resources - public void addFileResource(final ResourceContainer container, final String name) { + public void addFileResource(ResourceContainer container, String name) { addResource(container, name, new FileViewer(container, name)); } - private void addResource(final ResourceContainer container, final String name, final ResourceViewer resourceView) { + private void addResource(ResourceContainer container, String name, ResourceViewer resourceView) { // Warn user and prevent 'nothing' from opening if no Decompiler is selected if (BytecodeViewer.viewer.viewPane1.getSelectedDecompiler() == Decompiler.NONE && BytecodeViewer.viewer.viewPane2.getSelectedDecompiler() == Decompiler.NONE && diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java index 010af702..2bc819f6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java @@ -63,7 +63,7 @@ public class ClassViewer extends ResourceViewer public List methods = Arrays.asList(new MethodParser(), new MethodParser(), new MethodParser()); - public ClassViewer(final ResourceContainer container, final String name) + public ClassViewer(ResourceContainer container, String name) { super(new Resource(name, container.getWorkingName(name), container)); @@ -82,7 +82,7 @@ public class ClassViewer extends ResourceViewer } @Override - public void refresh(final JButton button) + public void refresh(JButton button) { setPanes(); refreshTitle(); @@ -292,8 +292,7 @@ public class ClassViewer extends ResourceViewer /** * Whoever wrote this function, THANK YOU! */ - public static JSplitPane setDividerLocation(final JSplitPane splitter, - final double proportion) + public static JSplitPane setDividerLocation(JSplitPane splitter, double proportion) { if (splitter.isShowing()) { if (splitter.getWidth() > 0 && splitter.getHeight() > 0) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java index 25e5d5df..74db5cfa 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java @@ -56,7 +56,7 @@ public class FileViewer extends ResourceViewer public boolean canRefresh; public int zoomSteps = 0; - public FileViewer(final ResourceContainer container, final String name) + public FileViewer(ResourceContainer container, String name) { super(new Resource(name, container.getWorkingName(name), container)); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java index e5701ddb..b45c1396 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java @@ -62,7 +62,7 @@ public abstract class ResourceViewer extends JPanel } - public abstract void refresh(final JButton button); + public abstract void refresh(JButton button); /** * Updates the tab's title diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingAnnotationAdapter.java b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingAnnotationAdapter.java index df86279c..7226ad1c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingAnnotationAdapter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingAnnotationAdapter.java @@ -41,15 +41,13 @@ import the.bytecode.club.bytecodeviewer.Constants; */ public class RemappingAnnotationAdapter extends AnnotationVisitor { - protected final org.objectweb.asm.commons.Remapper remapper; + protected final Remapper remapper; - public RemappingAnnotationAdapter(final AnnotationVisitor av, - final org.objectweb.asm.commons.Remapper remapper) { + public RemappingAnnotationAdapter(AnnotationVisitor av, Remapper remapper) { this(Constants.ASM_VERSION, av, remapper); } - protected RemappingAnnotationAdapter(final int api, - final AnnotationVisitor av, final Remapper remapper) { + protected RemappingAnnotationAdapter(int api, AnnotationVisitor av, Remapper remapper) { super(api, av); this.remapper = remapper; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingClassAdapter.java b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingClassAdapter.java index 2c65144f..9027a6da 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingClassAdapter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingClassAdapter.java @@ -48,12 +48,11 @@ public class RemappingClassAdapter extends ClassVisitor { protected String className; - public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) { + public RemappingClassAdapter(ClassVisitor cv, Remapper remapper) { this(Constants.ASM_VERSION, cv, remapper); } - protected RemappingClassAdapter(final int api, final ClassVisitor cv, - final Remapper remapper) { + protected RemappingClassAdapter(int api, ClassVisitor cv, Remapper remapper) { super(api, cv); this.remapper = remapper; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingFieldAdapter.java b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingFieldAdapter.java index 9167ed1a..b87e479a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingFieldAdapter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingFieldAdapter.java @@ -45,12 +45,11 @@ public class RemappingFieldAdapter extends FieldVisitor { private final org.objectweb.asm.commons.Remapper remapper; - public RemappingFieldAdapter(final FieldVisitor fv, final org.objectweb.asm.commons.Remapper remapper) { + public RemappingFieldAdapter(FieldVisitor fv, org.objectweb.asm.commons.Remapper remapper) { this(Constants.ASM_VERSION, fv, remapper); } - protected RemappingFieldAdapter(final int api, final FieldVisitor fv, - final Remapper remapper) { + protected RemappingFieldAdapter(int api, FieldVisitor fv, Remapper remapper) { super(api, fv); this.remapper = remapper; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingMethodAdapter.java b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingMethodAdapter.java index f341fbd8..95ed11e6 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingMethodAdapter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingMethodAdapter.java @@ -49,13 +49,11 @@ public class RemappingMethodAdapter extends LocalVariablesSorter { protected final org.objectweb.asm.commons.Remapper remapper; - public RemappingMethodAdapter(final int access, final String desc, - final MethodVisitor mv, final org.objectweb.asm.commons.Remapper remapper) { + public RemappingMethodAdapter(int access, String desc, MethodVisitor mv, org.objectweb.asm.commons.Remapper remapper) { this(Constants.ASM_VERSION, access, desc, mv, remapper); } - protected RemappingMethodAdapter(final int api, final int access, - final String desc, final MethodVisitor mv, final Remapper remapper) { + protected RemappingMethodAdapter(int api, int access, String desc, MethodVisitor mv, Remapper remapper) { super(api, access, desc, mv); this.remapper = remapper; } @@ -124,8 +122,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter { @Deprecated @Override - public void visitMethodInsn(final int opcode, final String owner, - final String name, final String desc) { + public void visitMethodInsn(int opcode, String owner, String name, String desc) { if (api >= Constants.ASM_VERSION) { super.visitMethodInsn(opcode, owner, name, desc); return; @@ -135,8 +132,7 @@ public class RemappingMethodAdapter extends LocalVariablesSorter { } @Override - public void visitMethodInsn(final int opcode, final String owner, - final String name, final String desc, final boolean itf) { + public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { if (api < Constants.ASM_VERSION) { super.visitMethodInsn(opcode, owner, name, desc, itf); return; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingSignatureAdapter.java b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingSignatureAdapter.java index 1191714c..50ad5cc3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingSignatureAdapter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/obfuscators/mapping/RemappingSignatureAdapter.java @@ -47,13 +47,11 @@ public class RemappingSignatureAdapter extends SignatureVisitor { private String className; - public RemappingSignatureAdapter(final SignatureVisitor v, - final org.objectweb.asm.commons.Remapper remapper) { + public RemappingSignatureAdapter(SignatureVisitor v, Remapper remapper) { this(Constants.ASM_VERSION, v, remapper); } - protected RemappingSignatureAdapter(final int api, - final SignatureVisitor v, final Remapper remapper) { + protected RemappingSignatureAdapter(int api, SignatureVisitor v, Remapper remapper) { super(api); this.v = v; this.remapper = remapper; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java index 27a9209f..cb570d02 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java @@ -114,7 +114,7 @@ public class AllatoriStringDecrypter extends Plugin scanMethodNode(classNode, method); } - public int readUnsignedShort(byte[] b, final int index) + public int readUnsignedShort(byte[] b, int index) { return ((b[index] & 0xFF) << 8) | (b[index + 1] & 0xFF); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/ImportResource.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/ImportResource.java index 0774d12c..4f87a817 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/ImportResource.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/ImportResource.java @@ -37,7 +37,7 @@ public class ImportResource implements Runnable { try { - for (final File file : files) + for (File file : files) { final String fn = file.getName(); System.out.println("Opening..." + file.getAbsolutePath()); @@ -60,7 +60,7 @@ public class ImportResource implements Runnable Import.FILE.getImporter().open(file); } } - catch (final Exception e) + catch (Exception e) { BytecodeViewer.handleException(e); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java b/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java index dfca79f8..6a0738c3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/searching/RegexInsnFinder.java @@ -137,8 +137,7 @@ public class RegexInsnFinder { private static final String opcodesAnys = buildRegexItems(opcodesAny, false, false); - private static String buildRegexItems(final String[] items, - final boolean capture, final boolean stdRepl) { + private static String buildRegexItems(String[] items, boolean capture, boolean stdRepl) { if (items.length == 0) return "()"; StringBuilder result = new StringBuilder((stdRepl ? "\\b" : "") + "(" + (capture ? "" : "?:") @@ -150,11 +149,11 @@ public class RegexInsnFinder { return result.toString(); } - private static String buildRegexItems(final String[] items) { + private static String buildRegexItems(String[] items) { return buildRegexItems(items, true, true); } - public static String processRegex(final String regex) { + public static String processRegex(String regex) { String result = regex.trim(); result = result.replaceAll("\\bANYINSN *", opcodesAnys); result = result.replaceAll(opcodesInts @@ -207,11 +206,11 @@ public class RegexInsnFinder { private int[] offsets; private String insnString; - public RegexInsnFinder(final ClassNode clazz, final MethodNode method) { + public RegexInsnFinder(ClassNode clazz, MethodNode method) { setMethod(clazz, method); } - private AbstractInsnNode[] cleanInsn(final InsnList insnList) { + private AbstractInsnNode[] cleanInsn(InsnList insnList) { final List il = new ArrayList<>(); for (AbstractInsnNode node : insnList) { @@ -229,7 +228,7 @@ public class RegexInsnFinder { public void refresh() { origInstructions = cleanInsn(mn.instructions); final List il = new ArrayList<>(); - for (final AbstractInsnNode ain : mn.instructions.toArray()) + for (AbstractInsnNode ain : mn.instructions.toArray()) if (ain.getOpcode() >= 0) { il.add(ain); } @@ -245,7 +244,7 @@ public class RegexInsnFinder { throw new UnexpectedException( "Unknown opcode encountered: " + ain.getOpcode()); - } catch (final UnexpectedException e) { + } catch (UnexpectedException e) { BytecodeViewer.handleException(e); } } @@ -262,7 +261,7 @@ public class RegexInsnFinder { // without building a string of the whole method. public static boolean staticScan(ClassNode node, MethodNode mn, Pattern pattern) { final List il = new ArrayList<>(); - for (final AbstractInsnNode ain : mn.instructions.toArray()) + for (AbstractInsnNode ain : mn.instructions.toArray()) if (ain.getOpcode() >= 0) { il.add(ain); } @@ -273,7 +272,7 @@ public class RegexInsnFinder { throw new UnexpectedException( "Unknown opcode encountered: " + ain.getOpcode()); - } catch (final UnexpectedException e) { + } catch (UnexpectedException e) { BytecodeViewer.handleException(e); } } @@ -326,12 +325,12 @@ public class RegexInsnFinder { return insnString; } - public void setMethod(final ClassNode ci, final MethodNode mi) { + public void setMethod(ClassNode ci, MethodNode mi) { this.mn = mi; refresh(); } - private AbstractInsnNode[] makeResult(final int start, final int end) { + private AbstractInsnNode[] makeResult(int start, int end) { int startIndex = 0; int endIndex = -1; for (int i = 0; i < offsets.length - 1; i++) { @@ -359,13 +358,13 @@ public class RegexInsnFinder { * @param regex the regular expression * @return the matching instructions */ - public AbstractInsnNode[] find(final String regex) { + public AbstractInsnNode[] find(String regex) { try { final Matcher regexMatcher = Pattern.compile(processRegex(regex), Pattern.MULTILINE).matcher(insnString); if (regexMatcher.find()) return makeResult(regexMatcher.start(), regexMatcher.end()); - } catch (final PatternSyntaxException ex) { + } catch (PatternSyntaxException ex) { //ignore, they fucked up regex } return new AbstractInsnNode[0]; @@ -377,7 +376,7 @@ public class RegexInsnFinder { * @param regex the regular expression * @return a list with all sets of matching instructions */ - public List findAll(final String regex) { + public List findAll(String regex) { final List results = new ArrayList<>(); try { final Matcher regexMatcher = Pattern.compile(processRegex(regex), @@ -385,7 +384,7 @@ public class RegexInsnFinder { while (regexMatcher.find()) { results.add(makeResult(regexMatcher.start(), regexMatcher.end())); } - } catch (final PatternSyntaxException ex) { + } catch (PatternSyntaxException ex) { BytecodeViewer.handleException(ex); } return results; @@ -398,7 +397,7 @@ public class RegexInsnFinder { * @param regex the regular expression * @return the groups with matching instructions */ - public AbstractInsnNode[][] findGroups(final String regex) { + public AbstractInsnNode[][] findGroups(String regex) { try { final Matcher regexMatcher = Pattern.compile(processRegex(regex), Pattern.MULTILINE).matcher(insnString); @@ -411,7 +410,7 @@ public class RegexInsnFinder { } return result; } - } catch (final PatternSyntaxException ex) { + } catch (PatternSyntaxException ex) { BytecodeViewer.handleException(ex); } return new AbstractInsnNode[0][0]; @@ -424,7 +423,7 @@ public class RegexInsnFinder { * @param regex the regular expression * @return a list with all sets of groups with matching instructions */ - public List findAllGroups(final String regex) { + public List findAllGroups(String regex) { final List results = new ArrayList<>(); try { final Matcher regexMatcher = Pattern.compile(processRegex(regex), @@ -438,7 +437,7 @@ public class RegexInsnFinder { } results.add(result); } - } catch (final PatternSyntaxException ex) { + } catch (PatternSyntaxException ex) { BytecodeViewer.handleException(ex); } return results; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/LDCSearch.java b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/LDCSearch.java index 4ec27f6f..f9142a08 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/LDCSearch.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/LDCSearch.java @@ -71,8 +71,7 @@ public class LDCSearch implements SearchPanel return myPanel; } - public void search(final ResourceContainer container, final String resourceWorkingName, final ClassNode node, - boolean caseSensitive) + public void search(ResourceContainer container, String resourceWorkingName, ClassNode node, boolean caseSensitive) { final Iterator methods = node.methods.iterator(); final String srchText = searchText.getText(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MemberWithAnnotationSearch.java b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MemberWithAnnotationSearch.java index ec7da6e4..51ad75ca 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MemberWithAnnotationSearch.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MemberWithAnnotationSearch.java @@ -63,7 +63,7 @@ public class MemberWithAnnotationSearch implements SearchPanel { return myPanel; } - public void search(final ResourceContainer container, final String resourceWorkingName, final ClassNode node, boolean caseSensitive) { + public void search(ResourceContainer container, String resourceWorkingName, ClassNode node, boolean caseSensitive) { final String srchText = annotation.getText().trim(); if (srchText.isEmpty()) return; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MethodCallSearch.java b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MethodCallSearch.java index 25e5721a..4bf79271 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MethodCallSearch.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/MethodCallSearch.java @@ -143,7 +143,7 @@ public class MethodCallSearch implements SearchPanel } } - public void found(final ResourceContainer container, final String resourceWorkingName, final ClassNode node, final MethodNode method, final AbstractInsnNode insnNode) + public void found(ResourceContainer container, String resourceWorkingName, ClassNode node, MethodNode method, AbstractInsnNode insnNode) { BytecodeViewer.viewer.searchBoxPane.treeRoot.add(new LDCSearchTreeNodeResult( container, diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/RegexSearch.java b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/RegexSearch.java index 8e37fca2..5ede7454 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/RegexSearch.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/searching/impl/RegexSearch.java @@ -73,7 +73,7 @@ public class RegexSearch implements SearchPanel } @Override - public void search(final ResourceContainer container, final String resourceWorkingName, final ClassNode node, boolean exact) + public void search(ResourceContainer container, String resourceWorkingName, ClassNode node, boolean exact) { final Iterator methods = node.methods.iterator(); final String srchText = searchText.getText(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java index 1170669a..a22504b2 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/FileDrop.java @@ -102,7 +102,7 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final Component c, final Listener listener) { + public FileDrop(Component c, Listener listener) { this(null, // Logging stream c, // Drop target BorderFactory.createMatteBorder(2, 2, 2, 2, @@ -122,8 +122,8 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final Component c, final boolean recursive, - final Listener listener) { + public FileDrop(Component c, boolean recursive, + Listener listener) { this(null, // Logging stream c, // Drop target BorderFactory.createMatteBorder(2, 2, 2, 2, @@ -144,8 +144,8 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final PrintStream out, final Component c, - final Listener listener) { + public FileDrop(PrintStream out, Component c, + Listener listener) { this(out, // Logging stream c, // Drop target BorderFactory.createMatteBorder(2, 2, 2, 2, @@ -169,8 +169,8 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final PrintStream out, final Component c, - final boolean recursive, final Listener listener) { + public FileDrop(PrintStream out, Component c, + boolean recursive, Listener listener) { this(out, // Logging stream c, // Drop target BorderFactory.createMatteBorder(2, 2, 2, 2, @@ -187,8 +187,8 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final Component c, - final Border dragBorder, final Listener listener) { + public FileDrop(Component c, + Border dragBorder, Listener listener) { this(null, // Logging stream c, // Drop target dragBorder, // Drag border @@ -208,9 +208,9 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final Component c, - final Border dragBorder, - final boolean recursive, final Listener listener) { + public FileDrop(Component c, + Border dragBorder, + boolean recursive, Listener listener) { this(null, c, dragBorder, recursive, listener); } // end constructor @@ -227,8 +227,8 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final PrintStream out, final Component c, - final Border dragBorder, final Listener listener) { + public FileDrop(PrintStream out, Component c, + Border dragBorder, Listener listener) { this(out, // Logging stream c, // Drop target dragBorder, // Drag border @@ -250,14 +250,14 @@ public class FileDrop { * @param listener Listens for filesDropped. * @since 1.0 */ - public FileDrop(final PrintStream out, final Component c, - final Border dragBorder, - final boolean recursive, final Listener listener) { + public FileDrop(PrintStream out, Component c, + Border dragBorder, + boolean recursive, Listener listener) { if (supportsDnD()) { // Make a drop listener dropListener = new DropTargetListener() { @Override - public void dragEnter(final DropTargetDragEvent evt) { + public void dragEnter(DropTargetDragEvent evt) { log(out, "FileDrop: dragEnter event."); // Is this an acceptable drag event? @@ -284,7 +284,7 @@ public class FileDrop { } // end dragEnter @Override - public void dragOver(final DropTargetDragEvent evt) { // This + public void dragOver(DropTargetDragEvent evt) { // This // is // called // continually @@ -301,7 +301,7 @@ public class FileDrop { } // end dragOver @Override - public void drop(final DropTargetDropEvent evt) { + public void drop(DropTargetDropEvent evt) { log(out, "FileDrop: drop event."); try { // Get whatever was dropped final Transferable tr = evt @@ -380,12 +380,12 @@ public class FileDrop { // (KDE/Gnome) support added. } // end else: not a file list } // end try - catch (final IOException io) { + catch (IOException io) { log(out, "FileDrop: IOException - abort:"); BytecodeViewer.handleException(io); evt.rejectDrop(); } // end catch IOException - catch (final UnsupportedFlavorException ufe) { + catch (UnsupportedFlavorException ufe) { log(out, "FileDrop: UnsupportedFlavorException - abort:"); BytecodeViewer.handleException( @@ -403,7 +403,7 @@ public class FileDrop { } // end drop @Override - public void dragExit(final DropTargetEvent evt) { + public void dragExit(DropTargetEvent evt) { log(out, "FileDrop: dragExit event."); // If it's a Swing component, reset its border if (c instanceof JComponent) { @@ -447,7 +447,7 @@ public class FileDrop { .forName("java.awt.dnd.DnDConstants"); support = true; } // end try - catch (final Throwable t) { + catch (Throwable t) { support = false; } // end catch supportsDnD = support; @@ -458,8 +458,7 @@ public class FileDrop { // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. private static final String ZERO_CHAR_STRING = "" + (char) 0; - private static File[] createFileArray(final BufferedReader bReader, - final PrintStream out) { + private static File[] createFileArray(BufferedReader bReader, PrintStream out) { try { final java.util.List list = new java.util.ArrayList(); java.lang.String line; @@ -473,13 +472,13 @@ public class FileDrop { final File file = new File( new java.net.URI(line)); list.add(file); - } catch (final Exception ex) { + } catch (Exception ex) { log(out, "Error with " + line + ": " + ex.getMessage()); } } return (File[]) list.toArray(new File[0]); - } catch (final IOException ex) { + } catch (IOException ex) { log(out, "FileDrop: IOException"); } return new File[0]; @@ -487,14 +486,13 @@ public class FileDrop { // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added. - private void makeDropTarget(final PrintStream out, - final Component c, final boolean recursive) { + private void makeDropTarget(PrintStream out, Component c, boolean recursive) { // Make drop target final DropTarget dt = new DropTarget(); try { dt.addDropTargetListener(dropListener); } // end try - catch (final java.util.TooManyListenersException e) { + catch (java.util.TooManyListenersException e) { BytecodeViewer.handleException(e); log(out, "FileDrop: Drop will not work due to previous error. Do you have another listener attached?"); @@ -536,8 +534,7 @@ public class FileDrop { /** * Determine if the dragged data is a file list. */ - private boolean isDragOk(final PrintStream out, - final DropTargetDragEvent evt) { + private boolean isDragOk(PrintStream out, DropTargetDragEvent evt) { boolean ok = false; // Get data flavors being dragged @@ -577,7 +574,7 @@ public class FileDrop { /** * Outputs message to out if it's not null. */ - private static void log(final PrintStream out, final String message) { // Log + private static void log(PrintStream out, String message) { // Log // message // if // requested @@ -596,7 +593,7 @@ public class FileDrop { * @param c The component to unregister as a drop target * @since 1.0 */ - public static boolean remove(final Component c) { + public static boolean remove(Component c) { return remove(null, c, true); } // end remove @@ -611,8 +608,7 @@ public class FileDrop { * @param recursive Recursively unregister components within a container * @since 1.0 */ - public static boolean remove(final PrintStream out, - final Component c, final boolean recursive) { // Make sure + public static boolean remove(PrintStream out, Component c, boolean recursive) { // Make sure // we // support // @@ -691,7 +687,7 @@ public class FileDrop { * @param source The event source * @since 1.1 */ - public Event(final File[] files, final Object source) { + public Event(File[] files, Object source) { super(source); this.files = files; } // end constructor @@ -796,7 +792,7 @@ public class FileDrop { * @param data The data to transfer * @since 1.1 */ - public TransferableObject(final Object data) { + public TransferableObject(Object data) { this.data = data; this.customFlavor = new DataFlavor( data.getClass(), MIME_TYPE); @@ -811,7 +807,7 @@ public class FileDrop { * @see Fetcher * @since 1.1 */ - public TransferableObject(final Fetcher fetcher) { + public TransferableObject(Fetcher fetcher) { this.fetcher = fetcher; } // end constructor @@ -829,7 +825,7 @@ public class FileDrop { * @see Fetcher * @since 1.1 */ - public TransferableObject(final Class dataClass, final Fetcher fetcher) { + public TransferableObject(Class dataClass, Fetcher fetcher) { this.fetcher = fetcher; this.customFlavor = new DataFlavor(dataClass, MIME_TYPE); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java index fb105234..ee2895ef 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java @@ -67,7 +67,7 @@ public class JarUtils * @param jarFile the input jar file * @throws IOException */ - public static void importArchiveA(final File jarFile) throws IOException + public static void importArchiveA(File jarFile) throws IOException { ResourceContainer container = new ResourceContainer(jarFile); Map files = new LinkedHashMap<>(); @@ -118,7 +118,7 @@ public class JarUtils * @param jarFile the input jar file * @throws IOException */ - public static void importArchiveB(final File jarFile) throws IOException + public static void importArchiveB(File jarFile) throws IOException { //if this ever fails, worst case import Sun's jarsigner code from JDK 7 re-sign the jar to rebuild the CRC, // should also rebuild the archive byte offsets @@ -160,7 +160,7 @@ public class JarUtils BytecodeViewer.addResourceContainer(container); } - public static List loadClasses(final File jarFile) throws IOException + public static List loadClasses(File jarFile) throws IOException { List classes = new ArrayList<>(); try (FileInputStream fis = new FileInputStream(jarFile); @@ -200,7 +200,7 @@ public class JarUtils * @param zipFile the input zip file * @throws IOException */ - public static Map loadResources(final File zipFile) throws IOException { + public static Map loadResources(File zipFile) throws IOException { if (!zipFile.exists()) return new LinkedHashMap<>(); // just ignore (don't return null for null-safety!) @@ -234,7 +234,7 @@ public class JarUtils * @param bytez the class file's byte[] * @return the ClassNode instance */ - public static ClassNode getNode(final byte[] bytez) + public static ClassNode getNode(byte[] bytez) { //TODO figure out why is this synchronized and if it's actually needed (probably not) synchronized (LOCK) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java index 335bd4b0..6be19c50 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java @@ -333,7 +333,7 @@ public class MiscUtils * @return the read byte[] * @throws IOException */ - public static byte[] getBytes(final InputStream is) throws IOException + public static byte[] getBytes(InputStream is) throws IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {