reflections icon indicating copy to clipboard operation
reflections copied to clipboard

Reflections 0.10 doesn't respect constructor's package parameter

Open zshnb opened this issue 3 years ago • 1 comments

val reflections = Reflections("xxx")
val generator = Generator()
val classes = reflections.get(Scanners.TypesAnnotated.with(ApiModel::class.java).asClass<Any>())

but some class in package yyy with ApiModel annotation also be scanned, how to fix this problem?

zshnb avatar Jan 06 '22 12:01 zshnb

I'm also experiencing this issue.

Set<Method> scannedMethods = new Reflections(
    new ConfigurationBuilder()
        .forPackages("x.y.z", "x.y.x")
        .setScanners(org.reflections.scanners.Scanners.MethodsAnnotated))
    .getMethodsAnnotatedWith(MyAnnotation.class);

with the code above, scannedMethods yields results not only from x.y.z and x.y.x packages, but from all the classpath.

dmedinag avatar Apr 08 '22 07:04 dmedinag