Position-based destructuring should use positional syntax
Reports position-based destructuring declarations that use custom componentN functions and need to be migrated for name-based destructuring.
With new name-based destructuring enabled, parentheses (x, y) will be used for name-based destructuring, while square brackets [x, y] should be used for position-based destructuring.
The inspection warns when:
Destructuring a non-data-class (all components are custom)
Destructuring a data class with more entries than primary constructor parameters (extra components are custom)
Examples:
This inspection is part of the migration plan for name-based destructuring.
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
CustomComponentDestructuringMigration- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Inspection ID: CustomComponentDestructuringMigration
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |