Skip to content

Add error/warning for calling an interface injection method without an implementation #2539

@Earthcomputer

Description

@Earthcomputer

Minecraft Development for IntelliJ plugin version

2025.2-1.8.6

Description of the feature request

Interface injection has a problem where if javac can't find the implementation of the method it is calling at compile time, and the owner of the method isn't abstract, then a compile error is generated. The IDE does not pick up this error, so users only discover it at runtime and are often confused about how to solve it. For example:

public class Item implements /*injected*/ MyItemInterface {
   // ...
}

public interface MyItemInterface {
   void foo(); // no default method impl
}

@Mixin(Item.class)
public class ItemMixin implements MyItemInterface {
   @Override
   public void foo() {
      // method is implemented in mixin
   }
}
Item item = ...;
item.foo(); // generates a compile error in javac, but the IDE does not pick it up

Even though no crash would happen at runtime, javac cannot detect that the foo method is in fact implemented by the mixin. Note that this would not occur if the Item class was abstract, as this disables javac's check for whether the method implementation exists.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions