Remove unused private methods and commented-out code
CH
11h ago+0+0+0123456789-140-140-012345678901234567890123456789
Summary
Removes private methods that nothing calls, plus the constants and commented-out code that only existed for them. Generated output is unchanged.
InlineModelResolver:fixStringModelwith its helpersschemaIsOfTypeandschemaContainsExample, andmakeSchema(replaced bymakeSchemaInComponentsin #12353; only a commented-out call was left)AbstractApexCodegen:sanitizePackageName,sanitizePath, the commented-outgetAcceptblock and the GuavaStringsimportAbstractAdaCodegen:isMimetypeOctetStreamandAPPLICATION_OCTET_STREAMRustServerCodegen,RustServerCodegenDeprecated:isMimetypeOctetStream(andoctetMimeTypeinRustServerCodegen)KotlinServerCodegen:isKtor2(onlyisKtor2Or3is used)CppOatppClientCodegen,CppOatppServerCodegen:postProcessSingleParam
Most were never called since they were added (copied from another generator or migrated from swagger-codegen); the InlineModelResolver and Rust ones lost their last caller in earlier refactors.
CC committee members
cc technical committee members for the touched generators (Apex has none listed):
- Ada: @stcarrez @michelealbano
- C++: @ravinikam @stkrwork @etherealjoy @martindelille @muttleyxd @aminya
- Kotlin: @karismann @Zomzog @andrewemery @4brunu @yutaka0m @stefankoppier @e5l
- Rust: @frol @farcaller @richardwhiuk @paladinzh @jacob-pro @dsteeley
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
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*.
IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed. - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Summary by cubic
Removes private methods, constants, and commented-out code that nothing calls so the dead code no longer looks like it should be used. Generated output is unchanged; most removed methods were never called since they were added, and the InlineModelResolver and Rust ones lost their last caller in earlier refactors.
InlineModelResolver: removesfixStringModeland its helpers,makeSchema, and a commented-out call.- Apex, Ada, C++ Oat++, Kotlin, Rust, and JavaScript generators: removes unused mimetype checks, sanitizers, the Guava import,
isKtor2,postProcessSingleParam, and commented-outsanitizePathblocks.