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

ThrowingExceptions detector crash when parsing method signature containing nested generics #3268

Merged
merged 3 commits into from
Jan 19, 2025

Conversation

gtoison
Copy link
Contributor

@gtoison gtoison commented Jan 19, 2025

As reported in #3267 ThrowingExceptions causes errors with some methods with generics.

See #2072
See #2040

This should fix #3267

@gtoison gtoison added the bug label Jan 19, 2025
- Depecrate SignatureParser and reverted the attempt to let it support
generic methods
- Copied SignatureParser.getArguments() into GenericSignatureParser
- Clarified GenericSignatureParser.compareSignatures() javadoc
- Added changelog entry
@@ -33,6 +33,8 @@
* A simple class to parse method signatures.
*
* @author David Hovemeyer
*
* @deprecated This signature parser does not support generics, use GenericSignatureParser instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add deprecated annotation to match javadoc? Or if that only applies to generics, it should us deprecated javadoc annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the annotation.

This is a digression but I think we should consider requiring JDK soon (when it's GA), so we can use JEP-484's classfile API: among other things it has a signature parser and it would be a good replacement for these limited parsers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the annotation.

This is a digression but I think we should consider requiring JDK soon (when it's GA), so we can use JEP-484's classfile API: among other things it has a signature parser and it would be a good replacement for these limited parsers.

We just updated to Java 11 requirement, let us bump it to Java 17 and then to 21 first. After that we might consider to require Java 25 (next LTS), which is however not released yet... So I don't expect this API be available soon for SpotBugs.

@hazendaz hazendaz merged commit b264a5f into spotbugs:master Jan 19, 2025
15 checks passed
@JuditKnoll JuditKnoll added this to the SpotBugs 4.9.1 milestone Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants