Skip to content

[java] use [javaparser] library to detect syntax errors#3715

Merged
jmini merged 1 commit intoOpenAPITools:masterfrom
sullis:use-javaparser-library
Aug 22, 2019
Merged

[java] use [javaparser] library to detect syntax errors#3715
jmini merged 1 commit intoOpenAPITools:masterfrom
sullis:use-javaparser-library

Conversation

@sullis
Copy link
Copy Markdown
Contributor

@sullis sullis commented Aug 21, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.
  • Filed the PR against the correct branch: master, 4.1.x, 5.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

(details of the change, additional tests that have been done, reference to the issue for tracking, etc)

@wing328 wing328 added this to the 4.1.1 milestone Aug 21, 2019
@sullis sullis changed the title use [javaparser] library to detect syntax errors [java] use [javaparser] library to detect syntax errors Aug 21, 2019
@wing328
Copy link
Copy Markdown
Member

wing328 commented Aug 21, 2019

The Travis CI failure is not related to this change.

@jmini
Copy link
Copy Markdown
Member

jmini commented Aug 21, 2019

+1

This is an interesting change, allowing checking the validity of the code that would have been generated without having to generate it and to run maven/gradle on it.

It will not catch all cases as the compiler would to it with the compile dependencies on the classpath, but because this is earlier in the process (unit-test).


What version of Java syntax is checked?
For example, can we leverage it to check the generated code is Java-6 compliant when the java6 option is used?
Same question with java 11 (for the moment, I do not think that the java-native client uses java-11 construct such as var introduced with java 10)

Comment thread modules/openapi-generator/src/test/java/org/openapitools/codegen/TestUtils.java Outdated
@sullis
Copy link
Copy Markdown
Contributor Author

sullis commented Aug 21, 2019

@jmini ready for review

@jmini jmini merged commit 1a808dd into OpenAPITools:master Aug 22, 2019
@jmini
Copy link
Copy Markdown
Member

jmini commented Aug 22, 2019

Thank you for the this contribution!

@sullis sullis deleted the use-javaparser-library branch September 8, 2019 15:56
@DavidGrath DavidGrath mentioned this pull request May 6, 2025
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants