diff --git a/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixin.java b/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixin.java index 9261fa91..27a50530 100644 --- a/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixin.java +++ b/src/ap/java/org/spongepowered/tools/obfuscation/AnnotatedMixin.java @@ -215,21 +215,22 @@ class AnnotatedMixin { // Private targets, referenced by name try { - for (String privateTarget : this.annotation.getList("targets")) { - TypeHandle type = this.typeProvider.getTypeHandle(privateTarget); + for (String softTarget : this.annotation.getList("targets")) { + TypeHandle type = this.typeProvider.getTypeHandle(softTarget); if (this.targets.contains(type)) { continue; } if (this.virtual) { - type = this.typeProvider.getSimulatedHandle(privateTarget, this.mixin.asType()); + type = this.typeProvider.getSimulatedHandle(softTarget, this.mixin.asType()); } else if (type == null) { - this.printMessage(Kind.ERROR, "Mixin target " + privateTarget + " could not be found", this); + this.printMessage(Kind.ERROR, "Mixin target " + softTarget + " could not be found", this); return null; } else if (type.isPublic()) { - this.printMessage(Kind.WARNING, "Mixin target " + privateTarget + " is public and must be specified in value", this); + SuppressedBy suppressedBy = (type.getPackage().isUnnamed()) ? SuppressedBy.DEFAULT_PACKAGE : null; + this.printMessage(Kind.WARNING, "Mixin target " + softTarget + " is public and must be specified in value", this, suppressedBy); return null; } - this.addSoftTarget(type, privateTarget); + this.addSoftTarget(type, softTarget); if (primaryTarget == null) { primaryTarget = type; } @@ -251,6 +252,13 @@ class AnnotatedMixin { private void printMessage(Kind kind, CharSequence msg, AnnotatedMixin mixin) { this.messager.printMessage(kind, msg, this.mixin, this.annotation.asMirror()); } + + /** + * Print a suppressible message to the AP messager + */ + private void printMessage(Kind kind, CharSequence msg, AnnotatedMixin mixin, SuppressedBy suppressedBy) { + this.messager.printMessage(kind, msg, this.mixin, this.annotation.asMirror(), suppressedBy); + } private void addSoftTarget(TypeHandle type, String reference) { ObfuscationData obfClassData = this.obf.getDataProvider().getObfClass(type); diff --git a/src/ap/java/org/spongepowered/tools/obfuscation/SuppressedBy.java b/src/ap/java/org/spongepowered/tools/obfuscation/SuppressedBy.java index 8fdcc74d..b16f75d4 100644 --- a/src/ap/java/org/spongepowered/tools/obfuscation/SuppressedBy.java +++ b/src/ap/java/org/spongepowered/tools/obfuscation/SuppressedBy.java @@ -43,7 +43,7 @@ public enum SuppressedBy { VISIBILITY("visibility"), /** - * Suppress warnings when an injector target cannot be found + * Suppress warnings when an injector target cannot be found */ TARGET("target"), @@ -56,7 +56,13 @@ public enum SuppressedBy { * Suppress warnings for when an @Overwrite method is missing * javadoc, or author or reason tags */ - OVERWRITE("overwrite"); + OVERWRITE("overwrite"), + + /** + * Suppress warnings when a mixin target specified by name is located in the + * default package + */ + DEFAULT_PACKAGE("default-package"); private final String token;