fix(QTDI-3124): [Refactoring] Merge sonar fixes#1248
Open
undx wants to merge 57 commits into
Open
Conversation
Replace `instanceof` + manual cast patterns with Java 17 pattern matching for instanceof to reduce Sonar warnings (java:S6201). Both `(X) value` and `X.class.cast(value)` cast forms are handled. Excluded cases: - Conditions combined with `||` (pattern matching incompatible with alternation): AvroSchemaCache, SchemaConverter (Double||Float). - ParameterSetter#set: target variable declared outside the `if` block (would require restructuring). - Casts to a type different from the `instanceof` check (not S6201).
(cherry picked from commit c877724)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- used intellij inspection as it is...
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
# Conflicts: # component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java # component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/OutputsHandler.java # component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchema.java # component-studio/component-runtime-di/src/main/java/org/talend/sdk/component/runtime/di/studio/ParameterSetter.java
…' into ouf/QTDI-3124-sonar-fixes # Conflicts: # component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/xbean/converter/SchemaConverter.java
…o ouf/QTDI-3124-sonar-fixes # Conflicts: # component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java # component-runtime-impl/src/main/java/org/talend/sdk/component/runtime/record/json/RecordJsonGenerator.java # component-runtime-impl/src/test/java/org/talend/sdk/component/runtime/record/RecordConvertersTest.java # component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/service/RecordServiceImplTest.java # component-runtime-testing/component-runtime-beam-junit/src/main/java/org/talend/sdk/component/junit/beam/Data.java
… into ouf/QTDI-3124-sonar-fixes
…g' into ouf/QTDI-3124-sonar-fixes # Conflicts: # component-form/component-form-core/src/main/java/org/talend/sdk/component/form/internal/validation/spi/ext/BaseValidation.java # component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/util/DefaultValueInspector.java # singer-parent/component-kitap/src/main/java/org/talend/sdk/component/singer/kitap/Kitap.java
…' into ouf/QTDI-3124-sonar-fixes # Conflicts: # component-runtime-impl/src/test/java/org/talend/sdk/component/runtime/record/RecordBuilderImplTest.java # component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/beam/components/DIBatchSimulationTest.java # component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/beam/components/DIBulkAutoChunkTest.java # component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/studio/DynamicColumnsTest.java # component-tools/src/test/java/org/talend/sdk/component/tools/SvgValidatorTest.java
…to ouf/QTDI-3124-sonar-fixes # Conflicts: # component-studio/component-runtime-di/src/test/java/org/talend/sdk/component/runtime/di/schema/TaCoKitGuessSchemaTest.java
…to ouf/QTDI-3124-sonar-fixes # Conflicts: # component-tools/src/main/java/org/talend/sdk/component/tools/AsciidoctorExecutor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Requirements
Why this PR is needed?
What does this PR adds (design/code thoughts)?
AI generated code
https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code