JSON: Cannot override default class information
When JSON serializer is used to serialize a class that comes as bytecode only is not possible to put annotations on it: defaults from ClassInformation are applied for visibility.
Could having configurable defaults defined in JsonSerializerContext or a user configurable ClassInformationProvider be a reasonable solution?
This is impossible to have configurable defaults since all serializers and deserializers are generated in compile time, and thus all rules applied and resolved during compile time.
You can annotations to the classes by instrumentation. You can use either javaagent + ASM which is standard for JVM, or write a TeaVM plugin and add ClassHolderTransformer from there. Note that when you implement your own plugin (i.e. implement TeaVMPlugin interface), you should apply service loader convention (i.e. META-INF/services).
Another solution would be to add ability to add compiler plugins to Flavour that can customize default rules.
I solved the problem by using a TeaVM plugin on top of https://github.com/konsoletyper/teavm-flavour/pull/17.