File Details
ClassJS v0.1-alpha.6
- A
- Dec 27, 2025
- 207.96 KB
- 2.5K
- 1.20.1
- Forge
File Name
classjs-1.20.1-0.1-alpha.6.jar
Supported Versions
- 1.20.1
Curse Maven Snippet
New Features
annotatedUse
annotatedonClassCreator,MethodCreator, orFieldCreatorto add annotations on them.let test = ClassCreator.create("AnnotationTest") .toPublic() .defaultConstructor() .annotated("java.lang.Deprecated") .build() .createField("testField", "int") .toPublic().toStatic() .annotated("java.lang.Deprecated") .withString("since", "1230912-39") .build() .build() .createMethod("test", [], "void") .toPublic().toStatic() .annotated("java.lang.Deprecated") .withBoolean("forRemoval", true) .build() .annotated("dev.latvian.mods.kubejs.typings.Info") .withString("value", "method") .withAnnotationArray("params", "dev.latvian.mods.kubejs.typings.Param", [ a => a.withString("value", "AAA"), a => a.withString("value", "BBB"), ]) .build() .codeJS(() => console.info("TEST METHOD")) .defineClass(); console.info(test.__javaObject__.getMethods()[0].getAnnotations()); // Output in startup.log: // [@java.lang.Deprecated(forRemoval=true, since=""), @dev.latvian.mods.kubejs.typings.Info(params={@dev.latvian.mods.kubejs.typings.Param(name="", value="AAA"), @dev.latvian.mods.kubejs.typings.Param(name="", value="BBB")}, value="method")] [java.util.ArrayList] console.info(test.__javaObject__.getFields()[0].getAnnotations()); // Output in startup.log: // [@java.lang.Deprecated(forRemoval=false, since="1230912-39")] [java.util.ArrayList]
ClassCreator.createAnnotationMethod- Add an anntation method to an
@interfaceclass. - There is possibly some bug, so currently no example is provided.
- Add an anntation method to an
Fixed Bug
- Could not
invokeJSwhen parameter list is empty.