GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: update generated samples to executable format by eaball35 · Pull Request #874 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@eaball35

@eaball35 eaball35 commented Nov 30, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

b/207550139, b/207550144

go/java-sample-gen
go/java-sample-gen-bugs

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
eaball35 added 2 commits November 29, 2021 19:07
@eaball35
feat: ExecutableSampleComposer
444a91f
@eaball35
feat: make current samples executable samples
fce9bda
@eaball35
eaball35 requested a review from miraleung as a code owner November 30, 2021 20:58
@eaball35
eaball35 requested review from a team November 30, 2021 20:58
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 30, 2021
@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Nov 30, 2021
@eaball35 eaball35 closed this Nov 30, 2021
@eaball35 eaball35 reopened this Nov 30, 2021
@eaball35
eaball35 marked this pull request as draft November 30, 2021 21:00
@eaball35
chore: include license headers
cc25bb8
@codecov

codecov Bot commented Nov 30, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #874 (8a7927c) into main (6af0e18) will increase coverage by 0.08%.
The diff coverage is 98.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #874      +/-   ##
==========================================
+ Coverage   87.84%   87.93%   +0.08%     
==========================================
  Files         153      156       +3     
  Lines       15966    16068     +102     
  Branches     1155     1155              
==========================================
+ Hits        14025    14129     +104     
  Misses       1601     1601              
+ Partials      340      338       -2     
Impacted Files Coverage Δ
...i/generator/engine/writer/ImportWriterVisitor.java 94.56% <ø> (+1.61%) ⬆️
...enerator/gapic/composer/samplecode/SampleUtil.java 93.75% <93.75%> (ø)
.../composer/samplecode/ExecutableSampleComposer.java 98.48% <98.48%> (ø)
...ser/common/AbstractServiceClientClassComposer.java 98.62% <100.00%> (ø)
...r/common/AbstractServiceSettingsClassComposer.java 97.72% <100.00%> (ø)
...mmon/AbstractServiceStubSettingsClassComposer.java 96.21% <100.00%> (ø)
...or/gapic/composer/samplecode/ExecutableSample.java 100.00% <100.00%> (ø)
...or/gapic/composer/samplecode/SampleCodeWriter.java 92.85% <100.00%> (+5.35%) ⬆️
...er/samplecode/ServiceClientSampleCodeComposer.java 99.29% <100.00%> (+<0.01%) ⬆️
...omposer/samplecode/SettingsSampleCodeComposer.java 98.66% <100.00%> (-0.06%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6af0e18...8a7927c. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eaball35 added 7 commits November 30, 2021 14:59
@eaball35
tests + cleanup
23665b2
@eaball35
include generic exceptions
9846013
@eaball35
tests: update integration goldens
c292b3b
@eaball35
chore: formatting
78e13aa
@eaball35
use example package instead and include needed imports
066fc4d
@eaball35
cleanup
36d1985
@eaball35
formatting
e8e7312
@eaball35
eaball35 marked this pull request as ready for review December 2, 2021 16:36
@eaball35
cleanup
15782a6
@eaball35 eaball35 assigned vam-google, lesv, meltsufin and amanda-tarafa Dec 2, 2021
@meltsufin meltsufin assigned chanseokoh Dec 2, 2021
amanda-tarafa
amanda-tarafa approved these changes Dec 3, 2021
View reviewed changes

@amanda-tarafa amanda-tarafa left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM on how the resulting samples are looking, this is great.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
meltsufin
meltsufin reviewed Dec 3, 2021
View reviewed changes

@meltsufin meltsufin left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@amanda-tarafa @eaball35
I see that this only updates inline samples, and the single-file samples as described in the design are not part of this PR.
I'm a little surprised to see essentially the whole executable sample file with imports and a wrapping application class inline. Was that the intent of the original design all along? Do you feel like this might be adding too much boilerplate repetitive code to the javadoc samples?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@amanda-tarafa

amanda-tarafa commented Dec 6, 2021

Copy link
Copy Markdown

@meltsufin I'm starting a thread internally to discuss more in-depth, but basically, these aspects are up for decision for each language, as they know their community better.

meltsufin reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Neenu1995 Neenu1995 added the release-please:force-run To run release-please label Dec 6, 2021
@release-please release-please Bot removed the release-please:force-run To run release-please label Dec 6, 2021
@eaball35
Merge branch 'main' into java-sample-gen
e65a06b
chanseokoh
chanseokoh reviewed Dec 6, 2021
View reviewed changes

@chanseokoh chanseokoh left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just went over the top part of the PR. Will take another look later.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .../java/com/google/api/generator/gapic/composer/common/AbstractServiceClientClassComposer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java
Comment on lines +31 to +32
this.sampleVariableAssignments = sampleVariableAssignments;
this.sampleBody = sampleBody;

@chanseokoh chanseokoh Dec 6, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just to confirm: is there any chance that the input List instances may be modified?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSample.java
return sampleName;
}

public List<AssignmentExpr> getSampleVariableAssignments() {

@chanseokoh chanseokoh Dec 6, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Likewise, any chance that the output List object may be modified?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/ExecutableSampleComposer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleCodeWriter.java
JavaWriterVisitor visitor = new JavaWriterVisitor();
classDefinition.accept(visitor);
// Escape character "@" in the markdown code block <pre>{@code...} tags.
return visitor.write().replaceAll("@", "{@literal @}");

@chanseokoh chanseokoh Dec 6, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Since write(List<Statement>) does this too, will this end up double-escaping @? If not, I actually think this is unnecessary? And should we format code here instead of write(List<Statement>)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/com/google/api/generator/gapic/composer/samplecode/SampleUtil.java Outdated
Comment on lines +28 to +36
public static MethodInvocationExpr systemOutPrint(String content) {
return composeSystemOutPrint(ValueExpr.withValue(StringObjectValue.withValue(content)));
}

public static MethodInvocationExpr systemOutPrint(VariableExpr variableExpr) {
return composeSystemOutPrint(variableExpr.toBuilder().setIsDecl(false).build());
}

static MethodInvocationExpr composeSystemOutPrint(Expr content) {

@chanseokoh chanseokoh Dec 6, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

These method are not called by non-test code. Let's remove them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@eaball35 eaball35 Dec 14, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Agreed, however I created them because eventually I will definitely want to use them in the samples to handle the responses. I was just getting a little ahead of myself implementing these now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@chanseokoh chanseokoh Dec 14, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

That's actually what I suspected. Let's add them in the future when they are needed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eaball35 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread ...java/com/google/api/generator/gapic/composer/samplecode/ServiceClientSampleCodeComposer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

eaball35 added 2 commits December 14, 2021 14:35
@eaball35
small fixes
fb15ad1
@eaball35
fix import
8a7927c
@eaball35

eaball35 commented Dec 14, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Forking as new branch as we decided to not make inline snippets "executable" format but instead link to full example if users wants it - #882

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eaball35 eaball35 closed this Dec 14, 2021
@chanseokoh
chanseokoh deleted the java-sample-gen branch December 15, 2021 15:49
suztomo pushed a commit that referenced this pull request Mar 21, 2023
@gcf-owl-bot
chore: pin versions of certifi and google-resumable-media (#1660) (#874)
6ce4539
chore: pin versions of certifi and google-resumable-media
Source-Link: googleapis/synthtool@09c4fcd
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:264c6d5da60ff1684fbdd2b268d6a3ffca2038246e0948a06f15ca0c3cf28ce8

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
suztomo pushed a commit that referenced this pull request Mar 21, 2023
@renovate-bot
deps: update dependency com.google.protobuf:protobuf-bom to v3.21.3 (#…
efe8c28
…874)

[![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.protobuf:protobuf-bom](https://developers.google.com/protocol-buffers/) ([source](https://togithub.com/protocolbuffers/protobuf)) | `3.21.2` -> `3.21.3` | [![age](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.21.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.21.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.21.3/compatibility-slim/3.21.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.protobuf:protobuf-bom/3.21.3/confidence-slim/3.21.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>protocolbuffers/protobuf</summary>

### [`v3.21.3`](https://togithub.com/protocolbuffers/protobuf/compare/v3.21.2...v3.21.3)

[Compare Source](https://togithub.com/protocolbuffers/protobuf/compare/v3.21.2...v3.21.3)

</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, click this checkbox.

---

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/java-core).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMjIuMSIsInVwZGF0ZWRJblZlciI6IjMyLjEyMi4xIn0=-->
suztomo pushed a commit that referenced this pull request Mar 21, 2023
@release-please
chore(main): release 2.8.3 (#878)
093e1d7
🤖 I have created a release *beep* *boop*
---


## [2.8.3](googleapis/java-core@v2.8.2...v2.8.3) (2022-07-26)


### Dependencies

* update dependency com.google.api-client:google-api-client-bom to v2 ([#868](googleapis/java-core#868)) ([fe7991d](googleapis/java-core@fe7991d))
* update dependency com.google.api:gax-bom to v2.18.4 ([#864](googleapis/java-core#864)) ([d4a8501](googleapis/java-core@d4a8501))
* update dependency com.google.api:gax-bom to v2.18.5 ([#876](googleapis/java-core#876)) ([e2c0c13](googleapis/java-core@e2c0c13))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.9.2 ([#870](googleapis/java-core#870)) ([adf5af4](googleapis/java-core@adf5af4))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.5.2 ([#865](googleapis/java-core#865)) ([5dad1ea](googleapis/java-core@5dad1ea))
* update dependency com.google.auth:google-auth-library-bom to v1.8.1 ([#856](googleapis/java-core#856)) ([bb58609](googleapis/java-core@bb58609))
* update dependency com.google.http-client:google-http-client-bom to v1.42.2 ([#871](googleapis/java-core#871)) ([341b04e](googleapis/java-core@341b04e))
* update dependency com.google.protobuf:protobuf-bom to v3.21.3 ([#874](googleapis/java-core#874)) ([efe8c28](googleapis/java-core@efe8c28))
* update dependency com.google.protobuf:protobuf-bom to v3.21.4 ([#877](googleapis/java-core#877)) ([25bea6c](googleapis/java-core@25bea6c))
* update dependency io.grpc:grpc-bom to v1.48.0 ([#873](googleapis/java-core#873)) ([8bfee63](googleapis/java-core@8bfee63))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@miraleung miraleung Awaiting requested review from miraleung
3 more reviewers
@chanseokoh chanseokoh chanseokoh left review comments
@meltsufin meltsufin meltsufin left review comments
@amanda-tarafa amanda-tarafa amanda-tarafa approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@lesv lesv

@chanseokoh chanseokoh

@amanda-tarafa amanda-tarafa

@meltsufin meltsufin

@vam-google vam-google

Labels

cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@eaball35 @amanda-tarafa @chanseokoh @meltsufin @lesv @Neenu1995 @vam-google
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.