mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 06:52:14 +00:00
Update AP to allow (but warn) coerced multi-target reference conflicts
This commit is contained in:
1 parent
2a64bc35b4
commit
c6ce27efb0
6 files changed
+108
-10
No files matched your search
@@ -89,11 +89,31 @@ public class ReferenceManager implements IReferenceManager {
|
||||
*/
|
||||
private final ReferenceMapper refMapper = new ReferenceMapper();
|
||||
|
||||
private boolean allowConflicts;
|
||||
|
||||
public ReferenceManager(IMixinAnnotationProcessor ap, List<ObfuscationEnvironment> environments) {
|
||||
this.ap = ap;
|
||||
this.environments = environments;
|
||||
this.outRefMapFileName = this.ap.getOption(SupportedOptions.OUT_REFMAP_FILE);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.spongepowered.tools.obfuscation.interfaces.IReferenceManager
|
||||
* #getAllowConflicts()
|
||||
*/
|
||||
@Override
|
||||
public boolean getAllowConflicts() {
|
||||
return this.allowConflicts;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.spongepowered.tools.obfuscation.interfaces.IReferenceManager
|
||||
* #setAllowConflicts(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setAllowConflicts(boolean allowConflicts) {
|
||||
this.allowConflicts = allowConflicts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write out stored mappings
|
||||
@@ -214,12 +234,12 @@ public class ReferenceManager implements IReferenceManager {
|
||||
|
||||
protected void addMapping(ObfuscationType type, String className, String reference, String newReference) {
|
||||
String oldReference = this.refMapper.addMapping(type.getKey(), className, reference, newReference);
|
||||
if (oldReference != null && !oldReference.equals(newReference)) {
|
||||
throw new ReferenceConflictException(oldReference, newReference);
|
||||
}
|
||||
|
||||
if (type.isDefault()) {
|
||||
this.refMapper.addMapping(null, className, reference, newReference);
|
||||
}
|
||||
|
||||
if (!this.allowConflicts && oldReference != null && !oldReference.equals(newReference)) {
|
||||
throw new ReferenceConflictException(oldReference, newReference);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user