Skip to content

@ModifyConstant with boolean return value incorrectly gets reported as an error #2258

@ErrorCraft

Description

@ErrorCraft

Minecraft Development for IntelliJ plugin version

2023.2.2-1.7.3

IntelliJ version

IntelliJ IDEA 2023.2.6 (Community Edition)

Operating System

Windows 10

Target platform

Mixins

Description of the bug

A @ModifyConstant with a boolean return value can be used to replace an instanceof check with some other check, but it gets incorrectly reported as two errors: one for the Class return type, and one for the method parameters, the latter being #2231. However, it works just fine and replaces the instanceof check as expected.

Reproducable mixin (yarn mappings):

@Mixin(ArmorFeatureRenderer.class)
public class ArmorFeatureRendererMixin {
    @ModifyConstant(
        method = "renderArmor",
        constant = @Constant(
            classValue = ArmorItem.class,
            ordinal = 0
        )
    )
    private boolean instanceOfArmorItemDoWhatever(Object reference, Class<ArmorItem> clazz) {
        return false;
    }
}

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