Fix Overzealous Final Usage

This commit is contained in:
Konloch 2024-08-21 09:26:54 -06:00
parent 6f96b0d4f4
commit c02116fb56

AI 샘플 코드 생성 중입니다

Loading...
45 changed files with 137 additions and 157 deletions

View File

@ -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)
{

View File

@ -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())
{

View File

@ -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();

View File

@ -118,7 +118,7 @@ public class LibraryClassLoader extends ClassLoader implements ILoader<JarConten
}
@Override
protected String getCommonSuperClass(final String type1, final String type2) {
protected String getCommonSuperClass(String type1, String type2) {
ClassNode ccn = classTree.getClass(type1);
ClassNode dcn = classTree.getClass(type2);

View File

@ -56,7 +56,7 @@ public class SmaliAssembler extends InternalCompiler
try {
DiskWriter.replaceFile(tempSmali.getAbsolutePath(), contents, false);
} catch (final Exception e) {
} catch (Exception e) {
e.printStackTrace();
//BytecodeViewer.handleException(e);
}

View File

@ -67,7 +67,7 @@ public class FernFlowerDecompiler extends InternalDecompiler
}
@Override
public String decompileClassNode(final ClassNode cn, byte[] b)
public String decompileClassNode(ClassNode cn, byte[] b)
{
String start = tempDirectory + fs + MiscUtils.getUniqueName("", ".class");
@ -76,7 +76,7 @@ public class FernFlowerDecompiler extends InternalDecompiler
String exception = "";
try (FileOutputStream fos = new FileOutputStream(tempClass)) {
fos.write(b);
} catch (final IOException e) {
} catch (IOException e) {
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();

View File

@ -58,7 +58,7 @@ public class JADXDecompiler extends InternalDecompiler
try (FileOutputStream fos = new FileOutputStream(tempClass)) {
fos.write(b);
} catch (final IOException e) {
} catch (IOException e) {
BytecodeViewer.handleException(e);
}

View File

@ -75,7 +75,7 @@ public class JDGUIDecompiler extends InternalDecompiler
try (FileOutputStream fos = new FileOutputStream(tempClass)) {
fos.write(b);
} catch (final IOException e) {
} catch (IOException e) {
BytecodeViewer.handleException(e);
}

View File

@ -100,7 +100,7 @@ public class ProcyonDecompiler extends InternalDecompiler {
try (FileOutputStream fos = new FileOutputStream(tempClass)) {
fos.write(b);
} catch (final IOException e) {
} catch (IOException e) {
BytecodeViewer.handleException(e);
}
@ -237,9 +237,8 @@ public class ProcyonDecompiler extends InternalDecompiler {
}
@Override
public boolean tryLoadType(final String internalName,
final Buffer buffer) {
for (final ITypeLoader typeLoader : _typeLoaders) {
public boolean tryLoadType(String internalName, Buffer buffer) {
for (ITypeLoader typeLoader : _typeLoaders) {
if (typeLoader.tryLoadType(internalName, buffer)) {
return true;
}

View File

@ -65,7 +65,7 @@ public class SmaliDisassembler extends InternalDecompiler
try (FileOutputStream fos = new FileOutputStream(tempClass)) {
fos.write(b);
} catch (final IOException e) {
} catch (IOException e) {
BytecodeViewer.handleException(e);
}

View File

@ -868,7 +868,7 @@ public class MainViewerGUI extends JFrame
});
}
public synchronized void updateBusyStatus(final boolean busy)
public synchronized void updateBusyStatus(boolean busy)
{
SwingUtilities.invokeLater(() ->
{

View File

@ -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)

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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<String, byte[]> entry : container.resourceFiles.entrySet())
for (Entry<String, byte[]> 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())
{

View File

@ -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
{

View File

@ -36,13 +36,13 @@ public class ResourceTreeNode extends DefaultMutableTreeNode
private static final int CHILD_MAP_BUILD_THRESHOLD = 3;
private HashMap<Object, ResourceTreeNode> 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<TreeNode>) node.children)
@ -145,7 +145,7 @@ public class ResourceTreeNode extends DefaultMutableTreeNode
protected Comparator<TreeNode> nodeComparator = new Comparator<TreeNode>()
{
@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;
}

View File

@ -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)

View File

@ -76,7 +76,7 @@ public class SearchBoxPane extends TranslatedVisibleComponent
DefaultComboBoxModel<SearchRadius> 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<SearchType> typeModel = new DefaultComboBoxModel<>();
for (final SearchType st : SEARCH_TYPES)
for (SearchType st : SEARCH_TYPES)
typeModel.addElement(st);
typeBox = new JComboBox<>(typeModel);

View File

@ -36,7 +36,7 @@ public enum SearchType
public final SearchPanel panel;
SearchType(final SearchPanel panel)
SearchType(SearchPanel panel)
{
this.panel = panel;
}

View File

@ -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");

View File

@ -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;

View File

@ -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

View File

@ -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));

View File

@ -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 &&

View File

@ -63,7 +63,7 @@ public class ClassViewer extends ResourceViewer
public List<MethodParser> 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) {

View File

@ -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));

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<AbstractInsnNode> il = new ArrayList<>();
for (AbstractInsnNode node : insnList) {
@ -229,7 +228,7 @@ public class RegexInsnFinder {
public void refresh() {
origInstructions = cleanInsn(mn.instructions);
final List<AbstractInsnNode> 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<AbstractInsnNode> 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<AbstractInsnNode[]> findAll(final String regex) {
public List<AbstractInsnNode[]> findAll(String regex) {
final List<AbstractInsnNode[]> 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<AbstractInsnNode[][]> findAllGroups(final String regex) {
public List<AbstractInsnNode[][]> findAllGroups(String regex) {
final List<AbstractInsnNode[][]> 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;

View File

@ -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<MethodNode> methods = node.methods.iterator();
final String srchText = searchText.getText();

View File

@ -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;

View File

@ -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,

View File

@ -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<MethodNode> methods = node.methods.iterator();
final String srchText = searchText.getText();

View File

@ -102,7 +102,7 @@ public class FileDrop {
* @param listener Listens for <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>filesDropped</tt>.
* @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 <tt>message</tt> to <tt>out</tt> 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);

View File

@ -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<String, byte[]> 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<ClassNode> loadClasses(final File jarFile) throws IOException
public static List<ClassNode> loadClasses(File jarFile) throws IOException
{
List<ClassNode> 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<String, byte[]> loadResources(final File zipFile) throws IOException {
public static Map<String, byte[]> 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)

View File

@ -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()) {