Skip to content

Fix EnigmaWriterBase not writing missing destination namespace nest members#140

Open
Geolykt wants to merge 2 commits into
FabricMC:devfrom
Geolykt:fix-nest-differences
Open

Fix EnigmaWriterBase not writing missing destination namespace nest members#140
Geolykt wants to merge 2 commits into
FabricMC:devfrom
Geolykt:fix-nest-differences

Conversation

@Geolykt
Copy link
Copy Markdown

@Geolykt Geolykt commented Mar 27, 2026

This happens when nest depth differs between source and destination names in enigma files. This can easily be provoked by making a class that was in its own compilation unit an inner class (at least insofar the destination namespace name is concerned) of an unrelated class.

To give an example, the current behaviour is as follows: A a -> b$c mapping will be written as CLASS a b. A a$b -> c$d$e mapping will be written as CLASS a$b c$d.

The new behaviour aligns with the expected behaviour of not voiding information. In the examples above, it will produce CLASS a b$c and CLASS a$b c$d$e respectively. Thus it will be capable of roundtripping such mapping files.

Keep in mind that a lot of tooling doesn't use class names to evaluate the nest hosts. This PR does not change any behaviour regarding that, or in other words, just because the name indicates that a class is an inner class of another doesn't mean that it actually is considered to be as such according to javac or the JVM.

Further, dependent projects such as Enigma do not tolerate inner classes that have been created this way. However, prior to this commit Enigma's UI bugged out to the point where one cannot interact with these classes. Now the UI is bugged out, but the classes can at least be interacted with. However, this is an issue with either the reading process or some UI aspect within enigma, not within the enigma writing process (as far as I am concerned).

…st members

This happens when nest depth differs between source and destination names
in enigma files. This can easily be provoked by making a class that was in
its own compilation unit an inner class (at least insofar the destination
namespace name is concerned) of an unrelated class.

To give an example, the current behaviour is as follows:
A `a` -> `b$c` mapping will be written as `CLASS a b`.
A `a$b` -> `c$d$e` mapping will be written as `CLASS a$b c$d`.

The new behaviour aligns with the expected behaviour of not
voiding information. In the examples above, it will produce
`CLASS a b$c` and `CLASS a$b c$d$e` respectively.

Keep in mind that a lot of tooling doesn't use class names to evaluate
the nest hosts. This commit does not change any behaviour regarding that,
or in other words, just because the name indicates that a class is an inner
class of another doesn't mean that it actually is considered to be as
such according to javac or the JVM.

Further, dependent projects such as enigma do not tolerate inner classes
that have been created this way. However, prior to this commit Enigma's
UI bugged out to the point where one cannot interact with these classes.
Now the UI is bugged out, but the classes can at least be interacted with.
However, this is an issue with either the reading process or some UI
aspect within enigma, not within the enigma writing process (as far
as I am concerned).
@modmuss50 modmuss50 added the bug Something isn't working label Mar 27, 2026
Why on earth does `publishToMavenLocal` not trigger the `check` task.
Oh well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants