Add exclusion for synthetic static fields in pre-processor, closes #43

This commit is contained in:
Mumfrey committed 2015-04-29 11:59:16 +01:00
1 parent 110882d719
commit fbb9720818
2 files changed
+7 -1

No files matched your search

@@ -248,7 +248,9 @@ class MixinPreProcessor {
private boolean validateField(MixinTargetContext context, FieldNode field, AnnotationNode shadow) {
// Public static fields will fall foul of early static binding in java, including them in a mixin is an error condition
if (MixinApplicator.hasFlag(field, Opcodes.ACC_STATIC) && !MixinApplicator.hasFlag(field, Opcodes.ACC_PRIVATE)) {
if (MixinApplicator.hasFlag(field, Opcodes.ACC_STATIC)
&& !MixinApplicator.hasFlag(field, Opcodes.ACC_PRIVATE)
&& !MixinApplicator.hasFlag(field, Opcodes.ACC_SYNTHETIC)) {
throw new InvalidMixinException(context, String.format("Mixin classes cannot contain visible static methods or fields, found %s",
field.name));
}
@@ -568,6 +568,10 @@ public class MixinTransformer extends TreeTransformer {
MixinConfig config = mixin.getParent();
ErrorAction action = config.isRequired() ? ErrorAction.ERROR : ErrorAction.WARN;
if (MixinEnvironment.getCurrentEnvironment().getOption(Option.DEBUG_VERBOSE)) {
th.printStackTrace();
}
for (IMixinErrorHandler handler : this.getErrorHandlers(mixin.getPhase())) {
ErrorAction newAction = handler.onError(targetClassName, th, mixin, action);
if (newAction != null) {