Skip to content

Commit e941c85

Browse files
committed
Fix #2360 Lazily create LibraryKinds
The platform started complaining about initializing these during class init, even though we use holder classes specifically for them. Using a lazy delegate should no longer trigger this warning.
1 parent 0ba6095 commit e941c85

File tree

13 files changed

+34
-31
lines changed

13 files changed

+34
-31
lines changed

src/main/kotlin/facet/MinecraftLibraryKinds.kt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ import com.demonwav.mcdev.platform.neoforge.framework.NEOFORGE_LIBRARY_KIND
3535
import com.demonwav.mcdev.platform.sponge.framework.SPONGE_LIBRARY_KIND
3636
import com.demonwav.mcdev.platform.velocity.framework.VELOCITY_LIBRARY_KIND
3737

38-
val MINECRAFT_LIBRARY_KINDS = setOf(
39-
BUKKIT_LIBRARY_KIND,
40-
SPIGOT_LIBRARY_KIND,
41-
PAPER_LIBRARY_KIND,
42-
SPONGE_LIBRARY_KIND,
43-
FORGE_LIBRARY_KIND,
44-
NEOFORGE_LIBRARY_KIND,
45-
FABRIC_LIBRARY_KIND,
46-
ARCHITECTURY_LIBRARY_KIND,
47-
MCP_LIBRARY_KIND,
48-
MIXIN_LIBRARY_KIND,
49-
BUNGEECORD_LIBRARY_KIND,
50-
WATERFALL_LIBRARY_KIND,
51-
VELOCITY_LIBRARY_KIND,
52-
ADVENTURE_LIBRARY_KIND,
53-
)
38+
val MINECRAFT_LIBRARY_KINDS by lazy {
39+
setOf(
40+
BUKKIT_LIBRARY_KIND,
41+
SPIGOT_LIBRARY_KIND,
42+
PAPER_LIBRARY_KIND,
43+
SPONGE_LIBRARY_KIND,
44+
FORGE_LIBRARY_KIND,
45+
NEOFORGE_LIBRARY_KIND,
46+
FABRIC_LIBRARY_KIND,
47+
ARCHITECTURY_LIBRARY_KIND,
48+
MCP_LIBRARY_KIND,
49+
MIXIN_LIBRARY_KIND,
50+
BUNGEECORD_LIBRARY_KIND,
51+
WATERFALL_LIBRARY_KIND,
52+
VELOCITY_LIBRARY_KIND,
53+
ADVENTURE_LIBRARY_KIND,
54+
)
55+
}

src/main/kotlin/platform/adventure/framework/AdventureLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.adventure.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val ADVENTURE_LIBRARY_KIND: LibraryKind = libraryKind("adventure-api")
26+
val ADVENTURE_LIBRARY_KIND: LibraryKind by libraryKind("adventure-api")

src/main/kotlin/platform/architectury/framework/ArchitecturyLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.architectury.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val ARCHITECTURY_LIBRARY_KIND: LibraryKind = libraryKind("architectury-api")
26+
val ARCHITECTURY_LIBRARY_KIND: LibraryKind by libraryKind("architectury-api")

src/main/kotlin/platform/bukkit/framework/BukkitLibraryKind.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ package com.demonwav.mcdev.platform.bukkit.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val BUKKIT_LIBRARY_KIND: LibraryKind = libraryKind("bukkit-api")
27-
val SPIGOT_LIBRARY_KIND: LibraryKind = libraryKind("spigot-api")
28-
val PAPER_LIBRARY_KIND: LibraryKind = libraryKind("paper-api")
26+
val BUKKIT_LIBRARY_KIND: LibraryKind by libraryKind("bukkit-api")
27+
val SPIGOT_LIBRARY_KIND: LibraryKind by libraryKind("spigot-api")
28+
val PAPER_LIBRARY_KIND: LibraryKind by libraryKind("paper-api")

src/main/kotlin/platform/bungeecord/framework/BungeeCordLibraryKind.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ package com.demonwav.mcdev.platform.bungeecord.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val BUNGEECORD_LIBRARY_KIND: LibraryKind = libraryKind("bungeecord-api")
27-
val WATERFALL_LIBRARY_KIND: LibraryKind = libraryKind("waterfall-api")
26+
val BUNGEECORD_LIBRARY_KIND: LibraryKind by libraryKind("bungeecord-api")
27+
val WATERFALL_LIBRARY_KIND: LibraryKind by libraryKind("waterfall-api")

src/main/kotlin/platform/fabric/framework/FabricLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.fabric.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val FABRIC_LIBRARY_KIND: LibraryKind = libraryKind("fabric-library")
26+
val FABRIC_LIBRARY_KIND: LibraryKind by libraryKind("fabric-library")

src/main/kotlin/platform/forge/framework/ForgeLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.forge.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val FORGE_LIBRARY_KIND: LibraryKind = libraryKind("forge-library")
26+
val FORGE_LIBRARY_KIND: LibraryKind by libraryKind("forge-library")

src/main/kotlin/platform/mcp/framework/McpLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.mcp.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val MCP_LIBRARY_KIND: LibraryKind = libraryKind("mcp-library")
26+
val MCP_LIBRARY_KIND: LibraryKind by libraryKind("mcp-library")

src/main/kotlin/platform/mixin/framework/MixinLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.mixin.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val MIXIN_LIBRARY_KIND: LibraryKind = libraryKind("mixin-library")
26+
val MIXIN_LIBRARY_KIND: LibraryKind by libraryKind("mixin-library")

src/main/kotlin/platform/neoforge/framework/NeoForgeLibraryKind.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ package com.demonwav.mcdev.platform.neoforge.framework
2323
import com.demonwav.mcdev.util.libraryKind
2424
import com.intellij.openapi.roots.libraries.LibraryKind
2525

26-
val NEOFORGE_LIBRARY_KIND: LibraryKind = libraryKind("neoforge-library")
26+
val NEOFORGE_LIBRARY_KIND: LibraryKind by libraryKind("neoforge-library")

0 commit comments

Comments
 (0)