From 41fd9d769259a678d82979b53a1f06119bbc16fe Mon Sep 17 00:00:00 2001 From: Vaadin Bot Date: Fri, 26 Jul 2024 12:32:51 +0200 Subject: [PATCH] chore: log class causing failure in frontend dependency scan (#19721) (#19725) Wraps the annotation finder function to log potential errors during class scanning and the class that originates the failure. References #19616 Co-authored-by: Marco Collovati --- .../frontend/scanner/FullDependenciesScanner.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flow-server/src/main/java/com/vaadin/flow/server/frontend/scanner/FullDependenciesScanner.java b/flow-server/src/main/java/com/vaadin/flow/server/frontend/scanner/FullDependenciesScanner.java index b810bb9d029..141856ac40c 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/frontend/scanner/FullDependenciesScanner.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/frontend/scanner/FullDependenciesScanner.java @@ -111,7 +111,17 @@ class FullDependenciesScanner extends AbstractDependenciesScanner { super(finder, featureFlags); long start = System.currentTimeMillis(); - this.annotationFinder = annotationFinder; + // Wraps the finder function to provide debugging information in case of + // failures + this.annotationFinder = (clazz, loadedAnnotation) -> { + try { + return annotationFinder.apply(clazz, loadedAnnotation); + } catch (RuntimeException exception) { + getLogger().error("Could not read {} annotation from class {}.", + loadedAnnotation.getName(), clazz.getName(), exception); + throw exception; + } + }; try { abstractTheme = finder.loadClass(AbstractTheme.class.getName());