Repository navigation
fix(native): register every jsbml tree node for reflection (0.0.24) - #31
Merged
Merged
Conversation
jsbml's AbstractTreeNode.toString() reflects over a node's isSet*/get*/set* methods and fields, and jsbml calls it while formatting debug messages even when debug logging is off: XMLNodeReader.processNamespace formats its context object, an Annotation, whenever <annotation> declares a namespace. The native library only had what MainRecorder's run reached, so sbml_to_vcml failed with MissingReflectionRegistrationError for Annotation.isSetAbout() on such models (BioModels 56, 94, 150, 168, 169, 192 in compose-api's biomodels-curated-300). A checked-in reachability-metadata.json, generated by scripts/JsbmlReflection.java from the jsbml jar, registers the declared and public methods and declared fields of all 127 jsbml tree node classes, and the native build reads it with the recording. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In compose-api's
biomodels-curated-300run 3, six models failed insbml_to_vcmlwith this error:The models were BIOMD 56, 94, 150, 168, 169 and 192. The stack trace runs through
SBMLReader→XMLNodeReader.processNamespace→MessageFormat.format→AbstractTreeNode.toString.jsbml formats its debug messages eagerly, even when debug logging is off. When
<annotation>declares a namespace, the message's context object is theAnnotation.AbstractTreeNode.toString()then reflects over itsisSet*/get*/set*methods and fields. The native image only registers whatMainRecorder's run reaches, and its models never take that path.What
vcell-native/src/main/native-image/jsbml/reachability-metadata.jsonregistersallDeclaredMethods,allPublicMethodsandallDeclaredFieldsfor every jsbml tree node class, 127 of them, core and spatial.scripts/JsbmlReflection.javawrites the file from the jsbml jar. Regenerate it when the jsbml version changes.-H:ConfigurationFileDirectories=target/recording,src/main/native-image/jsbml).test_sbml_to_vcml_with_an_annotation_namespaceis a 10-line model with<annotation xmlns:jd=…>. It fails on 0.0.23 with the error above.Checked (macOS arm64, GraalVM 23.0.2)
pytest tests: 26 passed, 4 skipped.🤖 Generated with Claude Code