aboutsummaryrefslogtreecommitdiffstats
path: root/pf4j/src/main/java
diff options
context:
space:
mode:
authorMichael Rittmeister <dr@schlau.bi>2024-11-11 22:20:34 +0100
committerGitHub <noreply@github.com>2024-11-11 23:20:34 +0200
commit3ff696d1a9b529348e186fe187a015c8075545e3 (patch)
tree19a615c5a83b43131b8e2c3189ac16a59a203f7f /pf4j/src/main/java
parent1493fd706b0215ee057cfc1952ecb09ee047f499 (diff)
downloadpf4j-3ff696d1a9b529348e186fe187a015c8075545e3.tar.gz
pf4j-3ff696d1a9b529348e186fe187a015c8075545e3.zip
Fix StackOverFlow error on Kotlin classes without @Extension (#595)
Diffstat (limited to 'pf4j/src/main/java')
-rw-r--r--pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java b/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java
index 59488ba..caa415f 100644
--- a/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java
+++ b/pf4j/src/main/java/org/pf4j/AbstractExtensionFinder.java
@@ -358,7 +358,12 @@ public abstract class AbstractExtensionFinder implements ExtensionFinder, Plugin
// search recursively through all annotations
for (Annotation annotation : clazz.getAnnotations()) {
Class<? extends Annotation> annotationClass = annotation.annotationType();
- if (!annotationClass.getName().startsWith("java.lang.annotation")) {
+ if (!annotationClass.getName().startsWith("java.lang.annotation") && !annotationClass.getName().startsWith("kotlin")) {
+ // In case an annotation is annotated with itself,
+ // an example would be @Target, which is ignored by the check above
+ // however, other libraries might do similar things
+ if (annotationClass.equals(clazz)) continue;
+
Extension extensionAnnotation = findExtensionAnnotation(annotationClass);
if (extensionAnnotation != null) {
return extensionAnnotation;