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

Accept any annotation with the simple name @Generated #2125

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

copybara-service[bot]
Copy link
Contributor

Accept any annotation with the simple name @Generated

to support non-standard annotations.

Fixes #1984, #1863

@google-cla google-cla bot added the cla: yes label Jan 19, 2021
to support non-standard annotations.

Fixes #1984, #1863

PiperOrigin-RevId: 352622403
@copybara-service copybara-service bot merged commit 4d6a0cc into master Jan 19, 2021
@copybara-service copybara-service bot deleted the test_352461144 branch January 19, 2021 20:04
Comment on lines +1376 to +1378
.map(e -> MoreAnnotations.asStrings((AnnotationValue) e.getValue()))
.findAny()
.orElse(Stream.of(attribute.type.tsym.getQualifiedName().toString()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Late to the party, but would suggest:

Suggested change
.map(e -> MoreAnnotations.asStrings((AnnotationValue) e.getValue()))
.findAny()
.orElse(Stream.of(attribute.type.tsym.getQualifiedName().toString()));
.findFirst()
.map(e -> MoreAnnotations.asStrings((AnnotationValue) e.getValue()))
.orElseGet(() -> Stream.of(attribute.type.tsym.getQualifiedName().toString()));
  • .firstFirst just because that's what happens in practice in this non-parallel stream, and is thus arguably clearer than .findAny.
  • .map after .findFirst to clarify that only one map operation will be performed.
  • .orElseGet rather than .orElse for efficiency.

copybara-service bot pushed a commit that referenced this pull request Jan 19, 2021
PiperOrigin-RevId: 352644905
copybara-service bot pushed a commit that referenced this pull request Jan 19, 2021
PiperOrigin-RevId: 352653897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ignore when annotated with @Generated
2 participants