streamthoughts/azkarra-streams

StackOverflow while using kotlin, kotlin.metadata annotation problem

sebastian-ziegler opened this issue · 1 comments

Hello,

With the latest changes in version 0.7.4 with the annotation processing, I am getting an StackOverflow error thanks to the recursive processing of annotations, apparently there is a bug if you use Kotlin and Azkarra since Kotlin automatically adds to every generated class an annotation for adding metadata.

[main] INFO io.streamthoughts.azkarra.runtime.context.DefaultAzkarraContext - Adding all registered topologies to declared streams environments
Exception in thread "main" java.lang.StackOverflowError
	at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:751)
	at java.base/java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:749)
	at java.base/sun.reflect.annotation.AnnotationInvocationHandler.hashCodeImpl(AnnotationInvocationHandler.java:537)
	at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:74)
	at com.sun.proxy.$Proxy7.hashCode(Unknown Source)
	at java.base/java.util.HashMap.hash(HashMap.java:339)
	at java.base/java.util.HashMap.put(HashMap.java:607)
	at java.base/java.util.HashSet.add(HashSet.java:220)
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at io.streamthoughts.azkarra.api.util.ClassUtils.getAllDeclaredAnnotationsByType(ClassUtils.java:101)
	at io.streamthoughts.azkarra.api.util.ClassUtils.lambda$getAllDeclaredAnnotationsByType$1(ClassUtils.java:103)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.streamthoughts.azkarra.api.util.ClassUtils.getAllDeclaredAnnotationsByType(ClassUtils.java:102)
	at io.streamthoughts.azkarra.api.util.ClassUtils.lambda$getAllDeclaredAnnotationsByType$1(ClassUtils.java:103)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.streamthoughts.azkarra.api.util.ClassUtils.getAllDeclaredAnnotationsByType(ClassUtils.java:102)
	at io.streamthoughts.azkarra.api.util.ClassUtils.lambda$getAllDeclaredAnnotationsByType$1(ClassUtils.java:103)
...
continues and keeps repeating

Hi @sebastian-ziegler , thank you for reporting this bug. I will fix it for the next version.