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

Improve obtaining arguments in generic classes #10

Merged
merged 5 commits into from
Jul 29, 2024

Conversation

alexander-yevsyukov
Copy link
Contributor

This PR makes it easier to obtain a generic type argument in both Java and Kotlin code.

Changes in details

  • The method called argumentIn() of the Java utility class Types was made public. Previously it was package-private.
  • The order of parameters of the method was improved to 1) match the name 2) reduce the change of accidental misplacement of Class arguments.
  • The extension function called argumentIn() for Class was added to make it more natural when working from Kotlin.

@alexander-yevsyukov alexander-yevsyukov self-assigned this Jul 29, 2024
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review July 29, 2024 17:31
Copy link
Contributor

@armiol armiol left a comment

Choose a reason for hiding this comment

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

@alexander-yevsyukov LGTM with a minor comment.

private open class Base<T, K>

private class Leaf : Base<String, Float>()

Copy link
Contributor

Choose a reason for hiding this comment

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

This line is redundant.

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.82%. Comparing base (34572e7) to head (187544b).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #10      +/-   ##
============================================
+ Coverage     85.67%   85.82%   +0.14%     
- Complexity      102      104       +2     
============================================
  Files            13       13              
  Lines           391      395       +4     
  Branches         44       46       +2     
============================================
+ Hits            335      339       +4     
  Misses           44       44              
  Partials         12       12              

@alexander-yevsyukov alexander-yevsyukov merged commit 1cf3e1b into master Jul 29, 2024
7 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the argument-in-generics branch July 29, 2024 17:50
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

Successfully merging this pull request may close these issues.

2 participants