Skip to content
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

Earlier/LaterSubtypes ordering constraint supports only supertypes from SpotBugs itself #215

Closed
sewe opened this issue Jun 23, 2017 · 3 comments

Comments

@sewe
Copy link

sewe commented Jun 23, 2017

The following ordering constraints

<SplitPass>
    <EarlierSubtypes super="org.example.MyDetector" />
    <Later class="org.example.PostMyDecectors" />
</SplitPass>

will fail at runtime with an edu.umd.cs.findbugs.PluginException (Unknown class org.example.MyDetector in constraint selector node). The problem apparently is that PluginLoader uses Class.forName(String) rather than the three-argument version which could use the class loader from PluginLoader.classLoader rather than the class loader PluginLoader itself has been loaded with.

@sewe
Copy link
Author

sewe commented Jun 26, 2017

Considering doing a pull request for this at the moment.

This raises the question: Do we have a test harness in place to test that SpotBugs’s plugin mechanism works as expected (as opposed to a test harness for individual detectors)?

sewe pushed a commit to sewe/spotbugs that referenced this issue Jun 26, 2017
This lets the PluginLoader load the supertype with the plugin's
class loader, not the class loader that loaded the SpotBugs core.
sewe pushed a commit to sewe/spotbugs that referenced this issue Jun 26, 2017
This lets the PluginLoader load the supertype with the plugin's
class loader, not the class loader that loaded the SpotBugs core.
@sewe
Copy link
Author

sewe commented Jun 26, 2017

Considering doing a pull request for this at the moment.

This raises the question: Do we have a test harness in place to test that SpotBugs’s plugin mechanism works as expected (as opposed to a test harness for individual detectors)?

Pull request is ready. Testing has been done manually, however, in a scenario akin to the EarlierSubtypes/@super = "org.example.MyDetector" case above.

henrik242 pushed a commit that referenced this issue Jun 28, 2017
This lets the PluginLoader load the supertype with the plugin's
class loader, not the class loader that loaded the SpotBugs core.
@sewe
Copy link
Author

sewe commented Jun 28, 2017

Thanks for merging the pull request.

@sewe sewe closed this as completed Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant