Try warning for likely failed interface shadows (#71)

If a final field has a constant primitive value, said value will probably be used rather than referencing the shadowed field
This commit is contained in:
Chocohead authored and GitHub committed 2021-10-28 22:18:43 +01:00
1 parent 8e78d31487
commit a63d9f6fda
1 file changed
+5
@@ -81,6 +81,11 @@ class MixinApplicatorInterface extends MixinApplicatorStandard {
if (entry.getValue().isDecoratedMutable()) {
this.logger.error("Ignoring illegal @Mutable on {}:{} in {}", shadow.name, shadow.desc, mixin);
}
//If a final field has a primitive value assigned with the declaration, the value is likely inlined where the field is used
if (shadow.value != null) {
this.logger.warn("@Shadow field {}:{} in {} has an inlinable value set, is this intended?", shadow.name, shadow.desc, mixin);
}
} else {
//This is silently ignored for normal classes, but the only fields an interface has will be shadowed
this.logger.warn("Unable to find target for @Shadow {}:{} in {}", shadow.name, shadow.desc, mixin);