Commit Graph

12663 Commits

Author SHA1 Message Date
Bas Leijdekkers
5c06f74975 Java: don't report non-private field as assigned not accessed when it is implicitly read and written (IDEA-357404)
GitOrigin-RevId: 943ef6961c19510e5d4291367293424a87499487
2024-09-13 16:40:26 +00:00
Aleksey Dobrynin
f590114d83 [java, highlighting] Fix module conflict highlighting for exported packages IDEA-352819
GitOrigin-RevId: d4479fb863280674ae8960c930e6e8b1628b7321
2024-09-13 06:24:34 +00:00
Bas Leijdekkers
c40e983f98 Java: rename method correctly if the name conflicts with javadoc reference (IDEA-355643)
GitOrigin-RevId: c1ae53780e8ec3a56834dd32ecd9bc19cfd222fb
2024-09-12 18:27:21 +00:00
Tagir Valeev
c22a9186f9 [java-inspections] Support simple chaining in NotNullFieldNotInitializedInspection
Fixes IDEA-145194 Do not report 'Not-null fields must be initialized' when field is initialized indirectly

GitOrigin-RevId: c3bae51deaedbbbb4d035e5d7d3b55f2ca9b8c03
2024-09-11 20:52:54 +00:00
Tagir Valeev
8ed70be46d [java-inspections] IDEA-359031 Preview API use warning: ignore imports
GitOrigin-RevId: d9ba762be3f03f60372a70471f4c04efc26a9a66
2024-09-11 12:08:36 +00:00
Tagir Valeev
9092a09789 [java-intentions] BindFieldsFromParameters: disable for existing field if static or type doesn't match
GitOrigin-RevId: ad1d93533626f5e76a3f53c5ab25b06a5aa07f1e
2024-09-10 23:44:56 +00:00
Tagir Valeev
0f2865b919 [java-intentions] DefineParamsDefaultValueAction: better check of possible signature conflicts
GitOrigin-RevId: 5eb26ee62852e2e5e6188e740b807c775ded0277
2024-09-10 23:44:55 +00:00
Mathias Boulay
055ce7ad56 Fix(JavaDoc): fix markdown construct being unaffected inside legacy docs
GitOrigin-RevId: 25beb0f37329a1b98a511144558c291b5c284398
2024-09-09 18:26:13 +00:00
Tagir Valeev
ad5122e632 [java-completion] Use var when preferred
Fixes IDEA-212766 Java Postfix completions should use Java 10 var keyword if possible (for, fori, cast, ...)

GitOrigin-RevId: 58813cb4f7ecfbaf6da5fd51237a7e778313fff2
2024-09-09 17:41:44 +00:00
Mikhail Pyltsin
d72eba89a1 [java-completion] IDEA-357258 Java 23: .switch postfix completion is not supported for primitive data types
GitOrigin-RevId: ae848584ee81611bde2e1201c79923c2e170f6e6
2024-09-09 15:21:29 +00:00
Mathias Boulay
2cfd03bd80 fix(JavaDoc-gen): compilation on backport, Better rendering, respect IDE options
Fixes IDEA-354610, IDEA-353932
Partially addresses IDEA-352642

fix(JavaDoc-format): handle indent on markdown

fix(JavaDoc-backport): fix compilation

GitOrigin-RevId: 5d1705da21be59ec0bc92a1b35bdf986a3227064
2024-09-09 12:59:51 +00:00
Bas Leijdekkers
c47a581888 Java: merge two tests
GitOrigin-RevId: 3811faf0c478ae7e9e2c7ff40da645ef41312d09
2024-09-06 13:43:06 +00:00
Mikhail Pyltsin
ae365f891c [java-inspection] IDEA-358668 Red code after "Replace 'if' with 'switch' statement" with Enum's
- support enums in patterns

GitOrigin-RevId: b00182c5f77bda03552fb9750e960f74c75582a5
2024-09-05 16:13:13 +00:00
Bas Leijdekkers
028d526405 Java: fix false positive when using java 21 pattern matching (IDEA-357175)
in "'equals()' should check the class of its parameter" inspection

GitOrigin-RevId: f84071ea339bf690eadcba60d491eebe4cb21a7e
2024-09-05 15:02:58 +00:00
Tagir Valeev
cf460af83e [java-inspections] IDEA-358770 Stream/Optional desugaring: support Predicate.not
GitOrigin-RevId: af9cdb5e674406bbbe94a746e85a662a590a4d3d
2024-09-05 12:54:57 +00:00
Anna Kozlova
716e2552f3 [java] quick doc: skip duplicated links in package doc
- classes might come from different libraries, but given the same links, it's impossible to navigate to desired one anyway

^KTIJ-26237 fixed

GitOrigin-RevId: 4db0b5e1dc38399376e998c04869374f3ef8d17d
2024-09-04 18:23:36 +00:00
Mathias Boulay
245479dba8 fix(JavaDoc): escaped brackets spacing, reference link with 2+ args
Links like [String#copyValueOf(char\[\], int, int)] won't have an additional space for no reason
Links like [String#copyValueOf(char\[\], int, int)] can now be clicked on for navigation purposes.

GitOrigin-RevId: 42cb742a641b767a82820f5d01a9baff4e78811e
2024-09-04 15:20:28 +00:00
Tagir Valeev
7e2050cf72 [java-inspections] MagicConstantInspection: test to ensure that parameters and fields do not propagate automatically
GitOrigin-RevId: 7053c2c950894e6694353e90d77cb1f2ff772fb3
2024-09-04 12:07:39 +00:00
Tagir Valeev
6c29e44d6b [java-inspections] Track references in 'extends'; fix getMinimalAccessLevel for default constructor
Fixes IDEA-357158 "Replace constructor with factory method" makes code uncompilable

GitOrigin-RevId: dfe3341d2cb0ea975aa6a40d045bf8419ff39e5f
2024-09-04 11:31:52 +00:00
Bas Leijdekkers
0c4fc2ab23 Java: don't suggest to "Replace with text block" a text block (IDEA-358449)
GitOrigin-RevId: 4db08b1a6a9e5bb3c957e23af185e6df1f757c47
2024-09-02 21:52:50 +00:00
Tagir Valeev
b01ac55564 [java-refactoring] Inline variable on non-initialized declaration
Could be available if there's only one write visible for all the reads
Fixes IDEA-354157 Inline variable not working when staying on uninitialized declaration

GitOrigin-RevId: e257b2b493a3902e901699efa4eac90f62e3108b
2024-09-02 21:01:25 +00:00
Tagir Valeev
84ce93ddc5 [java-dfa] Test for IDEA-357456
GitOrigin-RevId: b7b97300c5a4512009b006cdfafeba56bcfe4c69
2024-09-02 21:01:25 +00:00
Mikhail Pyltsin
dd822c1bc7 IJ-CR-142710 [java-inspections] IDEA-357725 LoggerInitializedWithForeignClassInspection should skip when the logger is not the final field
- fix texts

GitOrigin-RevId: 85d86f362ce860118d2a047321bf4916e01757da
2024-09-02 18:36:41 +00:00
Mathias Boulay
286567da08 fix(JavaDoc): Collapsed markdown comments with wrong suffixes
Not perfect at all, it should be able to rely on the commenter API instead.

GitOrigin-RevId: f41d181e9f27905bca1156912b7850f5a96ba943
2024-09-02 16:39:21 +00:00
Mathias Boulay
19b9a28603 fix(JavaDoc): Refactoring misplaced tags
GitOrigin-RevId: 313091e94f8b65d379615f91dca7b975428aeeba
2024-09-02 10:36:29 +00:00
Bas Leijdekkers
952c203d93 Java: fix surrounders selecting generated code (IDEA-355874)
GitOrigin-RevId: 5ab70db1b9aff1a5a7483729e2e65a24fffa6dab
2024-08-29 19:03:09 +00:00
Bas Leijdekkers
f198a23cdf Java: don't evaluate enum constants as constants expressions
GitOrigin-RevId: c5d703ce78b569a3bdab9e8e9dcc2e95bdadd07f
2024-08-29 19:03:09 +00:00
Bas Leijdekkers
ed81723f17 Java: don't evaluate constant for incomplete expressions
GitOrigin-RevId: 15542db6b8631edbc96bd7ea9cc2b1a975fcbcbb
2024-08-29 19:03:09 +00:00
Tagir Valeev
cd2be32f62 [java-inspections] Java9CollectionFactoryInspection: copyOf: respect declared nullity of source collection
Fixes IDEA-349386 Don't suggest List/Set/Map.copyOf when elements are annotated @Nullable

GitOrigin-RevId: f2c1298394f204732437d304f68272f6cf406cc0
2024-08-29 18:27:57 +00:00
Mathias Boulay
d03ded346a fix(JavaDoc): Inline code block support
GitOrigin-RevId: ac902221d848139b9a92559b0f61558cfb259319
2024-08-29 16:55:53 +00:00
Mathias Boulay
2bd10fba65 fix(JavaDoc): Html code support in tags
GitOrigin-RevId: b4d6a52b9e5a8f292a41b5b94e93b6bfd16364b9
2024-08-29 16:55:53 +00:00
Tagir Valeev
07c73fd64a [java-dfa] Recognize String.strip/stripLeading/stripTrailing/isBlank
Also: limit the length of the resulting string if the length of the original string is known

GitOrigin-RevId: bfe3752b15949047366c3d3d79c7d13a49193abd
2024-08-29 14:08:22 +00:00
Tagir Valeev
13845dd38c [java-dfa] Call restrictFromState when we track chained qualified value as well
It's possible that we track chained qualifier value only. E.g., under if (!str.trim().isEmpty()) we store nothing about str.trim, but we know that str.trim.length is 'int >= 1'. So if later we get a new fact about str, like if (str.equals("\n")), we still should call restrictFromState, as this fact implies that str.trim == "" and str.trim.length == 0, contradicting the current memory state, so we should not apply such a fact.

Fixes IDEA-357897 DFA produces exception: Precalculated value description.trim mismatches with method handler
Should fix at least partially EA-1080132 ISE: MethodCallInstruction.getMethodResultValue (String.trim, Enum.name)

GitOrigin-RevId: 47849768da15f2878957a0fcce9e358152fbd7e4
2024-08-28 17:54:26 +00:00
Tagir Valeev
59325634ab [java-inspections] IDEA-356832 Inspections ignore redundant Class::cast method call
GitOrigin-RevId: 390a19d69020bc91f1395e6c4d23f14992ca396b
2024-08-28 17:54:26 +00:00
Mikhail Pyltsin
07ce79c60f IJ-CR-143108 [java-action] IDEA-356782 Incorrect place of caret into text block with injection after enter
GitOrigin-RevId: 0550bdd9f009773eb84fb51c0faf82df157b5265
2024-08-28 13:04:23 +00:00
Mathias Boulay
2750d267ea fix(JavaDoc): better language highlight on codeblock
GitOrigin-RevId: 2445935a3c083ecca24d899a300d02c08378f525
2024-08-27 18:12:21 +00:00
Mathias Boulay
d69bdfe6a4 fix(JavaDoc): illegal character on escaped array types
GitOrigin-RevId: dd8098159715bd42510d807077d2679b365c546f
2024-08-27 17:29:56 +00:00
Mikhail Pyltsin
4aa99fd33a IJ-CR-143396 [java-inspection] IDEA-356207 incorrect work with typeUseWithType option
- more tests

GitOrigin-RevId: 14fc2ab77a0659541423741c704437c7fba446b6
2024-08-27 14:43:05 +00:00
Mikhail Pyltsin
4362fe4584 IJ-CR-143108 [java-action] IDEA-356782 Incorrect place of caret into text block with injection after enter
- add <cursor> for tests
- get rid of `Host`
- reformat code

GitOrigin-RevId: 0ca88901798a6f282089992f48fd1c88d26e0293
2024-08-27 12:46:52 +00:00
Georgii Ustinov
c15dd29151 [Java. Inspections] Add test to ForwardCompatibilityInspection to check qualified yield call
IDEA-358316

GitOrigin-RevId: 9b1633787a92b719606c31f09499cad9bde8dcfb
2024-08-27 10:05:40 +00:00
Georgii Ustinov
940f66f53d [Java. Inspections] Add tests for not showing popup for add exception to method signature
IDEA-358300

GitOrigin-RevId: a7b8c716d772ae5ca631037ebb923bb796946af9
2024-08-27 10:05:40 +00:00
Mikhail Pyltsin
76e51824bf [java-inspection] IDEA-356207 incorrect work with typeUseWithType option
GitOrigin-RevId: b4affe09ebbf3269881bf00d48f75cca3fd27a59
2024-08-27 09:13:47 +00:00
Bas Leijdekkers
18cb209fa7 Java: add cast to single branch of conditional expression when possible (IDEA-358278)
GitOrigin-RevId: 8f3137172d8a1526da2228e3c9ed911f9805c16c
2024-08-26 18:38:16 +00:00
Bas Leijdekkers
83bba063e7 Java: improve message for cast fix
GitOrigin-RevId: 40cd180ca8fdae46a3ea0216ec7b08e82ca22364
2024-08-26 18:38:16 +00:00
Mathias Boulay
d56883b763 fix(JavaDoc): formatter, inspections
GitOrigin-RevId: 77686401cbf38ea31e93311a608bac7472ccc73c
2024-08-26 10:42:10 +00:00
Mikhail Pyltsin
e01d24d5c8 [java-highlighting] IDEA-357866 Spurious "Different case kinds used in the switch" error on incomplete code
- fixes
- not double error messages

GitOrigin-RevId: 8f789243ee4e09d3eb8de6a2db7dcbe25ee517db
2024-08-22 16:03:56 +00:00
Mikhail Pyltsin
cd14483af8 [java-highlighting] IDEA-357866 Spurious "Different case kinds used in the switch" error on incomplete code
- improve error message

GitOrigin-RevId: 2a8da472e07dd10bdb0ae75e679b6056ab884b72
2024-08-22 16:03:56 +00:00
Bas Leijdekkers
affc8566c8 Java: show duplicate throws tags in Javadoc (IDEA-345275)
GitOrigin-RevId: 8487e9cdbea877c548500b9718f3de1ddd02f322
2024-08-22 15:27:14 +00:00
Bas Leijdekkers
1a5e213e96 Java: "Suppress for <x>" fix should not make code uncompilable (IDEA-358115)
GitOrigin-RevId: 754d0bac805a0e9d56489c63e5486d6e7e15a4db
2024-08-22 15:27:14 +00:00
Bas Leijdekkers
e2e6809274 Java: avoid infinite loop when creating switch branches for enum with duplicate constants (IDEA-357561)
GitOrigin-RevId: e9c84396786baceb58501a56d5d7e529f5ae9276
2024-08-22 15:27:14 +00:00