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

Remove JDK7 support from Java Spring generators #11561

Merged
merged 9 commits into from Feb 14, 2022
Merged

Conversation

wing328
Copy link
Member

@wing328 wing328 commented Feb 10, 2022

Remove JDK7 support from Java Spring generators (default to JDK8+ starting in v6.0.0)

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0), 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10)

@cachescrubber
Copy link
Contributor

Some unit tests have to be adjusted.

@wing328
Copy link
Member Author

wing328 commented Feb 12, 2022

Yup, will fix those after merging your (and other) spring-related PRs.

@wing328 wing328 added this to the 6.0.0 milestone Feb 12, 2022
@wing328 wing328 changed the title Remove JDK8 support from Java Spring generators Remove JDK7 support from Java Spring generators Feb 14, 2022
@cachescrubber
Copy link
Contributor

@wing328 Nor sure wether we should remove the implementation in apiController.mustache. Could make migration for spring-mvc users more straight forward - and could be a value for itself. WDYT?

@wing328 wing328 marked this pull request as ready for review February 14, 2022 05:49
@wing328
Copy link
Member Author

wing328 commented Feb 14, 2022

Added back via 63a469f

Agreed with the direction to make the migration easier for spring-mvc users.

@cachescrubber
Copy link
Contributor

Thx. I'll give more feedback and review throughout the day.

@wing328
Copy link
Member Author

wing328 commented Feb 14, 2022

The code won't compile as it's missing those JDK7 import. Shall we add those import back to the controller?

Error:    symbol:   class User
Error:    location: class org.openapitools.api.UserApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/UserApiController.java:[156,12] cannot find symbol
Error:    symbol:   class ResponseEntity
Error:    location: class org.openapitools.api.UserApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[36,80] cannot find symbol
Error:    symbol:   class XmlItem
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[35,12] cannot find symbol
Error:    symbol:   class ResponseEntity
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[50,12] cannot find symbol
Error:    symbol:   class ResponseEntity
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[66,97] cannot find symbol
Error:    symbol:   class OuterComposite
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[65,12] cannot find symbol
Error:    symbol:   class ResponseEntity
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[65,27] cannot find symbol
Error:    symbol:   class OuterComposite
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[90,94] cannot find symbol
Error:    symbol:   class BigDecimal
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[89,12] cannot find symbol
Error:    symbol:   class ResponseEntity
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[89,27] cannot find symbol
Error:    symbol:   class BigDecimal
Error:    location: class org.openapitools.api.FakeApiController
Error:  /home/runner/work/openapi-generator/openapi-generator/samples/server/petstore/springboot/src/main/java/org/openapitools/api/FakeApiController.java:[104,12] cannot find symbol

Ref: https://github.com/OpenAPITools/openapi-generator/runs/5179391345?check_suite_focus=true

@cachescrubber
Copy link
Contributor

cachescrubber commented Feb 14, 2022

Hmm, the missing imports are not jdk8 related IMO. They miss swagger.v3 and spring-web imports.

We 'll need a flag to enable usage of the "impl-in-controller" pattern? Probably the switch has been implicit via the java8 toggle.

@wing328
Copy link
Member Author

wing328 commented Feb 14, 2022

Hmm, the missing imports are not jdk8 related IMO. They miss swagger.v3 and spring-web imports.

I'll try to add those import

We 'll need a flag to enable usage of the "impl-in-controller" pattern?

I suggest we go without the flag to start with. If later there's a demand for it, we can always add one.

@wing328
Copy link
Member Author

wing328 commented Feb 14, 2022

Done. CircleCI failure not related to this change.

@cachescrubber
Copy link
Contributor

cachescrubber commented Feb 14, 2022

I suggest we go without the flag to start with. If later there's a demand for it, we can always add one.

I think we still need to hide the code behind a flag. We should just not expose it via cli to make no commitment. As it is right now there is a code duplication between Api and Controller. Thanks for your patience anyway. Otherwise the PR looks good.

The code was previously hidden behind the {{^jdk8}} test. You replaced it with {{^reactive}} which is not sufficient.

@wing328
Copy link
Member Author

wing328 commented Feb 14, 2022

OK. Let's go with what we've for now as I don't want to include too many changes in this PR. We can always add the option later.

@wing328 wing328 merged commit 380aaa5 into master Feb 14, 2022
@wing328 wing328 deleted the spring-remove-java8 branch February 14, 2022 09:54
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.

None yet

2 participants