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

feat(ast): array expressions #1080

Merged
merged 12 commits into from
Nov 7, 2022

Conversation

diegomarquezp
Copy link
Contributor

Copy of #1070 but to be merged in main

Added ArrayExpr to allow anonymous arrays (e.g. {"value1", "value2"}). Same type validation is enforced (e.g. {"string1", 1.2f} is not allowed).
AnnotationNode now allows an ArrayExpr as a single description. For multiple descriptions, a wrapping AssignmentExpr is still needed.

This PR is to help generate annotations with an anonymous array like this @EnableConfigurationProperties({LanguageProperties.class, SharedProperties.class})

It also enables assignments to arrays in the form String[] arr = {"str1", "str2"} - both arr and the anon array should be of type TypeNode.arrayOf(TypeNode.STRING) for this example (arrayOf() was also introduced in this PR)

@diegomarquezp diegomarquezp requested review from a team as code owners November 2, 2022 18:24
* Perform validation in build()
* Ensure type() to be explicitly set
* Expose add Expr, but validate that they are either ValueExpr or
  VariableExpr
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 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 3 Code Smells

88.0% 88.0% Coverage
0.0% 0.0% Duplication

@diegomarquezp diegomarquezp merged commit bd9532c into main Nov 7, 2022
@diegomarquezp diegomarquezp deleted the autoconfig-gen-draft2-array-annotation branch November 7, 2022 21:33
suztomo pushed a commit that referenced this pull request Dec 16, 2022
* feat(ast): anonymous arrays for annotations

* feat(ast): add convenience methods in anon array

* feat(annotation): allow adding anon arrays

* fix: fixed comments, test util class

* feat(ast): arrays to allow VarExp and ValueExpr

* fix(ast): add description only for assignments

* fix(ast): comment correction, test array assignmnt

* feat(test): test anon array assignment

* fix(license): add licenses

* fix(ast): various fixes

* Perform validation in build()
* Ensure type() to be explicitly set
* Expose add Expr, but validate that they are either ValueExpr or
  VariableExpr

* fix(ast): ArrayExpr ImportWriterVisitor fix & test

* fix: remove unecessary comment
suztomo pushed a commit that referenced this pull request Mar 21, 2023
fix(java): handle empty modules

Fixes googleapis/synthtool#1743
Source-Link: googleapis/synthtool@482d649
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:bd5071596a47614d1fe15eb766c4255bae330f823b606e1196a3b0c8d2e96fd1

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Alice <[email protected]>
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