Lorenz 0.4.0
This version of Lorenz consolidates the work towards supporting additional formats, even going as far to support those formats. A number of breaking changes have been made in order to support these formats, in addition to new constructs to make using Lorenz easier.
The following formats are now supported:
Big thanks to @Minecrell, for his help towards this release!
Changes
Type Model
Lorenz 0.4.0 has received a major overhaul of the type model, migrating that section of the codebase over to its own project (Bombe), and introducing a great deal of safety to types and their uses.
PrimitiveType
has been split up toBaseType
andVoidType
, becoming more in line with the JVM specification.- However, there now exists a
PrimtiveType
interface that bothBaseType
andVoidType
inherit.
- However, there now exists a
FieldType
has been introduced, providing type safety for field types (void is not a valid field or parameter descriptor as per the JVM specification).- The
#getObfuscated()
and#getDeobfuscated(MappingSet)
methods no longer exist in eitherType
orMethodDescriptor
.- Calls to
#getObfuscated()
should be replaced with calls to#toString()
. - Calls to
#getDeobfuscated(MappingSet)
should be replaced with calls toMappingSet#deobfuscate
for the appropriate type.
- Calls to
MethodDescriptor#compile()
has been renamed toMethodDescriptor#of()
.- The ‘convenience’ signature constructors have been replaced with
#of(String, String)
methods.
I/O
Previously Lorenz had only supported text-based mapping formats and gave them a rather strict means of being implemented. Lorenz 0.4.0 has generified the I/O classes to be more adaptable to a greater number of situations, including binary-based formats.
The provided implementations of mapping format I/O classes have also been moved to their own packages in preparation of the modularisation that will happen in Lorenz 0.5.0 (more on that later).
MappingsReader
andMappingsWriter
have been generified and are no longer dependent on text-based formats.- There is abstract classes for both text-based formats and binary-based formats.
- The
Processor
s of text-based formats are now contained as inner classes of their parent reader.- The processors no longer use Guava’s
LineProcessor
, instead using Java’sConsumer
.
- The processors no longer use Guava’s
MappingsReader#parse()
has been refactored toMappingsReader#read()
becoming more consistent with the reader naming.- The mapping readers will now throw exceptions when given bad input, as opposed to ignoring
it as it did in the past.
- Do note that SRG package mappings are’nt considered bad input, and will be silently ignored.
- This remains to be something that needs to be looked into further, and expect changes to be made in 0.5.0/1.0.0.
- Introduced a
MappingFormat
interface, with convenience methods that will be useful to consumers of Lorenz.- Notably there are convenience methods for operating with
Path
s directly.MappingFormat#read(Path)
MappingFormat#write(MappingSet, Path)
- There is a psuedo-enumeration of
MappingFormat
s implemented within Lorenz available through theMappingFormats
class.
- Notably there are convenience methods for operating with
Other
These changes, though notable, are not large enough to warrant their own section. Most of the changes listed here are features / changes to better support the new formats that Lorenz supports.
- Fields are now stored using their signature as a key, not their obfuscated name.
- FieldTypeProviders no longer guarantee the availability of field type information.
- MappingSet makes use of a CascadingFieldTypeProvider allowing multiple providers to be used.
- Method Parameter Mappings are now supported, using the index of the parameter as the
obfuscated name and key.
- To make this change,
MemberMapping
was altered to become generic - allowing for any parent mapping of typeMapping
.
- To make this change,
- The dependency on Guava has been dropped.
Modularisation
As previously mentioned, Lorenz 0.5.0 will have complete modularisation. This will go further than the “primitive” modularisation present in 0.4.0. There will exist individual modules for each format supported in Lorenz, as opposed to being included in the base module.
Complete modularisation was deferred until 0.5.0 to not hold back any further on a 0.4.0 release, and allow for adequate time to consider a few technical points that would be nice to have solved.
Lorenz-ASM
The first module has appeared! Lorenz-ASM provides a number of utilities that may be useful when using Lorenz with ASM.
- An implementation of ASM’s
Remapper
class, backed by aMappingSet
and anInheritanceProvider
(from Bombe).- This class was previously available through
Survey and notably the Lorenz version
lacks the
SignatureAdapter
that can handle broken signatures produced by obfuscators. This omission was made simply as fixing issues with obfuscators does not fall within Lorenz’s remit. - Bombe-ASM (which Lorenz-ASM depends on) has 2 implementations of
InheritanceProvider
.
- This class was previously available through
Survey and notably the Lorenz version
lacks the
- An implementation of Lorenz’s
FieldTypeProvider
, backed by aSourceSet
(from Bombe-ASM).