From 61b65e3b755c03672386fdebca024f3054d6838d Mon Sep 17 00:00:00 2001 From: melloware Date: Thu, 24 Oct 2024 14:26:29 -0400 Subject: [PATCH] Fix #264: Models marked for serialization --- .../deployment/PrimeFacesProcessor.java | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/quarkus-primefaces/deployment/src/main/java/io/quarkiverse/primefaces/deployment/PrimeFacesProcessor.java b/quarkus-primefaces/deployment/src/main/java/io/quarkiverse/primefaces/deployment/PrimeFacesProcessor.java index 3dfee94..4483094 100644 --- a/quarkus-primefaces/deployment/src/main/java/io/quarkiverse/primefaces/deployment/PrimeFacesProcessor.java +++ b/quarkus-primefaces/deployment/src/main/java/io/quarkiverse/primefaces/deployment/PrimeFacesProcessor.java @@ -131,20 +131,12 @@ void registerForReflection(PrimeFacesRecorder recorder, BuildProducer models = collectClassesInPackage(combinedIndex, "org.primefaces.model"); - models.remove(CommonsUploadedFile.class.getName()); - classNames.addAll(models); - // components that need special treatment classNames.add(org.primefaces.component.fileupload.NativeFileUploadDecoder.class.getName()); classNames.add(org.primefaces.application.exceptionhandler.ExceptionInfo.class.getName()); classNames.add(org.primefaces.component.organigram.OrganigramHelper.class.getName()); classNames.addAll(collectImplementors(combinedIndex, PropertyDescriptorResolver.class.getName())); - // Chart XDev models - classNames.addAll(collectClassesInPackage(combinedIndex, "software.xdev.chartjs.model")); - // Exporters classNames.addAll(collectImplementors(combinedIndex, org.primefaces.component.export.Exporter.class.getName())); classNames.addAll(collectImplementors(combinedIndex, org.primefaces.component.export.ExporterOptions.class.getName())); @@ -158,6 +150,27 @@ void registerForReflection(PrimeFacesRecorder recorder, BuildProducer reflectiveClass, + CombinedIndexBuildItem combinedIndex) { + // All models + final List models = collectClassesInPackage(combinedIndex, "org.primefaces.model"); + models.remove(CommonsUploadedFile.class.getName()); + final List classNames = new ArrayList<>(models); + + // Chart XDev models + classNames.addAll(collectClassesInPackage(combinedIndex, "software.xdev.chartjs.model")); + + // PrimeFaces + classNames.add(org.primefaces.component.api.SavedState.class.getName()); + classNames.add(org.primefaces.component.api.UITableState.class.getName()); + + // serialization reflection + reflectiveClass.produce( + ReflectiveClassBuildItem.builder(classNames.toArray(new String[0])).methods().fields().serialization().build()); + } + // TODO: Remove after MyFaces 4.0.3 @BuildStep void temporaryMyFacesStuff(BuildProducer additionalBean, @@ -175,9 +188,20 @@ void temporaryMyFacesStuff(BuildProducer additionalBean // TODO: remove in MyFaces 4.0.3 reflectiveClass.produce(ReflectiveClassBuildItem - .builder("org.apache.myfaces.view.facelets.component.RepeatStatus", "org.apache.myfaces.push.EndpointImpl") - .methods(true).fields(true).build()); - + .builder("org.apache.myfaces.view.facelets.component.RepeatStatus", + "org.apache.myfaces.push.EndpointImpl", + "jakarta.faces.component._AttachedStateWrapper", + "jakarta.faces.component._DeltaStateHelper", + "jakarta.faces.component._DeltaStateHelper$InternalMap", + "jakarta.faces.context._MyFacesExternalContextHelper", + "jakarta.faces.component._AttachedDeltaWrapper", + "java.util.Collections$EmptySet", + java.lang.StringBuilder.class.getName(), + jakarta.el.Expression.class.getName(), + jakarta.el.ValueExpression.class.getName(), + jakarta.faces.view.Location.class.getName(), + org.apache.myfaces.view.facelets.tag.faces.FaceletState.class.getName()) + .methods().fields().serialization().build()); } @BuildStep