Skip to content

Commit

Permalink
Merge pull request #33466 from Sgitario/33441
Browse files Browse the repository at this point in the history
Ensure the classes to be bound in JAXB are cleared in DEV mode
  • Loading branch information
Sgitario authored May 18, 2023
2 parents 5837461 + 4a5006e commit 0e63bfc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ void bindClassesToJaxbContext(
SynthesisFinishedBuildItem beanContainerState,
JaxbContextConfigRecorder jaxbContextConfig /* Force the build time container to invoke this method */) {

jaxbContextConfig.reset();
final BeanResolver beanResolver = beanContainerState.getBeanResolver();
final Set<BeanInfo> beans = beanResolver
.resolveBeans(Type.create(DotName.createSimple(JAXBContext.class), org.jboss.jandex.Type.Kind.CLASS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public void addClassesToBeBound(Collection<Class<?>> classes) {
this.classesToBeBound.addAll(classes);
}

public void reset() {
classesToBeBound.clear();
}

public static Set<Class<?>> getClassesToBeBound() {
return Collections.unmodifiableSet(classesToBeBound);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.RequestScoped;
Expand Down Expand Up @@ -71,7 +73,7 @@ public JAXBContext createJAXBContext(Instance<JaxbContextCustomizer> customizers
customizer.customizeContextProperties(properties);
}

List<Class> classes = new ArrayList<>();
Set<Class> classes = new HashSet<>();
classes.addAll(Arrays.asList(extraClasses));
classes.addAll(JaxbContextConfigRecorder.getClassesToBeBound());

Expand Down

0 comments on commit 0e63bfc

Please sign in to comment.