Skip to content

Fix: Handle quantifiers and staticness properly when resolving Mixin target methods. - #2645

Merged
Earthcomputer merged 1 commit into
minecraft-dev:devfrom
LlamaLad7:fix/target-selector-behaviours
Sep 20, 2026
Merged

Earthcomputer merged 1 commit into
minecraft-dev:devfrom
LlamaLad7:fix/target-selector-behaviours

Conversation

@LlamaLad7

Copy link
Copy Markdown
Contributor

We should only take as many matches as is allowed, and additionally static methods should not be considered unless our handler is also static or we are trying to select exactly 1 method.

@LlamaLad7
LlamaLad7 force-pushed the fix/target-selector-behaviours branch 2 times, most recently from 40a7b6f to 0ac7c12 Compare September 20, 2026 16:00
@LlamaLad7

Copy link
Copy Markdown
Contributor Author

Test failure seems to be a flake

@LlamaLad7
LlamaLad7 force-pushed the fix/target-selector-behaviours branch from 0ac7c12 to 84b6753 Compare September 20, 2026 16:10

@Earthcomputer Earthcomputer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably also check handler.canAlwaysBeStatic

Comment thread src/main/kotlin/platform/mixin/handlers/InjectorAnnotationHandler.kt Outdated
Comment thread src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt Outdated
Comment thread src/main/kotlin/platform/mixin/reference/AbstractMethodReference.kt Outdated
…target methods.

We should only take as many matches as is allowed, and additionally static methods should not be considered unless our handler is also static or we are trying to select exactly 1 method.
@LlamaLad7
LlamaLad7 force-pushed the fix/target-selector-behaviours branch from 84b6753 to f494bde Compare September 20, 2026 20:13
@LlamaLad7

Copy link
Copy Markdown
Contributor Author

Should probably also check handler.canAlwaysBeStatic

Not sure what you mean by this

@Earthcomputer

Copy link
Copy Markdown
Member

There's a method in InjectorAnnotationHandler called canAlwaysBeStatic, it's true most of the time but can be false on stock mixin. When it's false, the handler method can't be static when the target method is also non-static

@LlamaLad7

Copy link
Copy Markdown
Contributor Author

I'm aware, but Mixin does not account for that when selecting target methods. The incorrect staticness will be flagged later by the relevant inspection (matching the error that will occur at runtime)

@Earthcomputer
Earthcomputer merged commit 739fc17 into minecraft-dev:dev Sep 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants