⁠
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>
- @Inject into Constructor
- </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>
- <code>@Inject</code> into Constructor
- </p>
- <!-- tooltip end -->
- <p>
- Reports <code>@Inject</code> injectors that inject into a constructor at an instruction other than <code>RETURN</code>,
- without <code>unsafe = true</code>.
- </p>
- <p>
- Sponge Mixin only allows <code>@Inject</code> into constructors at <code>RETURN</code> by default, because injecting earlier
- risks running code before the object is initialized. Fabric's version of Mixin doesn't have this restriction, so by default
- it is allowed when Fabric Mixin is present.
- </p>
- <pre><code>
- @Inject(method = "<init>", at = @At(value = "INVOKE", target = "...")) // bad
- @Inject(method = "<init>", at = @At(value = "INVOKE", target = "...", unsafe = true)) // good
- @Inject(method = "<init>", at = @At("RETURN")) // good
- </code></pre>
- </body>
- </html>