From b7f020a82a3fe124ed781cff6609569404630d56 Mon Sep 17 00:00:00 2001 From: Vaadin Bot Date: Mon, 27 May 2024 09:58:24 +0200 Subject: [PATCH] fix: add missing hints to fix native compilation (#19455) (#19457) * fix: add missing hints for native compilation Add hints to register 'System' class methods for native image to allow javax.imageio.ImageIO to be detected as used at runtime. Fixes #19405 * fix: add missing native hints for LoginI18n.Header Fixes #19405 Co-authored-by: Marco Collovati --- .../VaadinBeanFactoryInitializationAotProcessor.java | 3 +++ .../vaadin/flow/spring/springnative/VaadinHintsRegistrar.java | 1 + 2 files changed, 4 insertions(+) diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinBeanFactoryInitializationAotProcessor.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinBeanFactoryInitializationAotProcessor.java index ec3fd55dbc7..dba96e90138 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinBeanFactoryInitializationAotProcessor.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinBeanFactoryInitializationAotProcessor.java @@ -80,6 +80,9 @@ public BeanFactoryInitializationAotContribution processAheadOfTime( hasPWA = hasPWA || c.getAnnotation(PWA.class) != null; } if (hasPWA) { + hints.jni().registerType( + TypeReference.of("java.lang.System"), + MemberCategory.INVOKE_PUBLIC_METHODS); for (String cls : getJNIClassesForPWA()) { hints.jni().registerType(TypeReference.of(cls), MemberCategory.values()); diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinHintsRegistrar.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinHintsRegistrar.java index 4c6ebc3c174..b140f4d3ce2 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinHintsRegistrar.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/springnative/VaadinHintsRegistrar.java @@ -56,6 +56,7 @@ private void registerResourceIfPresent(RuntimeHints hints, String path) { // to ease testing private String[] getCommonComponentClasses() { return new String[] { "com.vaadin.flow.component.login.LoginI18n", + "com.vaadin.flow.component.login.LoginI18n$Header", "com.vaadin.flow.component.login.LoginI18n$Form", "com.vaadin.flow.component.login.LoginI18n$ErrorMessage", "com.vaadin.flow.component.messages.MessageListItem" };