|
2 | 2 |
|
3 | 3 | import java.io.IOError; |
4 | 4 | import java.io.IOException; |
| 5 | +import java.lang.annotation.Annotation; |
5 | 6 | import java.nio.file.Files; |
6 | 7 | import java.nio.file.Path; |
7 | 8 | import java.util.Arrays; |
|
48 | 49 | import org.jboss.jandex.DotName; |
49 | 50 | import org.jboss.jandex.IndexView; |
50 | 51 |
|
| 52 | +import com.sun.xml.bind.v2.model.annotation.Locatable; |
| 53 | + |
51 | 54 | import io.quarkus.deployment.annotations.BuildProducer; |
52 | 55 | import io.quarkus.deployment.annotations.BuildStep; |
53 | 56 | import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem; |
54 | 57 | import io.quarkus.deployment.builditem.CombinedIndexBuildItem; |
| 58 | +import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem; |
55 | 59 | import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; |
56 | 60 | import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem; |
57 | 61 | import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem; |
|
61 | 65 |
|
62 | 66 | class JaxbProcessor { |
63 | 67 |
|
64 | | - private static final List<Class<?>> JAXB_REFLECTIVE_CLASSES = Arrays.asList( |
65 | | - XmlAccessOrder.class, |
| 68 | + private static final List<Class<? extends Annotation>> JAXB_ANNOTATIONS = Arrays.asList( |
66 | 69 | XmlAccessorType.class, |
67 | 70 | XmlAnyAttribute.class, |
68 | 71 | XmlAnyElement.class, |
@@ -95,6 +98,9 @@ class JaxbProcessor { |
95 | 98 | XmlJavaTypeAdapter.class, |
96 | 99 | XmlJavaTypeAdapters.class); |
97 | 100 |
|
| 101 | + private static final List<Class<?>> JAXB_REFLECTIVE_CLASSES = Arrays.asList( |
| 102 | + XmlAccessOrder.class); |
| 103 | + |
98 | 104 | private static final List<String> JAXB_SERIALIZERS = Arrays.asList( |
99 | 105 | "html", |
100 | 106 | "text", |
@@ -123,6 +129,7 @@ class JaxbProcessor { |
123 | 129 | @BuildStep |
124 | 130 | void process(BuildProducer<NativeImageSystemPropertyBuildItem> nativeImageProps, |
125 | 131 | BuildProducer<ServiceProviderBuildItem> providerItem, |
| 132 | + BuildProducer<NativeImageProxyDefinitionBuildItem> proxyDefinitions, |
126 | 133 | CombinedIndexBuildItem combinedIndexBuildItem, |
127 | 134 | List<JaxbFileRootBuildItem> fileRoots) { |
128 | 135 |
|
@@ -176,7 +183,14 @@ void process(BuildProducer<NativeImageSystemPropertyBuildItem> nativeImageProps, |
176 | 183 |
|
177 | 184 | JAXB_REFLECTIVE_CLASSES.stream() |
178 | 185 | .map(Class::getName) |
179 | | - .forEach(clazz -> addReflectiveClass(true, false, clazz)); |
| 186 | + .forEach(className -> addReflectiveClass(true, false, className)); |
| 187 | + |
| 188 | + JAXB_ANNOTATIONS.stream() |
| 189 | + .map(Class::getName) |
| 190 | + .forEach(className -> { |
| 191 | + proxyDefinitions.produce(new NativeImageProxyDefinitionBuildItem(className, Locatable.class.getName())); |
| 192 | + addReflectiveClass(true, false, className); |
| 193 | + }); |
180 | 194 |
|
181 | 195 | JAXB_SERIALIZERS.stream() |
182 | 196 | .map(s -> "com/sun/org/apache/xml/internal/serializer/output_" + s + ".properties") |
|
0 commit comments