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 — cannot use "case" as a field name · Issue #956 · googleapis/sdk-platform-java

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

cannot use "case" as a field name #956

Copy link
Copy link
Closed
Closed
cannot use "case" as a field name#956
Copy link
Assignees
alicejli
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@alexander-fenster
alexander-fenster
opened on Feb 25, 2022
Issue body actions

If a field is named case in the protos, the generator fails with the following exception:

Exception in thread "main" com.google.api.generator.engine.ast.IdentifierNode$InvalidIdentifierException: Name case cannot be a keyword.
	at com.google.api.generator.engine.ast.IdentifierNode$Builder.build(IdentifierNode.java:99)
	at com.google.api.generator.engine.ast.IdentifierNode$Builder.buildVariableIdentifier(IdentifierNode.java:63)
	at com.google.api.generator.engine.ast.Variable$Builder.build(Variable.java:46)
	at com.google.api.generator.gapic.composer.common.AbstractServiceClientClassComposer.lambda$createMethodVariants$6(AbstractServiceClientClassComposer.java:668)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at com.google.api.generator.gapic.composer.common.AbstractServiceClientClassComposer.createMethodVariants(AbstractServiceClientClassComposer.java:671)
	at com.google.api.generator.gapic.composer.common.AbstractServiceClientClassComposer.createServiceMethods(AbstractServiceClientClassComposer.java:578)
	at com.google.api.generator.gapic.composer.common.AbstractServiceClientClassComposer.createClassMethods(AbstractServiceClientClassComposer.java:216)
	at com.google.api.generator.gapic.composer.common.AbstractServiceClientClassComposer.generate(AbstractServiceClientClassComposer.java:150)
	at com.google.api.generator.gapic.composer.Composer.lambda$generateClientSettingsClasses$3(Composer.java:134)
	at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:422)
	at com.google.api.generator.gapic.composer.Composer.generateClientSettingsClasses(Composer.java:122)
	at com.google.api.generator.gapic.composer.Composer.generateServiceClasses(Composer.java:58)
	at com.google.api.generator.gapic.composer.Composer.composeServiceClasses(Composer.java:45)
	at com.google.api.generator.gapic.Generator.generateGapic(Generator.java:30)
	at com.google.api.generator.Main.main(Main.java:28)
--java_gapic_out: protoc-gen-java_gapic: Plugin failed with status code 1.

AIP-140 suggests that the APIs should not use possible keywords in names but does not forbid it, and this specific API won't be able to rename it because it's already public.

Activity

  1. alexander-fenster
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Feb 25, 2022
  2. suztomo commented on Feb 25, 2022

    @suztomo
    suztomo
    on Feb 25, 2022
    Member
    More actions

    Memo:

    "case" is in the KEYWORDS in https://github.com/googleapis/gapic-generator-java/blob/422882b3da787d34385a0df640e8a40dc0627442/src/main/java/com/google/api/generator/engine/lexicon/Keyword.java#L50 that's why IdentifierNode class throws the exception.

  3. suztomo commented on Feb 25, 2022

    @suztomo
    suztomo
    on Feb 25, 2022
    Member
    More actions

    @alexander-fenster (Aside from deciding what to do with gapic-generator-java) Do you know who introduced the "case" field. Is it possible to provide the feedback to the person (and approvers) that you are suffering the "case" field conflicting with Java's keywords?

    Do other gapic-generators work fine for the field?

  4. alexander-fenster commented on Mar 1, 2022

    @alexander-fenster
    alexander-fenster
    on Mar 1, 2022
    ContributorAuthor
    More actions

    @suztomo I added a comment in the internal issue 221506923 because the offending proto is not yet public.

  5. yihanzhen commented on Mar 2, 2022

    @yihanzhen
    yihanzhen
    on Mar 2, 2022
    Contributor
    More actions

    I had a similar issue when I tried to generate Java libraries for artifactregistry API where a resource name has the collection name "package" in it (proto link). The resource should have be annotated with google.api.resource but doing so would cause Java generation to fail.

    Let me know if you want me to create a separate issue or paste you the full stacktrace.

  6. blakeli0
    assigned
    alicejli
    on Apr 29, 2022
  7. alicejli commented on May 31, 2022

    @alicejli
    alicejli
    on May 31, 2022
    Contributor
    More actions

    @vam-google pushed a fix for a related issue here: #985 that solves this issue as well.

  8. alicejli
    closed this as completedon May 31, 2022
  9. suztomo
    added 3 commits that reference this issue on Mar 21, 2023

    deps: update dependency com.google.api-client:google-api-client-bom t…

    9d69e7b

    deps: update dependency protobuf to v3.20.2 (#956)

    fb1aea6

    chore(main): release 2.8.17 (#957)

    61191f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @alicejli
    alicejli

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.