Each var now names the type javac inferred for it, and each fully qualified type name is
imported instead. The suppression list keeps only the files that open pull requests edit.
* chore(style): remove var and inline qualified names from files no open PR touches
Each var now names the type javac inferred for it, and each fully qualified type name is
imported instead. The suppression list keeps only the files that open pull requests edit.
* chore(style): catch qualified names before a member, a nested type or .class, and on annotations
UnnecessaryFullyQualifiedType does not report those. A MatchXpath rule under the same id now
does, with the same exemption for a simple name that another type in the file uses. The files
no open PR touches import them instead.
Replaces inline fully-qualified class names with imports in five files and drops the two NoFqcn suppressions that covered them. ScheduleInvoker and its test each import one of the two NetworkConfiguration types and keep the other qualified, with a comment naming the clash.
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
* chore: flag unnecessary fully qualified type names with Checkstyle
Use the built-in UnnecessaryFullyQualifiedType check. It allows a
qualified name when another type with the same simple name is used in
the same file.
The 379 files that have such names today are listed in
suppressions.xml, so only new files are checked for now. Remove an
entry once its file is clean.
* docs: drop the written no-FQCN rule now that Checkstyle checks it
* docs: keep the written no-FQCN rule for files Checkstyle still skips
The baselined files are not checked, and the comment that names a clash
is not something the check can enforce.
* chore: replace var with explicit types in src/main files no open PR touches
* chore: replace var with explicit types in src/test files no open PR touches
* chore: replace var with explicit types in sdk-test-java files no open PR touches
* chore(style): replace var with explicit types in src/main
Drop the NoVar suppressions of the src/main files that no open PR touches.
* chore(style): replace var with explicit types in src/test
Drop the NoVar suppressions of the src/test files that no open PR touches.
* chore(style): replace var with explicit types in sdk-test-java
Drop the NoVar suppressions of the compatibility test files that no open PR touches.
* chore: ban var with Checkstyle in CI
Checkstyle runs tools/checkstyle/checkstyle.xml over src and compatibility-tests/sdk-test-java in its own workflow. It stays out of the Maven lifecycle because a full run takes about 30 seconds.
Code that already uses var is listed in tools/checkstyle/suppressions.xml, one entry per service and one per compatibility-tests file, so each can be cleaned and removed in its own PR.
* docs: point AGENTS.md and CONTRIBUTING.md at Checkstyle
* chore: load Checkstyle suppressions from checkstyle.xml
IDE plugins such as CheckStyle-IDEA set config_loc to the config directory and now apply the same suppressions as CI. Maven sets config_loc through propertyExpansion.
* chore: exclude files, not directories, from the var check
New files in services that still use var are now checked too.
* chore: exclude the renamed NativeDynamoDbJsonHandler files from the var check