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
External classes are included by default in upwards scan #463
Comments
Hmm... there are a surprising number of nonintuitive things about classpath scanning that do not match people's expectations, and it's a constant battle to figure out how to set the defaults so that the fewest people possible are surprised by the default behavior. In this case, that change was introduced because of complaints that external superclasses were not being returned. People are used to the Java reflection API, so they're highly surprised if they can't get a superclass of a class, even if the class but not its superclass is in the accept list (formerly "whitelist"). There is an ability for any method of However for You can see the logic here for how classes end up in the final list (or how classes are excluded from the final list): Unfortunately if you look at I'm hesitant to change the current behavior unless it's obvious that any change is likely to reduce the average degree of surprise as to the behavior, and break the minimum amount of existing code. But there may be a way to walk that fine line. One possibility is to never return any non-external class, but that is the former behavior that I got lots of complaints about, because it didn't match people's expectations. However we need to figure out some general principles that can be applied to all the methods in If you can suggest a better general heuristic, I'm all ears! |
External classes are included by default to the scan result while doing the "upward scanning" added in 8a46a5e#diff-05aabb17a3fb7ed8696198513c8926ac. I think this behavior is confusing to have on by default. Since there is a separate
enableExternalClasses
modifier I believe the expected behavior here should be to exclude external classes by default from the scan result and include them only whenenableExternalClasses = true
.Here's a slightly modified version of
Issue261Test
that highlights this issue, and tests for what I think should be the expected behavior.The text was updated successfully, but these errors were encountered: