-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
ClassCastException: AnnotationDAGNode cannot be cast to InterfaceDAGNode #38
Comments
I ran the unit tests on the latest release (1.9.13), and I don't see this exception. You're right to point out that This was committed in 1.9.10 though, so if you're using a version more recent than that, there must be another problem triggering this. Can you please try to create a minimal testcase that triggers this exception? |
My first attempts to extract a minimal testcase failed. This seems to be a tough one! |
I found the problem: See attached showcase: PS: See the JavaDoc of |
Thanks for figuring this out, and for the testcase, but ugh! I didn't know I guess I need to make annotations and interfaces share an
|
Fixed, and I incorporated your test directly -- thanks for reporting this, and for providing the minimal testcase. |
Fix confirmed, thanks! |
I still get this in 1.9.17 here https://github.com/lukehutch/fast-classpath-scanner/blob/master/src/main/java/io/github/lukehutch/fastclasspathscanner/classgraph/StandardClassDAGNode.java#L84 The annotation name is javax.inject.Named. |
Thanks for the report, Erik -- could you please provide the minimal code necessary to reproduce this? |
@erikhakansson This is fixed in 1.9.18, please let me know if you have further issues. Thanks for the report. |
In 1.9.18, I still get the error as below. Code is really simple.
|
Thanks, reopening. Can you please run after calling .verbose(), and paste the output here, or even better, run it in a debugger and let me know which class is being processed when the error occurs? I need to figure out which class in your classpath is causing this. Thanks! |
I tried your exact code, and could not reproduce. You must have something funky in your classpath. I just committed some changes that will report more useful errors in this case. Can you please check out the latest git head version, and paste the full stack trace here, along with the output of the run using .verbose()? That will help me fix the problem. Thank you! |
Yes. Will do it shortly. |
|
Thanks, can you please let me know which version and distribution channel Is it possible you're pulling in two different versions of log4j based on I may need to support this case anyway, because I have come across one
|
Yes. You are right. I just re-checked my dependency tree, and find it loads both log4j-over-slf4j and slf4j-log4j12. I have excluded "slf4j-log4j12", and now it works fine under version 1.9.18. Many thanks for your supports. |
Great, thanks for checking. I'm making the scanner resilient to this sort of situation, the changes will be in the next release. Thanks for your report! |
That's great...thanks alot. |
Fixed for good in 1.9.19 (the way the class graph is built is a lot more flexible now, and this shouldn't happen again). |
That's great, and many thanks for your work. |
No problem, I rely on reports from people like yourselves to make
|
This is a regression since 1.9.12, probably caused by #30:
I suppose this happens when an annotation class is encountered (or "matched"?).
Possible hint:
Class.isInterface()
also returnstrue
for annotations not just for regular interfaces!The text was updated successfully, but these errors were encountered: