Skip to content

Reincarnation is designed as a decompiler intended to support modern Java syntax.

License

Notifications You must be signed in to change notification settings

teletha/reincarnation

Repository files navigation

   

Summary

Reincarnation is designed as a decompiler intended to support modern Java syntax. Eventually, it should be able to understand all of the syntax and grammars listed below. However, some information that is completely removed by the compiler and cannot be accessed from the bytecode cannot be restored, but we believe that the restored code will not interfere with its operation.

The output method of the analyzed code is not limited to Java, but is designed to be convertible to a variety of languages.

Java Language Features

  • Declarations
    • package
    • import
    • static import
    • class
    • interface
      • Default method
      • Static method
      • Private method
    • annotation
    • enum
    • record
  • Inheritance
    • extends
    • implements
    • sealed and permits
  • Modifiers (public protected private static abstract final synchronized native transient volatile strictfp)
  • Inner class declaration
    • Member class (static or non-static)
    • Local class
    • Anonymous class
  • Class initializer, instance initializer
  • Constructor
    • Explicit receiver parameters on inner class
  • Field
  • Method
    • Variable arity method (a.k.a. "varargs")
    • Explicit receiver parameters
  • Statement
    • if-else
    • for
      • enhanced for by array
      • enhanced for by Iterable
    • while
    • do-while
    • try-catch-finally
      • multi catches
    • try-with-resources
    • throw
    • return
    • break
    • continue
    • switch
      • fall through
      • by char
      • by enum
      • by String
      • pattern matching
      • expression
        • yield
        • arrow syntax
        • multiple comma-separated labels
    • synchronized
    • assert
    • labeled statement
  • Types, Values, and Variables
    • Primitive Types (boolean, char, byte, short, int, long, float, double)
    • Reference Types (class, interface, array)
  • Operators
    • Unary operators ( + - ++ -- ~ ! )
    • Multiplicative operators ( * / % )
    • Additive operators ( + - )
    • Shift operators ( << >> >>> )
    • Relational operators ( < > <= >= instanceof )
    • Equality operators ( == != )
    • Logical operators and Integer bitwise operators ( & ^ ! | ~ )
    • Conditional operator ( || && ? ... : ... )
    • Assignment operators ( = *= /= %= += -= <<= >>= >>>= &= ^= |= )
    • String concatenation operator ( + )
  • Superclass member access (e.g. super.meth(), super.field)
  • this (reference to current instance)
  • Constructor invocation (e.g. this(a, b), super(a)
  • Method invocation (e.g. System.out.println("Hello"))
  • Class Instance Creation Expression (e.g. new Foo())
  • Array Creation and Access Expression (e.g. new int[], new Object[10][5][], args[1])
  • Array initializer (e.g. String[] array = { "x", "y", "z" })
  • Field Access Expression (e.g. System.out)
  • Local variable access
  • Local variable type inference (a.k.a. "var")
  • Literal
    • integer
    • floating-point
    • boolean
    • character
    • string
      • text block
      • escape sequence
    • null
    • class (e.g. int.class, String.class)
  • Cast
    • instanceof
    • instanceof with pattern matching
    • wideining
    • narrowing
    • auto-boxing and auto-unboxing
  • Generics
    • Type variable (e.g. <S, T, R>)
    • Parameterized type (e.g. Foo)
    • Wildcard type (e.g. ? extends Closeable)
    • Generic array type (e.g. T[])
    • Intersection type (e.g. X extends List & Serializable)
  • Annotation
    • on Type
    • on Constructor
    • on Method
    • on Field
    • on Parameter
    • on Annotation
    • on Local Variable
    • on Package
    • on Type Parameter
    • on Type Use
    • Repeatable declaration
  • Type interference for generic instance creation (a.k.a. the "diamond operator") (JLS11 15.9.1)
  • Lambda expression
  • Method reference (e.g. this::method, String::concat, Type::new, int[]::new)

back to top

Usage

back to top

Prerequisites

Reincarnation runs on all major operating systems and requires only Java version 21 or later to run. To check, please run java -version from the command line interface. You should see something like this:

> java -version
openjdk version "16" 2021-03-16
OpenJDK Runtime Environment (build 16+36-2231)
OpenJDK 64-Bit Server VM (build 16+36-2231, mixed mode, sharing)

back to top

Install

For any code snippet below, please substitute the version given with the version of Reincarnation you wish to use.

Add JitPack repository at the end of repositories element in your build.xml:

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

Add it into in the dependencies element like so:

<dependency>
    <groupId>com.github.teletha</groupId>
    <artifactId>Reincarnation</artifactId>
    <version>1.6.0</version>
</dependency>

Add JitPack repository at the end of repositories in your build.gradle:

repositories {
    maven { url "https://jitpack.io" }
}

Add it into the dependencies section like so:

dependencies {
    implementation 'com.github.teletha:Reincarnation:1.6.0'
}

Add JitPack repository at the end of resolvers in your build.sbt:

resolvers += "jitpack" at "https://jitpack.io"

Add it into the libraryDependencies section like so:

libraryDependencies += "com.github.teletha" % "Reincarnation" % "1.6.0"

Add JitPack repository at the end of repositories in your project.clj:

:repositories [["jitpack" "https://jitpack.io"]]

Add it into the dependencies section like so:

:dependencies [[com.github.teletha/Reincarnation "1.6.0"]]

Add it into your project definition class like so:

require("com.github.teletha", "Reincarnation", "1.6.0");

back to top

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

The overwhelming majority of changes to this project don't add new features at all. Optimizations, tests, documentation, refactorings -- these are all part of making this product meet the highest standards of code quality and usability. Contributing improvements in these areas is much easier, and much less of a hassle, than contributing code for new features.

Bug Reports

If you come across a bug, please file a bug report. Warning us of a bug is possibly the most valuable contribution you can make to Reincarnation. If you encounter a bug that hasn't already been filed, please file a report with an SSCCE demonstrating the bug. If you think something might be a bug, but you're not sure, ask on StackOverflow or on Reincarnation-discuss.

back to top

Dependency

Reincarnation depends on the following products on runtime.

back to top

License

Copyright (C) 2024 The REINCARNATION Development Team

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

back to top

About

Reincarnation is designed as a decompiler intended to support modern Java syntax.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages