Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<properties>
<!-- Project settings -->
<java.version>1.8</java.version>
<java.version>25</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -304,6 +304,12 @@
<artifactId>xpp3</artifactId>
<version>${xpp3.version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>1.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.skylot</groupId>
<artifactId>jadx-core</artifactId>
Expand Down Expand Up @@ -428,11 +434,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<version>3.15.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<showDeprecation>true</showDeprecation>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/the/bytecode/club/bytecodeviewer/BytecodeViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,24 +157,24 @@ public class BytecodeViewer
*
* @param args files you want to open or CLI
*/
public static void main(String[] args)
void main(String[] args)
{
launchArgs = args;

//CLI startup banner
System.out.print("Bytecode Viewer " + VERSION);
IO.print("Bytecode Viewer " + VERSION);

if (FAT_JAR)
System.out.print(" [Fat Jar]");
IO.print(" [Fat Jar]");

System.out.println(" - https://bytecodeviewer.com\r\nCreated by @Konloch - https://konloch.com\r\nPresented by https://the.bytecode.club");
IO.println(" - https://bytecodeviewer.com\r\nCreated by @Konloch - https://konloch.com\r\nPresented by https://the.bytecode.club");

// Set the security manager
try
{
System.setSecurityManager(sm);
}
catch (Throwable t)
catch (Throwable _)
{
System.err.println("Cannot set security manager! Are you on Java 18+ and have not enabled support for it?");
System.err.println("Because of this, you may be susceptible to some exploits!");
Expand Down Expand Up @@ -280,7 +280,7 @@ public static void boot()
viewer.setVisible(true);

//print startup time
System.out.println("Start up took " + ((System.currentTimeMillis() - Configuration.BOOT_TIMESTAMP) / 1000) + " seconds");
IO.println("Start up took " + ((System.currentTimeMillis() - Configuration.BOOT_TIMESTAMP) / 1000) + " seconds");

//request focus on GUI for hotkeys on start
viewer.requestFocus();
Expand Down Expand Up @@ -491,7 +491,7 @@ public static boolean autoCompileSuccessful()
{
return compile(false, false);
}
catch (NullPointerException ignored)
catch (NullPointerException _)
{
return false;
}
Expand All @@ -511,9 +511,8 @@ public static boolean compile(boolean message, boolean successAlert)

for (java.awt.Component c : BytecodeViewer.viewer.workPane.getLoadedViewers())
{
if (c instanceof ClassViewer)
if (c instanceof ClassViewer cv)
{
ClassViewer cv = (ClassViewer) c;

if (noErrors && !cv.bytecodeViewPanel1.compile())
noErrors = false;
Expand Down Expand Up @@ -791,7 +790,7 @@ public static void cleanup()
{
FileUtils.deleteDirectory(tempF);
}
catch (Exception ignored)
catch (Exception _)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static File getLastSaveDirectory()
{
return new File(".").getCanonicalFile();
}
catch (IOException e)
catch (IOException _)
{
return new File(".");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static String getBCVDirectory()
// Hide file by running attrib system command (on Windows)
Process p = new ProcessBuilder("attrib", "+H", BCV_DIR.getAbsolutePath()).start();
}
catch (Exception e)
catch (Exception _)
{
//ignore
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/the/bytecode/club/bytecodeviewer/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ else if (pluginsFile.exists())
public static synchronized void addRecentFile(File f)
{
recentFiles.remove(f.getAbsolutePath()); // already added on the list
recentFiles.add(0, f.getAbsolutePath());
recentFiles.addFirst(f.getAbsolutePath());
MiscUtils.deduplicateAndTrim(recentFiles, maxRecentFiles);
saveRecentFiles();
resetRecentFilesMenu();
Expand Down Expand Up @@ -115,7 +115,7 @@ public static String getRecentFile()
if (recentFiles.isEmpty())
return null;

return recentFiles.get(0);
return recentFiles.getFirst();
}

/**
Expand All @@ -126,7 +126,7 @@ public static String getRecentFile()
public static synchronized void addRecentPlugin(File f)
{
recentPlugins.remove(f.getAbsolutePath()); // already added on the list
recentPlugins.add(0, f.getAbsolutePath());
recentPlugins.addFirst(f.getAbsolutePath());
MiscUtils.deduplicateAndTrim(recentPlugins, maxRecentFiles);
saveRecentPlugins();
resetRecentFilesMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class SettingsSerializer

public static void saveSettingsAsync()
{
BytecodeViewer.getTaskManager().doOnce(task -> saveSettings());
BytecodeViewer.getTaskManager().doOnce(_ -> saveSettings());
}

public static synchronized void saveSettings()
Expand Down Expand Up @@ -236,7 +236,7 @@ public static void preloadSettingsFile()
//line 129 is used normal loading
Configuration.language = Language.valueOf(asString(130));
}
catch (IndexOutOfBoundsException e)
catch (IndexOutOfBoundsException _)
{
//ignore because errors are expected, first start up and outdated settings.
}
Expand Down Expand Up @@ -418,7 +418,7 @@ public static void loadSettings()
BytecodeViewer.viewer.printLineNumbers.setSelected(asBoolean(142));
BytecodeViewer.viewer.disableReloadConfirmation.setSelected(asBoolean(143));
}
catch (IndexOutOfBoundsException e)
catch (IndexOutOfBoundsException _)
{
//ignore because errors are expected, first start up and outdated settings.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ public static void renameFieldNode(String originalParentName, String originalFie
MethodNode m = (MethodNode) o;
for (AbstractInsnNode i : m.instructions.toArray())
{
if (i instanceof FieldInsnNode)
if (i instanceof FieldInsnNode field)
{
FieldInsnNode field = (FieldInsnNode) i;

if (field.owner.equals(originalParentName)
&& field.name.equals(originalFieldName)
Expand Down Expand Up @@ -89,9 +88,8 @@ public static void renameMethodNode(String originalParentName, String originalMe
MethodNode m = (MethodNode) o;
for (AbstractInsnNode i : m.instructions.toArray())
{
if (i instanceof MethodInsnNode)
if (i instanceof MethodInsnNode mi)
{
MethodInsnNode mi = (MethodInsnNode) i;
if (mi.owner.equals(originalParentName)
&& mi.name.equals(originalMethodName)
&& mi.desc.equals(originalMethodDesc))
Expand Down Expand Up @@ -178,24 +176,21 @@ public static void renameClassNode(String oldName, String newName)

for (AbstractInsnNode i : m.instructions.toArray())
{
if (i instanceof TypeInsnNode)
if (i instanceof TypeInsnNode t)
{
TypeInsnNode t = (TypeInsnNode) i;
if (t.desc.equals(oldName))
t.desc = newName;
}

if (i instanceof MethodInsnNode)
if (i instanceof MethodInsnNode mi)
{
MethodInsnNode mi = (MethodInsnNode) i;
if (mi.owner.equals(oldName))
mi.owner = newName;
mi.desc = mi.desc.replace(oldName, newName);
}

if (i instanceof FieldInsnNode)
if (i instanceof FieldInsnNode fi)
{
FieldInsnNode fi = (FieldInsnNode) i;
if (fi.owner.equals(oldName))
fi.owner = newName;
fi.desc = fi.desc.replace(oldName, newName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static ClassNode bytesToNode(byte[] b)
{
cr.accept(cn, ClassReader.EXPAND_FRAMES);
}
catch (Exception e)
catch (Exception _)
{
cr.accept(cn, ClassReader.SKIP_FRAMES);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public static void log(String s)
public static void log(boolean devModeOnly, String s)
{
if (!devModeOnly || DEV_MODE)
System.out.println(s);
IO.println(s);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.awt.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Serial;
import java.io.StringWriter;

import static the.bytecode.club.bytecodeviewer.Constants.*;
Expand Down Expand Up @@ -102,7 +103,7 @@ private void setupException(Throwable error, String author)

setupFrame(sw.toString(), author);
}
catch (IOException ignored)
catch (IOException _)
{
}
}
Expand Down Expand Up @@ -146,5 +147,6 @@ public static String buildErrorLogHeader(String author)
+ ", Java: " + System.getProperty("java.version");
}

@Serial
private static final long serialVersionUID = -5230501978224926296L;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings;

import java.io.Serial;

/**
* A simple console GUI.
*
Expand Down Expand Up @@ -56,5 +58,6 @@ public void setVisible(boolean visible)
super.setVisible(visible);
}

@Serial
private static final long serialVersionUID = -6556940545421437508L;
}
Loading