Skip to content

Commit

Permalink
Add testmod mixin for loading non-existent class with failing annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Moulberry committed Mar 4, 2025
1 parent 516fb55 commit 7216691
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.moulberry.mixinconstraints.testmod.mixin;

import com.moulberry.mixinconstraints.annotations.IfModLoaded;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;

@IfModLoaded("doesntexist")
@Mixin(targets = "com.doesnt.exist.Main")
@Pseudo
public class TestMixinIntoNonExistentClass {

/*
* Without the annotation there would be an error message in the logs like:
* Error loading class: com/doesnt/exist/Main (java.lang.ClassNotFoundException: com/doesnt/exist/Main)
*
* This is undesirable, so the @IfModLoaded annotation should prevent the loading early enough for this message to not appear
*/

}
1 change: 1 addition & 0 deletions testmod/src/main/resources/testmod.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"plugin": "com.moulberry.mixinconstraints.ConstraintsMixinPlugin",
"compatibilityLevel": "JAVA_8",
"mixins": [
"TestMixinIntoNonExistentClass"
],
"client": [
"ExampleMixin",
Expand Down

0 comments on commit 7216691

Please sign in to comment.