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

Safety analysis detects annotations on superclasses and their interfaces #2271

Merged
merged 3 commits into from
May 13, 2022

Conversation

carterkozak
Copy link
Contributor

Previously it would detect direct interfaces and supertypes, but
not interfaces on supertypes.

After this PR

==COMMIT_MSG==
Safety analysis detects annotations on superclasses and their interfaces
==COMMIT_MSG==

Possible downsides?

More work at build time!

Previously it would detect direct interfaces and supertypes, but
not interfaces on supertypes.
@changelog-app
Copy link

changelog-app bot commented May 13, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Safety analysis detects annotations on superclasses and their interfaces

Check the box to generate changelog(s)

  • Generate changelog entry

@@ -122,6 +124,30 @@ public static Safety getSafety(@Nullable Type type, VisitorState state) {
return Safety.UNKNOWN;
}

public static Safety getDirectSafety(@Nullable Symbol symbol, VisitorState state) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracted to avoid duplicating effort between ASTHelpers.hasAnnotation and our annotation search. ASTHelpers.hasAnnotation searches supertypes, but not their interfaces, and there's no sense doing it twice.

I took the opportunity to use an error-prone supplier for names, which should reduce overhead a bit.

@bulldozer-bot bulldozer-bot bot merged commit b3f6180 into develop May 13, 2022
@bulldozer-bot bulldozer-bot bot deleted the ckozak/detect_annotated_superclass_ifaces branch May 13, 2022 08:33
@svc-autorelease
Copy link
Collaborator

Released 4.135.0

bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request May 13, 2022
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the roomba/latest-baseline-oss check.

# Release Notes
## 4.135.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Improvement | Safety analysis detects annotations on superclasses and their interfaces | palantir/gradle-baseline#2271 |



To enable or disable this check, please contact the maintainers of Excavator.
This was referenced May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants