Version 0.8-preview

Add initial modlauncher support
Bump ASM version and remove renamed ASM for modlauncher interop
Conform static accessor target when transforming accessor, Fixes #342
Detect staticness mismatch on accessors, Fixes #341
Allow Invoker to invoke constructors, Closes #339
Remove commons-io and replace with guava, Fixes #327
Fix refmap generation for non-obfuscated derived classes, Fixes #326
Specify locale for case conversions, Fixes #315
Handle accessor overlap more intelligently, Fixes #307
Add SuppressWarnings support to Annotation Processor, Closes #306
Allow mixins applied to a class to be retrieved easily, Closes #302
Conform refmap entries as they are added to the mapper, fixes #296
Fold in misc lvt generation fixes from fabricmc, closes #295
Fail fast when final method is accidentally hidden by mixin, fixes #293
Fix bug handling 2-slot args in cb injector and args gen, fixes #287
Handle accessor mixin types correctly in mixins, Fixes #305, Fixes #288
This commit is contained in:
Mumfrey committed 2019-09-16 16:05:40 +01:00
1 parent ab935e061f
commit fd2f2c79c5
246 files changed
+10899 -3125

No files matched your search

@@ -33,7 +33,8 @@ import javax.lang.model.element.VariableElement;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import org.spongepowered.asm.mixin.injection.struct.MemberInfo;
import org.spongepowered.asm.mixin.injection.selectors.ITargetSelector;
import org.spongepowered.asm.mixin.injection.selectors.ITargetSelectorByName;
import org.spongepowered.asm.obfuscation.mapping.IMapping;
import org.spongepowered.asm.obfuscation.mapping.common.MappingField;
import org.spongepowered.asm.obfuscation.mapping.common.MappingMethod;
@@ -373,7 +374,7 @@ abstract class AnnotatedMixinElementHandler {
this.ap.printMessage(Kind.ERROR, ex.getMessage(), method, annotation.asMirror());
}
} catch (InvalidConstraintException ex) {
this.ap.printMessage(Kind.WARNING, ex.getMessage(), method, annotation.asMirror());
this.ap.printMessage(Kind.WARNING, ex.getMessage(), method, annotation.asMirror(), "constraints");
}
}
@@ -420,7 +421,7 @@ abstract class AnnotatedMixinElementHandler {
this.validateMethodVisibility(method, annotation, type, target, targetMethod);
}
} else if (!merge) {
this.printMessage(Kind.WARNING, "Cannot find target for " + type + " method in " + target, method, annotation);
this.printMessage(Kind.WARNING, "Cannot find target for " + type + " method in " + target, method, annotation, "target");
}
}
}
@@ -435,9 +436,9 @@ abstract class AnnotatedMixinElementHandler {
Visibility visMethod = TypeUtils.getVisibility(method);
String visibility = "visibility of " + visTarget + " method in " + target;
if (visTarget.ordinal() > visMethod.ordinal()) {
this.printMessage(Kind.WARNING, visMethod + " " + type + " method cannot reduce " + visibility, method, annotation);
this.printMessage(Kind.WARNING, visMethod + " " + type + " method cannot reduce " + visibility, method, annotation, "visibility");
} else if (visTarget == Visibility.PRIVATE && visMethod.ordinal() > visTarget.ordinal()) {
this.printMessage(Kind.WARNING, visMethod + " " + type + " method will upgrade " + visibility, method, annotation);
this.printMessage(Kind.WARNING, visMethod + " " + type + " method will upgrade " + visibility, method, annotation, "visibility");
}
}
@@ -468,7 +469,7 @@ abstract class AnnotatedMixinElementHandler {
}
if (targetField == null) {
this.ap.printMessage(Kind.WARNING, "Cannot find target for " + type + " field in " + target, field, annotation.asMirror());
this.ap.printMessage(Kind.WARNING, "Cannot find target for " + type + " field in " + target, field, annotation.asMirror(), "target");
}
}
}
@@ -477,26 +478,35 @@ abstract class AnnotatedMixinElementHandler {
* Checks whether the referenced method exists in all targets and raises
* warnings where appropriate
*/
protected final void validateReferencedTarget(ExecutableElement method, AnnotationHandle inject, MemberInfo reference, String type) {
String signature = reference.toDescriptor();
protected final void validateReferencedTarget(ExecutableElement method, AnnotationHandle inject, ITargetSelector reference, String type) {
if (!(reference instanceof ITargetSelectorByName)) {
return;
}
ITargetSelectorByName nameRef = (ITargetSelectorByName)reference;
String signature = nameRef.toDescriptor();
for (TypeHandle target : this.mixin.getTargets()) {
if (target.isImaginary()) {
continue;
}
MethodHandle targetMethod = target.findMethod(reference.name, signature);
MethodHandle targetMethod = target.findMethod(nameRef.getName(), signature);
if (targetMethod == null) {
this.ap.printMessage(Kind.WARNING, "Cannot find target method for " + type + " in " + target, method, inject.asMirror());
this.ap.printMessage(Kind.WARNING, "Cannot find target method for " + type + " in " + target, method, inject.asMirror(), "target");
}
}
}
private void printMessage(Kind kind, String msg, Element e, AnnotationHandle annotation) {
this.printMessage(kind, msg, e, annotation, null);
}
private void printMessage(Kind kind, String msg, Element e, AnnotationHandle annotation, String suppressedBy) {
if (annotation == null) {
this.ap.printMessage(kind, msg, e);
this.ap.printMessage(kind, msg, e, suppressedBy);
} else {
this.ap.printMessage(kind, msg, e, annotation.asMirror());
this.ap.printMessage(kind, msg, e, annotation.asMirror(), suppressedBy);
}
}