Commit Graph

2440 Commits

Author SHA1 Message Date
Bas Leijdekkers
f96bb8f6d4 [java] define "type parameters" element kind
GitOrigin-RevId: 883cd7f25b3ca5a3eac311b3c9b8b90fc3334653
2024-04-03 14:14:32 +00:00
Bas Leijdekkers
e614239ca4 [java] better error message and quick-fix text on record constructor throws list (IDEA-350501)
GitOrigin-RevId: 50570e951ec901fe7619465352f725788032c8f2
2024-04-03 14:14:12 +00:00
Bas Leijdekkers
9414c123b8 [java] create annotation value() method from usage (IDEA-350345)
GitOrigin-RevId: 3596e1f35ce3f603789c69f90b28aacaf448866a
2024-04-01 10:52:18 +00:00
Tagir Valeev
6c6697d422 [java-inspections] CreateFieldFromParameterAction: ModCommand
Otherwise, it's hard to make it compatible with new-style unused inspection (IDEA-349083)
Also: remove empty line in constructor body automatically

GitOrigin-RevId: ab1cd08352d9f0168b86acc1d4b87cb89cfe7d69
2024-03-22 12:27:40 +00:00
Tagir Valeev
5ceb7551aa [java-inspections] Move unused symbol warnings from PostHighlightingVisitor to normal inspection
Fixes IDEA-349083 Reimplement unused inspection not as a part of PostHighlightingVisitor, but as a normal inspection

GitOrigin-RevId: cb6e22eddbaf9db42626a79c7881bd377c4c7863
2024-03-22 12:27:36 +00:00
Bas Leijdekkers
e3ccfd0e4a [java] Report even more unnecessary substring() calls (IDEA-345335)
GitOrigin-RevId: 37b86167b5d2b1cac74365eaadbf3a5ddf792f69
2024-03-18 00:08:54 +00:00
Tagir Valeev
10310458ce [java] JavaCodeStyleManagerImpl: use uniqName
GitOrigin-RevId: 2421439a99da70d887810de098a000fd71b65692
2024-03-16 12:47:03 +00:00
Tagir Valeev
193b2cb477 [java-inspections] Experimental ModCommand-based DeletePrivateMethodFix for unused inspection
GitOrigin-RevId: efd9306505048695f1aa1de1851383e170b0c1ca
2024-03-12 16:55:18 +00:00
Bas Leijdekkers
b474e948e3 [java] report static interface field accessed via instance (IDEA-348722)
GitOrigin-RevId: f8b1b2036656ff5a4579dff82592e7bf4cfad8f9
2024-03-10 15:30:20 +00:00
Bas Leijdekkers
babfae316e [java] improve quick-fix text (IDEA-223692)
GitOrigin-RevId: 7226e492ffe7889bfbabab6dd9ea3d04d64a1d0f
2024-03-10 15:30:17 +00:00
Mikhail Pyltsin
ba48f05c21 IJ-CR-126040 [java-highlighting] S IDEA-338688 Change variable type intention produces compile error
- allow changing input parameters

GitOrigin-RevId: 3fad3ac051e314f6858c91ed177b9df22ccef15e
2024-03-08 21:32:08 +00:00
Mikhail Pyltsin
c42e445e44 [java-highlighting] IDEA-338688 Change variable type intention produces compile error
- skip if a return type is changed

GitOrigin-RevId: aa6f5d52ba3a50a6c1d571f10dea99e8ce876831
2024-02-13 21:44:44 +00:00
Tagir Valeev
d0cf7b359a [java] IDEA-345498 Remove explicit Java 20-preview support and parenthesized patterns
GitOrigin-RevId: 8d646035979e3ec0a7de3c6f58a4e6ec9967bdbd
2024-02-12 19:12:36 +00:00
Tagir Valeev
c56dbec5f8 [java] Replace CreateMissingDeconstructionRecordClassBranchesFix20Test and ReplaceCaseDefaultWithDefault20FixTest with stubs
Cannot remove the tests yet, as their removal triggers re-bucketing on CI, which results in unrelated test failures
IDEA-345498 Remove explicit Java 20-preview support and parenthesized patterns (in progress)

GitOrigin-RevId: e84e4cb7f26ecc45f81bb0b04904540a9e3cac0d
2024-02-12 19:12:33 +00:00
Tagir Valeev
3f4201aae8 [java-intentions] Disable 'initialize variable fix' for record component
Fixes EA-893719 - UOE: SyntheticElement.findSameElementInCopy

GitOrigin-RevId: 6e5d54c1b32f2c7cb0621bba1b4a6ef02de4b8f8
2024-02-06 21:35:03 +00:00
Tagir Valeev
5bd02b55c3 [java-intentions] AddVariableInitializerFix: suggest more suitable initial values instead of null for some types
Fixes IDEA-344453 Intellij should not try to initialize an Optional var with null

GitOrigin-RevId: 8097988bf1335a282138e8d09e350c3a5f65204d
2024-02-02 19:17:55 +00:00
Aleksey Dobrynin
0d8b737e97 [java, kotlin, quickfix] Add dependency in a single step while using Jigsaw modules. IDEA-341660
GitOrigin-RevId: 7c0ad3a4079ca76c1f1afb4147498e0ae08cc449
2024-01-30 14:29:06 +00:00
Tagir Valeev
1813854fea [java] Improve support for multi-shred injections with guarded blocks in ModCommands
IDEA-333006 Language injection in String templates

GitOrigin-RevId: 6b6bec62bd709cd0419139d8a78925ee3d59e249
2024-01-25 19:15:30 +00:00
Bas Leijdekkers
a18169660e Java: fix CCE when converting interface to class and there is a comment between the interface keyword and identifier
GitOrigin-RevId: fd2ee4537423961785fdb2bee2e0a46411c6a91e
2024-01-23 18:14:05 +00:00
Bas Leijdekkers
45d3f80e5e [java-inspections] UseHashCodeMethodInspection: support reporting and replacing with Double.hashCode() when temp var is reused
GitOrigin-RevId: 8b6169bd90214b30d3d83acf7ebe49bc20b4f29d
2024-01-22 19:24:31 +00:00
Bart van Helvert
dc11424f70 [kotlin] Run import optimizer when no usages are found
Fixes the issue in Kotlin, Java and Groovy. #KTIJ-28288 Fixed

GitOrigin-RevId: 7cd5942539a10f9ccdba386396f15546b0a9ac00
2024-01-17 13:18:01 +00:00
Mikhail Pyltsin
8b76574052 [java-actions] IDEA-343025 "Move initializer to constructor" shouldn't be available for implicitly declared class
- disable for ImplicitClass

GitOrigin-RevId: 1cd67fd89726eb19ccedb5227715a7d95c2c7c50
2024-01-15 22:12:12 +00:00
Tagir Valeev
3fad9d4a33 [java-inspections] UseHashCodeMethodInspection: check for side-effects (IDEA-338114)
GitOrigin-RevId: cf54ae1e7c99e0ddff88bf8a6bf951b36f8b89b7
2024-01-15 16:29:07 +00:00
Bas Leijdekkers
f60a136213 Revert Java: allow Create field from Usage on records (to create static field, IDEA-337138) (IJ-CR-122437)
GitOrigin-RevId: afaf9642a626d99d65f989ca6bbd4713b85c7704
2024-01-10 19:31:02 +00:00
Bas Leijdekkers
04ee289bc9 Java: "insert ';'" quick fix for local variables and fields (IDEA-330590)
and skip JavaErrorQuickFixProvider for non-Java elements

GitOrigin-RevId: 2fb2b6321c1a087d53bf52509f1513859ac4faf8
2024-01-10 16:09:01 +00:00
Mikhail Pyltsin
e7ff016f3e [java-inspections] IDEA-341640 Mark main(String[] args) parameter as unused with implicit classes
- return back support `premain`

GitOrigin-RevId: 71ed562fa9e0f514852cb3aff0e993452371aa44
2024-01-05 09:34:47 +00:00
Mikhail Pyltsin
0df89a1b62 [java-inspections] IDEA-341640 Mark main(String[] args) parameter as unused with implicit classes
GitOrigin-RevId: 08ca1f5ed4f48439b394f7fd313f2b95d50c48e7
2024-01-04 10:15:11 +00:00
Bas Leijdekkers
85598d6315 Java: don't generate uncompilable code in case of chained constructors (IDEA-342068)
in "Initialize in constructor" quick-fix

GitOrigin-RevId: 626d5ce6dfa823c0b1bd37c37c59edc1b45e03d6
2024-01-03 00:25:03 +00:00
Bas Leijdekkers
415d6a8b56 Java: respect "Make generated parameters final" setting when creating constructor parameters from field (IDEA-341545)
GitOrigin-RevId: 3f12122ecf79a835e649425f2301b7fbda950afc
2024-01-03 00:24:56 +00:00
Bas Leijdekkers
eb57f29882 Java: make "Create field from parameter" fix "statements before super()" aware (IDEA-340403)
GitOrigin-RevId: fb604ac3864e0ed51c763c2944bfaa80a321dc5c
2024-01-01 18:09:27 +00:00
Mikhail Pyltsin
ed67eee493 [java-inspection] IDEA-340576 Uncompilable code generated for switch pattern matching
- class, which has permitted list, doesn't have `sealed` modifier, process this class as sealed

GitOrigin-RevId: afaccb6f6479c90ad431b9300a586854e89ea204
2023-12-14 19:49:13 +00:00
Mikhail Pyltsin
43ad0b4707 [java-inspection] IDEA-281947 Useless pattern guard not suggested for removal
- remove guard if it is always true

GitOrigin-RevId: 168a103e93a42c9a82657abffcbd7626047cab3d
2023-12-14 19:49:09 +00:00
Aleksey Dobrynin
131bfc4609 [java] add default static imports
GitOrigin-RevId: 746402d1272aa0a410abbbfb18bd8571f545029c
2023-12-13 11:31:37 +00:00
Mikhail Pyltsin
45b4e8e23c [java-intentions] IDEA-340601 allow creating methods in ImplicitClass
GitOrigin-RevId: 1e0cd613359f27e889df5cf03ce535c1a1a99ca7
2023-12-12 20:14:00 +00:00
Tagir Valeev
6e1d684df0 [java-inspections] UseHashCodeMethodInspection: support double type
Also: fix comment processing
Improvement of IDEA-338114

GitOrigin-RevId: 87d057ccbea4262c40e2717c2ea3c004ac9865b0
2023-12-11 21:37:14 +00:00
Tagir Valeev
b7d4e8a3b2 [java-inspections] UseHashCodeMethodInspection: fix inspection name, support boxed Long type
IDEA-338114, IDEA-339366

GitOrigin-RevId: 5e51384d160e29f3c81b99c9c50260cb883d9c46
2023-12-01 18:37:05 +00:00
Tagir Valeev
853a7a46fc [mod-commands] Use RenamerFactory when executing rename to make it more similar to normal rename
Provide an interface to specify suggested names from outside
Still part of IDEA-338334

GitOrigin-RevId: 7bb09b7150b463ed8a0c24453c968d60d9e716fa
2023-11-27 19:09:17 +00:00
Tagir Valeev
a8914e5c86 [java-inspections] IDEA-338478 Pattern variable can be used: support more narrow casts
Also, support the same in SimplifyBooleanExpressionFix (IDEA-336123)

GitOrigin-RevId: 240383f6ca67d8b7734ac51a6fe8781538e4f254
2023-11-22 20:31:30 +00:00
Tagir Valeev
08632d3227 [java-inspections] SimplifyBooleanExpressionFix: disallow retarget to existing pattern variable if variable was changed (IDEA-336123)
GitOrigin-RevId: 82ce60a815b80bad2593de8f5a20af7e53acb5c7
2023-11-17 18:11:01 +00:00
Tagir Valeev
51849dbdf2 [java-inspections] SimplifyBooleanExpressionFix: retarget to existing pattern variable (IDEA-336123)
GitOrigin-RevId: c3e7f12fb11926084fa8a71467394635d1cfc5d9
2023-11-17 18:10:58 +00:00
Tagir Valeev
66d4dad965 [java-inspections] SimplifyBooleanExpressionFix: resolve name conflicts when retargeting the variable (IDEA-336123)
GitOrigin-RevId: 022886c909025e09655ab8704c6b095adc9a4bd8
2023-11-17 18:10:56 +00:00
Tagir Valeev
ff15d064cd [java-inspections] SimplifyBooleanExpressionFix: try to move pattern variable to another instanceof when possible
Fixes IDEA-336123 "Constant values" fix produces red code when pattern variable is removed

GitOrigin-RevId: 7faf8dd77569c21d69a9a7226d6db1b0097f9231
2023-11-15 21:43:24 +00:00
Tagir Valeev
2770254f2f [java-inspections] IDEA-338114 Suggest to replace (int)(v ^ (v >>> 32)) with a Long.hashCode(v)
GitOrigin-RevId: 2d9591f9d9a558c4a61ac226556ef9f551d6e0c2
2023-11-15 21:43:17 +00:00
Tagir Valeev
3f0c4e919a [java-inspections] SameErasureButDifferentMethodsFix: ModCommand
GitOrigin-RevId: 5fbc113100be4f0d0dfcbf32f97342a69b089b39
2023-11-14 11:01:24 +00:00
Bas Leijdekkers
b3d096b7fc Java: create constant from usage when non-constant is not compilable (IDEA-337261)
GitOrigin-RevId: 5be5a1c196902431a582768fbc461d0d09b14aac
2023-11-09 21:59:18 +00:00
Bas Leijdekkers
0124a1c191 Java: allow Create field from Usage on records (to create static field, IDEA-337138)
GitOrigin-RevId: b541e7958b4636dbcd84ea4ee35f96e0e8f04e6c
2023-11-06 11:17:07 +00:00
Bas Leijdekkers
38649ac539 Java: create dependent constant from usage in interface correctly (IDEA-337008)
GitOrigin-RevId: 3afbc697d94e692278ea74fe73fa3bc8982e50af
2023-11-06 11:17:04 +00:00
Bas Leijdekkers
5fb47bfc3e Java: make "Create enum constant" quick-fix more available (IDEA-239983)
GitOrigin-RevId: b0d9510a97e4d5af5c6dea8e640938268b7874c4
2023-11-06 11:17:00 +00:00
Mikhail Pyltsin
3d7a18e986 [java-highlighting] IDEA-315469 Quickfixes for switch labels with 'default'
- fix to reverse 'case default, null'
- fix to replace 'case default' with 'default'

GitOrigin-RevId: 3762a40c859bb7a13a638614b3200b0005d8e85a
2023-11-01 10:23:57 +00:00
Aleksey Dobrynin
eb3bf098b3 [java, fix] support creating static methods for inner classes IDEA-310703
GitOrigin-RevId: bcb0a09fd5d3e92957b4543880c5ef4640eb4d8f
2023-10-31 18:52:22 +00:00