Skip to content

Conversation

@Matyrobbrt
Copy link
Member

@Matyrobbrt Matyrobbrt commented Jul 17, 2025

This PR implements a constant uninlining plugin based on the Unpick v3 specification.
Constant uninlining is the practice of reverting the inlining of constant values in decompiled code - an optimisation strategy of the compiler. This plugin will read specification files and uninline constant values in the source according to the specification.
In cases where the specification provides a number format (oct, dex or hex), if it is unable to uninline the value to a specific constant, it will convert it to the specified format.

Java is also bumped to Java 21, making this PR a breaking changes. This is done because the Unpick format library requires Java 21. This should not be a problem for our tooling as NFRT already runs with Java 21.
However, a major bump is still needed.

@Matyrobbrt Matyrobbrt added enhancement New feature or request new plugin This request is for a new JST plugin labels Jul 17, 2025
@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@Matyrobbrt Matyrobbrt marked this pull request as ready for review July 19, 2025 00:37
@shartte
Copy link
Contributor

shartte commented Jul 19, 2025

J21 is a bit annoying, sadly.

Copy link
Contributor

@shartte shartte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did indeed not find Malware in this.

Matyrobbrt and others added 2 commits August 6, 2025 16:45
# Conflicts:
#	cli/src/main/java/net/neoforged/jst/cli/io/FolderFileSink.java
@shartte shartte merged commit 0830b1c into main Aug 27, 2025
2 checks passed
@shartte shartte deleted the unpick branch August 27, 2025 22:54
@neoforged-releases
Copy link

🚀 This PR has been released as JavaSourceTransformer version 2.0.2.

Copy link

@Earthcomputer Earthcomputer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not checked your fancy flow logic, I will assume that works well. In general there are some precedence issues. Even though you shouldn't ever need to add parentheses to an inner unpick expression, because the unpick parser already handles precedence and should construct a tree which when written has precedence that preserves semantics, at the top level you still need to add parentheses based on the context of the surrounding code, and when you are generating new expressions.

@Matyrobbrt Matyrobbrt mentioned this pull request Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new plugin This request is for a new JST plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants