Skip to content

Commit

Permalink
Fix #264: Models marked for serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 24, 2024
1 parent 5f99b7e commit e9300bf
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,12 @@ void registerForReflection(PrimeFacesRecorder recorder, BuildProducer<Reflective
org.primefaces.util.SecurityUtils.class.getName(),
PropertyDescriptorResolver.DefaultResolver.class.getName()));

// All models
List<String> 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()));
Expand All @@ -158,6 +150,23 @@ void registerForReflection(PrimeFacesRecorder recorder, BuildProducer<Reflective
ReflectiveClassBuildItem.builder(org.primefaces.config.PrimeEnvironment.class.getName()).build());
}

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void registerForSerialization(PrimeFacesRecorder recorder, BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem combinedIndex) {
// All models
final List<String> models = collectClassesInPackage(combinedIndex, "org.primefaces.model");
models.remove(CommonsUploadedFile.class.getName());
final List<String> classNames = new ArrayList<>(models);

// Chart XDev models
classNames.addAll(collectClassesInPackage(combinedIndex, "software.xdev.chartjs.model"));

// 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<AdditionalBeanBuildItem> additionalBean,
Expand Down

0 comments on commit e9300bf

Please sign in to comment.