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: eliminate raw-types and remove unnecessary cast #1095

Merged
merged 7 commits into from
Nov 18, 2022

Conversation

burkedavison
Copy link
Contributor

No description provided.

renovate-bot and others added 3 commits November 8, 2022 15:40
…endencies to v3.0.6 (#1088)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [com.google.cloud:google-cloud-shared-dependencies](https://togithub.com/googleapis/java-shared-dependencies) | `3.0.5` -> `3.0.6` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.6/compatibility-slim/3.0.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-shared-dependencies/3.0.6/confidence-slim/3.0.5)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/java-shared-dependencies</summary>

### [`v3.0.6`](https://togithub.com/googleapis/java-shared-dependencies/blob/HEAD/CHANGELOG.md#&#8203;306-httpsgithubcomgoogleapisjava-shared-dependenciescomparev305v306-2022-11-07)

[Compare Source](https://togithub.com/googleapis/java-shared-dependencies/compare/v3.0.5...v3.0.6)

##### Dependencies

-   Update dependency com.fasterxml.jackson:jackson-bom to v2.14.0 ([#&#8203;901](https://togithub.com/googleapis/java-shared-dependencies/issues/901)) ([33c5511](https://togithub.com/googleapis/java-shared-dependencies/commit/33c55112ff485da1d7a0a32d8b6dade33aa04ff8))
-   Update dependency com.google.api-client:google-api-client-bom to v2.0.1 ([#&#8203;899](https://togithub.com/googleapis/java-shared-dependencies/issues/899)) ([4029e89](https://togithub.com/googleapis/java-shared-dependencies/commit/4029e89be507ddfa030515565fdb6fbf8997324e))
-   Update dependency com.google.api:api-common to v2.2.2 ([#&#8203;892](https://togithub.com/googleapis/java-shared-dependencies/issues/892)) ([5c59fbd](https://togithub.com/googleapis/java-shared-dependencies/commit/5c59fbd3c3cf3efbfda50420c8048e3ff257084c))
-   Update dependency com.google.cloud:grpc-gcp to v1.3.1 ([#&#8203;884](https://togithub.com/googleapis/java-shared-dependencies/issues/884)) ([9fffe24](https://togithub.com/googleapis/java-shared-dependencies/commit/9fffe243b631565a00b0a848a6c73163b1dd33a4))
-   Update dependency com.google.code.gson:gson to v2.10 ([#&#8203;887](https://togithub.com/googleapis/java-shared-dependencies/issues/887)) ([15017de](https://togithub.com/googleapis/java-shared-dependencies/commit/15017de39a35f90bc1b38b828edc23fdce524a07))
-   Update dependency com.google.http-client:google-http-client-bom to v1.42.3 ([#&#8203;893](https://togithub.com/googleapis/java-shared-dependencies/issues/893)) ([4c0de9b](https://togithub.com/googleapis/java-shared-dependencies/commit/4c0de9bd188bfab5fe126c8b01b4d7168f8a5079))
-   Update dependency com.google.protobuf:protobuf-bom to v3.21.9 ([#&#8203;889](https://togithub.com/googleapis/java-shared-dependencies/issues/889)) ([8576271](https://togithub.com/googleapis/java-shared-dependencies/commit/85762716d1bbb97c447f86451094fb8af2528470))
-   Update dependency io.grpc:grpc-bom to v1.50.2 ([#&#8203;878](https://togithub.com/googleapis/java-shared-dependencies/issues/878)) ([fd569af](https://togithub.com/googleapis/java-shared-dependencies/commit/fd569af1e5f1b195e2421fc9e02d8b67afe1c638))
-   Update dependency org.checkerframework:checker-qual to v3.27.0 ([#&#8203;896](https://togithub.com/googleapis/java-shared-dependencies/issues/896)) ([f0f7931](https://togithub.com/googleapis/java-shared-dependencies/commit/f0f7931937a0ed9a32fd87cd58c82b787d368242))
-   Update dependency org.threeten:threetenbp to v1.6.4 ([#&#8203;894](https://togithub.com/googleapis/java-shared-dependencies/issues/894)) ([899682d](https://togithub.com/googleapis/java-shared-dependencies/commit/899682d0405645d9d5288b298af2fda228414669))
-   Update gax.version to v2.19.5 ([#&#8203;903](https://togithub.com/googleapis/java-shared-dependencies/issues/903)) ([3e4d8b3](https://togithub.com/googleapis/java-shared-dependencies/commit/3e4d8b35d3f682b07326ffa0a3e552d097f25a65))
-   Update google.common-protos.version to v2.10.0 ([#&#8203;900](https://togithub.com/googleapis/java-shared-dependencies/issues/900)) ([53b54c3](https://togithub.com/googleapis/java-shared-dependencies/commit/53b54c35f3a7c19df488921a6077e7a9bfb0b103))
-   Update google.core.version to v2.8.23 ([#&#8203;885](https://togithub.com/googleapis/java-shared-dependencies/issues/885)) ([686dd7c](https://togithub.com/googleapis/java-shared-dependencies/commit/686dd7c8f541189302e8cac4ae72ed7d967b5b3f))
-   Update google.core.version to v2.8.24 ([#&#8203;890](https://togithub.com/googleapis/java-shared-dependencies/issues/890)) ([1effda3](https://togithub.com/googleapis/java-shared-dependencies/commit/1effda381c7b886f5ae4d2dac9473da821e655fe))
-   Update google.core.version to v2.8.27 ([#&#8203;902](https://togithub.com/googleapis/java-shared-dependencies/issues/902)) ([3bcb804](https://togithub.com/googleapis/java-shared-dependencies/commit/3bcb804dec4358ed0a9c6c35cf4c35f817821e9a))
-   Update iam.version to v1.6.6 ([#&#8203;886](https://togithub.com/googleapis/java-shared-dependencies/issues/886)) ([03d0690](https://togithub.com/googleapis/java-shared-dependencies/commit/03d0690f01f9217e31dd65d55c28a47f2f2deb22))
-   Update iam.version to v1.6.7 ([#&#8203;895](https://togithub.com/googleapis/java-shared-dependencies/issues/895)) ([6cebc20](https://togithub.com/googleapis/java-shared-dependencies/commit/6cebc205daa98b96a8b27b3fc3cd222319b27e59))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-java).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzQuMTkuMCJ9-->
#1087)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [kr.motd.maven:os-maven-plugin](https://togithub.com/trustin/os-maven-plugin) | `1.7.0` -> `1.7.1` | [![age](https://badges.renovateapi.com/packages/maven/kr.motd.maven:os-maven-plugin/1.7.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/kr.motd.maven:os-maven-plugin/1.7.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/kr.motd.maven:os-maven-plugin/1.7.1/compatibility-slim/1.7.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/kr.motd.maven:os-maven-plugin/1.7.1/confidence-slim/1.7.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-java).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzQuMTkuMCJ9-->
@burkedavison burkedavison requested review from a team as code owners November 14, 2022 18:07
Copy link
Contributor

@emmileaf emmileaf left a comment

Choose a reason for hiding this comment

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

LGTM - thank you for these fixes!

(Nit on PR naming: perhaps prefix with something like fix(spring) or fix(Spring CodeGen), just to help differentiate with PRs merging into the main branch?)

@emmileaf emmileaf added the spring pr that's related to spring code gen, intend to merge into autoconfig-gen-draft2 branch. label Nov 14, 2022
BiFunction<List<String>, Expr, List<? extends AstNode>> processFunc,
Function<String, List<? extends AstNode>> perMethodFuncAfterSettings) {
List resultList = new ArrayList<>();
Function<String, List<? extends T>> perMethodFuncBeforeSettings,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we change <? extends T> to T as well? Looks like what gets returned are always the same type?

Copy link
Contributor Author

@burkedavison burkedavison Nov 15, 2022

Choose a reason for hiding this comment

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

T is valid for the current source; but as a Util function, the limit of the implementation is <? extends T> which defines how it can be used in the future as well. This also decouples future functions from needing to return the same type of AstNode list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For example, without the ? extends T, it wouldn't be possible to combine type-related-but-not-the-same helper functions:

abstract List<CommentStatement> getHeaderComments(String methodName);
abstract List<Statement> getStatements(String methodName);
private static <T> List<T> NONE(String unused) { return Collections.emptyList(); }

private void example() {
  List<Statement> statements = Util.processRetrySettings(
    server,
    config,
    clazzType,
    this::getHeaderComments,
    this::getStatements,
    this::NONE
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with the general idea. But for this util method, it's a very specific use case(Create retry settings with some hardcoded method names) that is only used by the two composers, so I doubt it will be used by anything else. I could also argue that this method should not be a public Util, maybe it should be in something like a AbstractSpringComposer with default scope.
That being said, I don't think this is critical enough to block the PR, so either way works.

Copy link
Contributor

@zhumin8 zhumin8 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@sonarcloud
Copy link

sonarcloud bot commented Nov 17, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@burkedavison burkedavison merged commit 13290c2 into autoconfig-gen-draft2 Nov 18, 2022
@burkedavison burkedavison deleted the fix-raw-types branch November 18, 2022 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spring pr that's related to spring code gen, intend to merge into autoconfig-gen-draft2 branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants