Can I handle jaxb annotations at compile time?

I am experimenting to see if I can somehow get JAXB to work on Android in a limited scenario. (using other libraries is not an option).

I got pretty far, but at the moment I'm stuck getting the next stack trace, probably because Dalvik doesn't allow this.

E/AndroidRuntime( 643): java.lang.UnsatisfiedLinkError: getDeclaredAnnotations E/AndroidRuntime( 643): at java.lang.Package.getDeclaredAnnotations(Native Method) E/AndroidRuntime( 643): at java.lang.Package.getAnnotations(Package.java:97) E/AndroidRuntime( 643): at java.lang.Package.getAnnotation(Package.java:80) E/AndroidRuntime( 643): at com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getPackageAnnotation(RuntimeInlineAnnotationReader.java:129) 

I took care to remove all package level annotations and into my JAXB context with a specific class that I annotated for JAXB:

 JAXBContext jaxb_context = JAXBContext.newInstance(Num.class); 

Can I get JAXB to do all its detection at compile time, and not at run time? (just like DataNucleus can handle JPA annotations at compile time)

+4
source share

Source: https://habr.com/ru/post/1387545/


All Articles