Skip to content

Commit

Permalink
Merge branch 'hotfix-0.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamierocks committed May 15, 2019
2 parents dacd559 + e4034cc commit ed8df44
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ subprojects {

group = 'me.jamiemansfield'
archivesBaseName = project.name.toLowerCase()
version = '0.4.3'
version = '0.4.4'

repositories {
mavenCentral()
Expand Down
16 changes: 16 additions & 0 deletions changelogs/0.4.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Lorenz 0.4.4
============

Lorenz 0.4.4 is the combination of bugs identified in the development of Lorenz 0.5.0, specifically
with regards to the mapping format implementations, in addition to a faulty mapping model method.

## IO

- TSRG: Don't write empty class line for parents
- TSRG: Correct a length check, preventing some **valid** mappings from being read
- Enigma: Output field types properly, using the *obfuscated* type

## Mapping Model

- Fix the faulty implementation of `ClassMapping::hasMappings`, specifically it did'nt consider method
argument mappings
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void writeFieldMapping(final FieldMapping field, final int indent) {
this.printIndentedLine(indent, String.format("FIELD %s %s %s",
field.getObfuscatedName(),
field.getDeobfuscatedName(),
field.getMappings().deobfuscate(type)
handleNonePrefix(type)
));
});
// TODO: throw an exception if the type is unknown / WriterResult container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void accept(final String rawLine) {
final String line = SrgConstants.removeComments(rawLine);
if (line.isEmpty()) return;

if (line.length() < 4) {
if (line.length() < 3) {
throw new IllegalArgumentException("Faulty TSRG mapping encountered: `" + line + "`!");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public void write(final MappingSet mappings) {
* @param mapping The class mapping
*/
protected void writeClassMapping(final ClassMapping<?> mapping) {
this.writer.println(String.format("%s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName()));
// Effectively ClassMapping#hasMappings() without the inner class check
if (mapping.hasDeobfuscatedName() ||
mapping.getFieldMappings().stream().anyMatch(Mapping::hasDeobfuscatedName) ||
mapping.getMethodMappings().stream().anyMatch(MethodMapping::hasMappings)) {
this.writer.println(String.format("%s %s", mapping.getFullObfuscatedName(), mapping.getFullDeobfuscatedName()));
}

// Write field mappings
mapping.getFieldsByName().values().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ default InnerClassMapping getOrCreateInnerClassMapping(final String obfuscatedNa
default boolean hasMappings() {
return this.hasDeobfuscatedName() ||
this.getFieldMappings().stream().anyMatch(Mapping::hasDeobfuscatedName) ||
this.getMethodMappings().stream().anyMatch(Mapping::hasDeobfuscatedName) ||
this.getMethodMappings().stream().anyMatch(MethodMapping::hasMappings) ||
this.getInnerClassMappings().stream().anyMatch(ClassMapping::hasMappings);
}

Expand Down

0 comments on commit ed8df44

Please sign in to comment.