Skip to content

Conversation

@carterkozak
Copy link
Contributor

==COMMIT_MSG==
Implement class-level type variable safety validation
==COMMIT_MSG==
In the future, I'll implement method type variable validation
as well, but this is fairly complex.

In the future, I'll implement method type variable validation
as well, but this is fairly complex.
@changelog-app
Copy link

changelog-app bot commented May 4, 2022

Generate changelog in changelog/@unreleased

Type

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

Description

Implement class-level type variable safety validation

Check the box to generate changelog(s)

  • Generate changelog entry

if (type != null && !type.getTypeArguments().isEmpty()) {
List<Type> resultTypeArguments = type.getTypeArguments();
List<TypeVariableSymbol> parameterTypes = type.tsym.getTypeParameters();
if (parameterTypes.size() == resultTypeArguments.size()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have an example of where these sizes would not be equal?

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 do not, but I’ve run into cases where generic type info is missing due to compiler optimizations, so I figured it was best not to risk it.

@bulldozer-bot bulldozer-bot bot merged commit fb19cfe into develop May 5, 2022
@bulldozer-bot bulldozer-bot bot deleted the ckozak/type_argument_validation branch May 5, 2022 10:58
@svc-autorelease
Copy link
Collaborator

Released 4.127.0

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

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

# Release Notes
## 4.127.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Improvement | Implement class-level type variable safety validation | palantir/gradle-baseline#2254 |



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

5 participants