Skip to content

Commit

Permalink
Merge branch '2023.3' into 2024.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Earthcomputer committed Apr 4, 2024
2 parents 976ecd1 + 280aca1 commit 3e005a6
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 94 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr_check_target_branch.yml
Expand Up @@ -13,7 +13,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target: /\b(?!dev\b).*?\b/
target: /\d+\.\d/
exclude: dev
change-to: dev
already-exists-action: nothing
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -24,7 +24,7 @@ kotlin.code.style=official
ideaVersion = 2024.1
ideaVersionName = 2024.1

coreVersion = 1.7.3
coreVersion = 1.7.4
downloadIdeaSources = true

pluginTomlVersion = 241.14494.150
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -35,7 +35,7 @@ Minecraft Development for IntelliJ
</tr>
</table>

Info and Documentation [![Current Release](https://img.shields.io/badge/release-1.7.0-orange.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/8327)
Info and Documentation [![Current Release](https://img.shields.io/badge/release-1.7.4-orange.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/8327)
----------------------

<a href="https://discord.gg/j6UNcfr"><img src="https://i.imgur.com/JXu9C1G.png" height="48px"></img></a>
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/creator/MinecraftModuleBuilder.kt
Expand Up @@ -25,7 +25,6 @@ import com.demonwav.mcdev.asset.PlatformAssets
import com.demonwav.mcdev.creator.buildsystem.BuildSystemPropertiesStep
import com.demonwav.mcdev.creator.platformtype.PlatformTypeStep
import com.demonwav.mcdev.creator.step.NewProjectWizardChainStep.Companion.nextStep
import com.demonwav.mcdev.creator.step.TemplateOutdatedStep
import com.intellij.ide.projectWizard.ProjectSettingsStep
import com.intellij.ide.util.projectWizard.WizardContext
import com.intellij.ide.wizard.AbstractNewProjectWizardBuilder
Expand Down Expand Up @@ -58,7 +57,6 @@ class MinecraftModuleBuilder : AbstractNewProjectWizardBuilder() {
.nextStep(PlatformTypeStep::create)
.nextStep(::BuildSystemPropertiesStep)
.nextStep(::ProjectSetupFinalizerWizardStep)
.nextStep(::TemplateOutdatedStep)

override fun getIgnoredSteps() = listOf(ProjectSettingsStep::class.java)
}
49 changes: 0 additions & 49 deletions src/main/kotlin/creator/step/TemplateOutdatedStep.kt

This file was deleted.

29 changes: 0 additions & 29 deletions src/main/kotlin/platform/fabric/util/fabric-util.kt

This file was deleted.

Expand Up @@ -20,12 +20,12 @@

package com.demonwav.mcdev.platform.mixin.handlers.injectionPoint

import com.demonwav.mcdev.platform.fabric.util.isFabric
import com.demonwav.mcdev.platform.mixin.inspection.injector.CtorHeadNoUnsafeInspection
import com.demonwav.mcdev.platform.mixin.reference.MixinSelector
import com.demonwav.mcdev.platform.mixin.util.findOrConstructSourceMethod
import com.demonwav.mcdev.platform.mixin.util.findSuperConstructorCall
import com.demonwav.mcdev.platform.mixin.util.isConstructor
import com.demonwav.mcdev.platform.mixin.util.isFabricMixin
import com.demonwav.mcdev.util.createLiteralExpression
import com.demonwav.mcdev.util.enumValueOfOrNull
import com.demonwav.mcdev.util.findContainingClass
Expand Down Expand Up @@ -67,7 +67,7 @@ class CtorHeadInjectionPoint : InjectionPoint<PsiElement>() {
// avoid adding unsafe = true when it's unnecessary on Fabric
val noUnsafeInspection =
project.findInspection<CtorHeadNoUnsafeInspection>(CtorHeadNoUnsafeInspection.SHORT_NAME)
if (reference.isFabric && noUnsafeInspection?.ignoreForFabric == true) {
if (reference.isFabricMixin && noUnsafeInspection?.ignoreForFabric == true) {
return
}

Expand Down
Expand Up @@ -20,10 +20,10 @@

package com.demonwav.mcdev.platform.mixin.inspection.injector

import com.demonwav.mcdev.platform.fabric.util.isFabric
import com.demonwav.mcdev.platform.mixin.inspection.MixinInspection
import com.demonwav.mcdev.platform.mixin.inspection.fix.AnnotationAttributeFix
import com.demonwav.mcdev.platform.mixin.util.MixinConstants
import com.demonwav.mcdev.platform.mixin.util.isFabricMixin
import com.demonwav.mcdev.util.constantStringValue
import com.demonwav.mcdev.util.constantValue
import com.intellij.codeInspection.ProblemsHolder
Expand All @@ -41,7 +41,7 @@ class CtorHeadNoUnsafeInspection : MixinInspection() {

override fun createOptionsPanel(): JComponent {
val panel = JPanel(FlowLayout(FlowLayout.LEFT))
val checkbox = JCheckBox("Ignore in Fabric mods", ignoreForFabric)
val checkbox = JCheckBox("Ignore when Fabric Mixin is present", ignoreForFabric)
checkbox.addActionListener {
ignoreForFabric = checkbox.isSelected
}
Expand All @@ -53,7 +53,7 @@ class CtorHeadNoUnsafeInspection : MixinInspection() {

override fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor {
if (ignoreForFabric) {
val isFabric = holder.file.isFabric
val isFabric = holder.file.isFabricMixin
if (isFabric) {
return PsiElementVisitor.EMPTY_VISITOR
}
Expand Down
Expand Up @@ -20,7 +20,6 @@

package com.demonwav.mcdev.platform.mixin.inspection.injector

import com.demonwav.mcdev.platform.fabric.util.isFabric
import com.demonwav.mcdev.platform.mixin.handlers.InjectorAnnotationHandler
import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler
import com.demonwav.mcdev.platform.mixin.handlers.injectionPoint.AtResolver
Expand All @@ -30,6 +29,7 @@ import com.demonwav.mcdev.platform.mixin.util.MethodTargetMember
import com.demonwav.mcdev.platform.mixin.util.MixinConstants.Annotations.INJECT
import com.demonwav.mcdev.platform.mixin.util.findSuperConstructorCall
import com.demonwav.mcdev.platform.mixin.util.isConstructor
import com.demonwav.mcdev.platform.mixin.util.isFabricMixin
import com.demonwav.mcdev.util.constantValue
import com.demonwav.mcdev.util.findAnnotation
import com.demonwav.mcdev.util.findAnnotations
Expand All @@ -50,7 +50,7 @@ class InjectIntoConstructorInspection : MixinInspection() {

override fun createOptionsPanel(): JComponent {
val panel = JPanel(FlowLayout(FlowLayout.LEFT))
val checkbox = JCheckBox("Always allow @Inject into constructors in Fabric", allowOnFabric)
val checkbox = JCheckBox("Allow @Inject into constructors when Fabric Mixin is present", allowOnFabric)
checkbox.addActionListener {
allowOnFabric = checkbox.isSelected
}
Expand All @@ -59,7 +59,7 @@ class InjectIntoConstructorInspection : MixinInspection() {
}

override fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor {
val isFabric = holder.file.isFabric
val isFabric = holder.file.isFabricMixin
return object : JavaElementVisitor() {
override fun visitMethod(method: PsiMethod) {
val injectAnnotation = method.findAnnotation(INJECT) ?: return
Expand Down
Expand Up @@ -20,14 +20,14 @@

package com.demonwav.mcdev.platform.mixin.inspection.injector

import com.demonwav.mcdev.platform.fabric.util.isFabric
import com.demonwav.mcdev.platform.mixin.handlers.MixinAnnotationHandler
import com.demonwav.mcdev.platform.mixin.handlers.injectionPoint.AtResolver
import com.demonwav.mcdev.platform.mixin.inspection.MixinInspection
import com.demonwav.mcdev.platform.mixin.inspection.fix.AnnotationAttributeFix
import com.demonwav.mcdev.platform.mixin.util.MethodTargetMember
import com.demonwav.mcdev.platform.mixin.util.MixinConstants
import com.demonwav.mcdev.platform.mixin.util.isConstructor
import com.demonwav.mcdev.platform.mixin.util.isFabricMixin
import com.demonwav.mcdev.util.constantValue
import com.demonwav.mcdev.util.findInspection
import com.demonwav.mcdev.util.ifEmpty
Expand All @@ -49,7 +49,7 @@ class UnnecessaryUnsafeInspection : MixinInspection() {

override fun createOptionsPanel(): JComponent {
val panel = JPanel(FlowLayout(FlowLayout.LEFT))
val checkbox = JCheckBox("Always unnecessary in Fabric mods", alwaysUnnecessaryOnFabric)
val checkbox = JCheckBox("Always unnecessary when Fabric Mixin is present", alwaysUnnecessaryOnFabric)
checkbox.addActionListener {
alwaysUnnecessaryOnFabric = checkbox.isSelected
}
Expand All @@ -58,7 +58,7 @@ class UnnecessaryUnsafeInspection : MixinInspection() {
}

override fun buildVisitor(holder: ProblemsHolder): PsiElementVisitor {
val isFabric = holder.file.isFabric
val isFabric = holder.file.isFabricMixin
val alwaysUnnecessary = isFabric && alwaysUnnecessaryOnFabric
val requiresUnsafeForCtorHeadOnFabric =
holder.project.findInspection<CtorHeadNoUnsafeInspection>(CtorHeadNoUnsafeInspection.SHORT_NAME)
Expand Down
Expand Up @@ -105,6 +105,11 @@ class ShadowModifiersInspection : MixinInspection() {
return
}

// @Final annotation doesn't apply to members that are initialized in the mixin class
if (member.hasInitializer()) {
return
}

// Check @Final
val targetFinal = (target.access and Opcodes.ACC_FINAL) != 0
val shadowFinal = shadowModifierList.findAnnotation(FINAL)
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/platform/mixin/util/Mixin.kt
Expand Up @@ -234,3 +234,6 @@ fun isMixinEntryPoint(element: PsiElement?): Boolean {
}
return false
}

val PsiElement.isFabricMixin: Boolean get() =
JavaPsiFacade.getInstance(project).findClass(MixinConstants.Classes.FABRIC_UTIL, resolveScope) != null
2 changes: 2 additions & 0 deletions src/main/kotlin/platform/mixin/util/MixinConstants.kt
Expand Up @@ -47,6 +47,8 @@ object MixinConstants {

const val SERIALIZED_NAME = "com.google.gson.annotations.SerializedName"
const val MIXIN_SERIALIZED_NAME = "org.spongepowered.include.$SERIALIZED_NAME"

const val FABRIC_UTIL = "org.spongepowered.asm.mixin.FabricUtil"
}

object Annotations {
Expand Down

0 comments on commit 3e005a6

Please sign in to comment.