New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MethodAnnotationsScanner is not getting configured unless there is at least one class using the annotation #297
Comments
I wrote a test case according to your description and tried it, it can work without any exception. But when I change the parameter of the function |
The package I used ("com.sivalabs.myapp" ) is correct and I have classes exists in that package also. But even if the package name given for |
Yes, this exception will occur when annotations are not used at all. If I use other annotations in another class, this exception will not occur. I will try to figure this out. |
In reflections:0.9.12, if your scanner scans nothing from the class file, the storeMap will be empty. As a result, when reflections.getConstructorsAnnotatedWith() is called, an expection will be thrown here:
But this problem has been fixed in the latest master branch. When the class Store is initialized,storeMap will get an initial value。See:
|
Bump. Is it possible to make a release with this fix? |
apologize for this inconvenience ! scanner was not configured exception - as @dota17 mentioned, this is a known issue in 0.9.12, a simple workaround is to check if the getStore() contains index for the scanner before querying. next version 0.10 fixes this. |
fixed on 0.10 |
I am using reflections:0.9.12 and I want to scan for Constructors which have some annotation, let's say
@Autowired
.This code is working fine if there is at least one class using
@Autowired
annotation. But if there is no class using@Autowired
annotation in the packagecom.sivalabs.myapp
then following exception is being thrown:Expectation:
MethodAnnotationsScanner
should be registered even when there are no classes using any particular annotation and whenreflections.getConstructorsAnnotatedWith()
is called it should return empty result.The text was updated successfully, but these errors were encountered: