Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

LifeMC/bytecode-version-analyzer

bytecode-version-analyzer

Release Discord License Build Status Codacy Badge Known Vulnerabilities

Analyzer for bytecode versions of class files in a JAR file.

Download

You can get the latest release from GitHub Releases, click here for the latest stable release.

Usage

Downloading

Download the latest releases JAR file (via GitHub Releases), open a command line and run the JAR via java -jar, providing the necessary arguments.

If you don't provide any arguments, it will print the help text. Here is a screenshot of the help message from v0.1-SNAPSHOT:

image

Showing version of a single class file

Specifying a class name as an argument will look for a class file in the current directory and print the version of it. Specifying a full path of class files is also supported.

image

Analyzing versions of class files in an archive

Specifying an archive (zip, jar) file name as an argument will also look for an archive file in the current directory, and will analyze all class files in it. Specifying a full path is also supported.

image

Finding classes below or above specific version

If you don't provide --print-if-above or --print-if-below arguments, it will only print messages such as X amount of classes use 52.0 (Java 8) for every different bytecode version. Here is an image if you provide both arguments:

image

Example use cases

You can find old libraries that compile with/into Java 6, or you can find for example libraries that compile into Java 11, or other versions.

Notes

  • Multi-Release JARs are supported. However, to fully support Multi-Release JARs, you must run the program from Java 10 or above. This because JarFile#versionedStream is added in Java 10.

    However, you can still get partial support on Java 9. This because basic versioned JarFile support is added in Java 9. (The new JarFile constructor accepting Runtime.Version objects.)

  • Preview class files (classes compiled with --enable-preview) are also supported.

  • This not a tool to modify/update bytecode or class/jar files in any way.

Limitations/To-do

Limitations

  • This tool will still take into account even if a class file is not used or loaded in run-time.

To-do

  • Refactor code to make it more organized
  • Add tests
  • Use a logger to log messages/errors

Security Policy

Please see Security policy.

Building, Project Preferences, Contributing

Please see Contributing documentation and Project preferences.