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

Fix safety evaluation requiring lhs assignment to be safe unnecessarily #2242

Merged
merged 3 commits into from
May 2, 2022

Conversation

carterkozak
Copy link
Contributor

The type parameter passthrough code would evaluate to SAFE rather
as opposed to UNKNOWN when type parameters were unknown/erased.

==COMMIT_MSG==
Fix safety evaluation requiring lhs of an assignment to be safe unnecessarily
==COMMIT_MSG==

The type parameter passthrough code would evaluate to SAFE rather
than UNKNOWN when type parameters were unknown/erased.
@changelog-app
Copy link

changelog-app bot commented May 1, 2022

Generate changelog in changelog/@unreleased

Type

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

Description

Fix safety evaluation requiring lhs of an assignment to be safe unnecessarily

Check the box to generate changelog(s)

  • Generate changelog entry

"Test.java",
"import com.palantir.logsafe.*;",
"import java.util.*;",
"class Test<OutputT> {",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test exposed the issue, but only when the (unused) type parameter is present. JCTree.type of the field when <OutputT> is present is java.util.Set and without it, JCTree.type is java.util.Set<java.lang.Throwable>!

I've updated the check to both:

  1. avoid returning type-info based safety in the case that there's no type info
  2. check both the symbol type and tree type for safety info

@bulldozer-bot bulldozer-bot bot merged commit d041fbb into develop May 2, 2022
@bulldozer-bot bulldozer-bot bot deleted the ckozak/fix_safety_analysis_no_type_info branch May 2, 2022 14:22
@svc-autorelease
Copy link
Collaborator

Released 4.123.0

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

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

# Release Notes
## 4.123.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Improvement | Fix safety evaluation requiring lhs of an assignment to be safe unnecessarily | palantir/gradle-baseline#2242 |


## 4.124.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Fix | VarUsage failures reference a real tree | palantir/gradle-baseline#2244 |



To enable or disable this check, please contact the maintainers of Excavator.
This was referenced May 2, 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