⁠
joe: Include much more detail in inspection descriptions
- <!--
- Minecraft Development for IntelliJ
-
- https://mcdev.io/
-
- Copyright (C) 2026 minecraft-dev
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation, version 3.0 only.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
- -->
-
- <html>
- <body>
- Reports when a mixin class is instantiated within that same class using a constructor which doesn't exist in the target class
- </body>
- </html>
- <!--
- Minecraft Development for IntelliJ
-
- https://mcdev.io/
-
- Copyright (C) 2026 minecraft-dev
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation, version 3.0 only.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>.
- -->
-
- <html>
- <body>
- <p>
- Reports when a mixin class is instantiated within that same class using a constructor which doesn't exist in the target class
- </p>
- <!-- tooltip end -->
- <p>
- A mixin class is merged into its target class, so calls to its constructors become calls to constructors of the target class.
- If the target class has no constructor with matching parameters, this fails at runtime. For example, this applies to enum
- constants added by an enum mixin. Add a <code>@Shadow</code> constructor matching a constructor in the target class.
- </p>
- <pre><code>
- enum Color {
- RED(0xFF0000);
- Color(int rgb) { ... }
- }
-
- @Mixin(Color.class)
- enum ColorMixin {
- MYMOD_PURPLE; // bad (calls implicit shadow constructor, which doesn't exist in target class)
- }
-
- @Mixin(Color.class)
- enum ColorMixin {
- MYMOD_PURPLE(0x800080); // good
-
- @Shadow
- ColorMixin(int rgb) {}
- }
- </code></pre>
- </body>
- </html>