Commit Graph

2451 Commits

Author SHA1 Message Date
Georgii Ustinov
a4d5e41d7f [Java. Code Formatting] Rewrite the way of detection type annotation in JavaFormatterUtil
IDEA-353192

GitOrigin-RevId: 34e375e4e1e059be03aad12c2839911b8315ed06
2024-06-04 06:46:24 +00:00
Georgii Ustinov
3b50806cf1 Revert formatting type annotations on the same line before the type in method
IDEA-353192 IDEA-354026

GitOrigin-RevId: cbf3e0b332517194f35d979a631cbbb0121893b4
2024-06-01 09:59:49 +00:00
Georgii Ustinov
77bfbe1b39 [Java. Code Formatting] Fix tests which relied on old version of Nullable/NotNull annotations
IDEA-353192

GitOrigin-RevId: f913b37c8fb9c7c754d7c6fcd5c1cdd215a7f295
2024-05-17 11:16:41 +00:00
Bas Leijdekkers
106130b6f8 [java] better quick fix text (IDEA-353386)
GitOrigin-RevId: ebc64c441f2140181ad4e996005a45b19936b7d3
2024-05-14 10:29:57 +00:00
Tagir Valeev
cebdcda899 [java-intentions] DefineParamsDefaultValueAction: fix cast for vararg type
GitOrigin-RevId: 09705b6a78f4f07c0f62c5642ccd23853b2ba7f8
2024-05-02 11:33:05 +00:00
Tagir Valeev
860bc0e5e7 [java-intentions] DefineParamsDefaultValueAction: add cast by default when ambiguous overloads are present
GitOrigin-RevId: 10d5c9f66fa5bef5ab5e5be71987d14757fd07e2
2024-04-30 16:09:51 +00:00
Tagir Valeev
514e918516 [java-intentions] DefineParamsDefaultValueAction: do not copy @Override annotation
GitOrigin-RevId: ca02de483aeeab6e7a516a839edda6cae1515195
2024-04-25 13:12:13 +00:00
Tagir Valeev
ee495db972 [java-intentions] MoveMembersIntoClassFix: improve and revive property test
After implicit classes, out-of-class member is parsed. If it was mistakenly put out of the class, it may have many unrelated compilation errors. E.g. extra Override annotation, unresolved reference (to another member of the class), etc. These errors were masking the 'Move member to class' action, because its scope was larger (the whole method).
Now, we put 'feature not available' error specifically to the method/field name identifier, so it's almost always available. Also, action name is more friendly now, and JavaOutOfClassDefinitionPropertyTest is tuned: caret position and language level set correctly.

GitOrigin-RevId: 39917d11fb216be4db3f6fbc9e984ca7378f7302
2024-04-23 10:35:24 +00:00
Tagir Valeev
5caf42dc70 [util] Merge NameUtilCore#uniqName into UniqueNameGenerator
GitOrigin-RevId: a43f8908b639a6e5b562be99af5f880a85cfac74
2024-04-16 19:06:47 +00:00
Tagir Valeev
5ae32b3ec9 [java-analysis] LambdaUtil.isSafeLambdaReplacement: check all calls in-between; check applicability
Fixes IDEA-350194 Inspection QuickFix results in compilation error

GitOrigin-RevId: fb83bfcb4e4aef9dc87a5c84de6d08202dd52ec6
2024-04-16 19:06:42 +00:00
Bas Leijdekkers
0b1872f794 java: report string.toCharArray().length -> string.length() (IDEA-351174)
for "Redundant 'String' operation" inspection

GitOrigin-RevId: 96c3b5d310b9639c74241f48348257bbb83dbe93
2024-04-11 09:52:00 +00:00
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