Coder Social home page Coder Social logo

ststeiger / procyon Goto Github PK

View Code? Open in Web Editor NEW
158.0 7.0 22.0 1.05 MB

Procyon java decompiler - Procyon is a binary star system in Canis Minor

Home Page: https://github.com/mstrobel/procyon

License: Other

Java 99.78% Jasmin 0.22%
java-decompiler java-8 java-9 procyon reflection-framework compiler-toolset expression-tree inspection

procyon's Introduction

Procyon has since moved to github.

For the latest version, please see https://github.com/mstrobel/procyon

Procyon is a suite of Java metaprogramming tools focused on code generation and analysis. It includes the following libraries:

  1. Core Framework
  2. Reflection Framework
  3. Expressions Framework
  4. Compiler Toolset (Experimental)
  5. Java Decompiler

The Procyon libraries are available from Maven Central under group ID org.bitbucket.mstrobel.

Core Framework

The procyon-core framework contains common support classes used by the other Procyon APIs. Its facilities include string manipulation, collection extensions, filesystem/path utilities, freezable objects and collections, attached data stores, and some runtime type helpers.

Reflection Framework

The procyon-reflection framework provides a rich reflection and code generation API with full support for generics, wildcards, and other high-level Java type concepts. It is based on .NET's System.Reflection and System.Reflection.Emit APIs and is meant to address many of the shortcomings of the core Java reflection API, which offers rather limited and cumbersome support for generic type inspection. Its code generation facilities include a TypeBuilder, MethodBuilder, and a bytecode emitter.

For more information, see the Reflection Framework topic.

Example

:::java
final Type<Map> map = Type.of(Map.class);
final Type<?> rawMap = map.getErasedType();
final Type<Map<String, Integer>> boundMap = map.makeGenericType(Types.String, Types.Integer);

System.out.println(map.getDeclaredMethods().get(1));
System.out.println(rawMap.getDeclaredMethods().get(1));
System.out.println(boundMap.getDeclaredMethods().get(1));

System.out.println(boundMap.getGenericTypeParameters());
System.out.println(boundMap.getTypeArguments());

Output

:::text
public abstract V put(K, V)
public abstract Object put(Object, Object)
public abstract Integer put(String, Integer)
[K, V]
[java.lang.String, java.lang.Integer]

Expressions Framework

The procyon-expressions framework provides a more natural form of code generation. Rather than requiring bytecode to be emitted directly, as with procyon-reflection and other popular libraries like ASM, procyon-expressions enables code composition using declarative expression trees. These expression trees may then be compiled directly into callbacks or coupled with a MethodBuilder. The procyon-expressions API is almost a direct port of System.Linq.Expressions from .NET's Dynamic Language Runtime, minus the dynamic callsite support (and with more relaxed rules regarding type conversions).

Example

:::java    
//
// This lambda closes over a complex constant (a String array).
//

final ConstantExpression items = constant(
    new String[] { "one", "two", "three", "four", "five" }
);

//
// If written in Java, the constructed expression would look something like this:
// 
// () -> {
//     for (String item : <closure>items)
//         System.out.printf("Got item: %s\n", item);
// }
//

final ParameterExpression item = variable(Types.String, "item");

final LambdaExpression<Runnable> runnable = lambda(
    Type.of(Runnable.class),
    forEach(
        item,
        items,
        call(
            field(null, Types.System.getField("out")),
            "printf",
            constant("Got item: %s\n"),
            item
        )
    )
);

System.out.println(runnable);

final Runnable delegate = runnable.compile();

delegate.run();

Output

:::text
() => for (String item : [one, two, three, four, five])
    System.out.printf("Got item: %s\n", new Object[] { item })

Got item: one
Got item: two
Got item: three
Got item: four
Got item: five

Compiler Toolset

The procyon-compilertools project is a work in progress that includes:

  1. Class metadata and bytecode inspection/manipulation facilities based on Mono.Cecil
  2. An optimization and decompiler framework based on ILSpy

The Compiler Toolset is still early in development and subject to change.

Decompiler Front-End

procyon-decompiler is a standalone front-end for the Java decompiler included in procyon-compilertools. All dependencies are embedded in the JAR for easy redistribution. For more information about the decompiler, see the Java Decompiler wiki page.

Powered by Procyon

Check out these third party products based on Procyon! Are you using Procyon in one of your projects? Contact me (email / twitter) if you would like it listed here.

  • SecureTeam Java Decompiler
    A JavaFX-based decompiler front-end with fast and convenient code navigation. Download it, or launch it directly from your browser.

  • Bytecode Viewer is an open source Java decompilation, disassembly, and debugging suite by @Konloch. It can produce decompiled sources from several modern Java decompilers, including Procyon, CFR, and FernFlower.

procyon's People

Contributors

ststeiger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

procyon's Issues

Command line parameter

Hello.
I have a feature request. Have the ability to decompile a apk file and save all the source code from command line.
Thanks

Installation/running issue.

Thank you for this software! I receive the error message "Unable to access jarfile procyon-decompiler-0.5.36" when I enter "java -jar procyon-decompiler-0.5.36 -jar json-target-dynamic.jar -o destdir" at the command prompt (without quotation marks).
I'm running Windows 10, JDK 1_8_231, latest version of Procyon (0.5.36). I was sure to enable file because of Win10's stupid "this is blocked because came from another computer" checkbox under properties. Re-started the CMD prompt, but still can't run file. I converted to zip, extracted, re-zipped, renamed to jar, still can't run. I tried the 0.5.30 file, same issue.
I added the directory where I placed the Procyon file to my environment variables: Path, Classpath and even JAVA_HOME. Still same error.
Sorry in advance if I'm making a noob mistake in any way.
Any ideas on how to fix this and get it running would be greatly appreciated.
Thank you

Stuck when decompiling class CustomWorldSettingsFinal

At the decompile net/minecraft/server/v1_8_R3/CustomWorldSettingsFinal task and it stuck 1,5 hour + doesn't continue, but the class file CustomWorldSettingsFinal.class is just 4KB(i extract from jar file), please fix :(

Image:
Capture
Capture1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.