Skip to content

Fix breaking class identity and cast issues#5

Merged
KabanFriends merged 1 commit intoIroriPowered:masterfrom
Xytronix:fix-parent-delegation
Feb 28, 2026
Merged

Fix breaking class identity and cast issues#5
KabanFriends merged 1 commit intoIroriPowered:masterfrom
Xytronix:fix-parent-delegation

Conversation

@Xytronix
Copy link
Contributor

@Xytronix Xytronix commented Feb 24, 2026

Summary

Shared runtime dependencies are delegated to the parent app classloader. Without this, Hyinit could load its own duplicate copies of ASM/SpongePowered/mixinextras classes, which breaks class identity and causes cast issues with IMixinConfigPlugin.

Also hardens plugin-class loading for malformed early plugin jars by guarding against loadLocalClass being called with a null class name. This prevents a null name from reaching getClassLoadingLock and triggering an NPE path.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (requires documentation/migration)
  • Chore / refactor
  • Documentation only

Implementation details

  • Updated HyinitClassLoader to add isParentDelegated checks in loadClass.
    • Delegates these package prefixes to the parent classloader:
      • org.objectweb.asm.
      • org.spongepowered.asm.
      • com.llamalad7.mixinextras.
    • This avoids defining duplicate copies of bundled libraries and preserves a single class identity.
  • Updated MixinPluginClassLoader with a HEAD mixin injection on loadLocalClass that:
    • Detects name == null
    • Logs a warning (HyinitLogger)
    • Returns null early
    • Avoids downstream ConcurrentHashMap.putIfAbsent null handling crash paths.
  • Key files:
    • src/main/java/cc/irori/hyinit/mixin/HyinitClassLoader.java
    • src/main/java/cc/irori/hyinit/mixin/impl/MixinPluginClassLoader.java

Checklist

  • Code compiles successfully
  • Pull request does not contain unrelated changes
  • Changes follow this project's code style (Use spotlessApply when necessary)
  • Changes are tested or will be tested after submission

Additional Info

PR required for Refixes PR associated to it.

@KabanFriends KabanFriends merged commit caa0427 into IroriPowered:master Feb 28, 2026
1 check 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