190 Commits

Author SHA1 Message Date
Tagir Valeev
676c19bc1f [java-inspections] Report TYPE_USE nullability annotation on classes
GitOrigin-RevId: f5c6113ccd1738d72b0f58fe13a8352a043431c9
2024-10-11 08:10:27 +00:00
Yuriy Artamonov
47f1c44a90 [java] IJPL-158521 Actions: fix ellipsis in messages for Java actions
GitOrigin-RevId: bfce0d6efa8747660c4b9af3d8defbfa47e4509a
2024-09-15 14:50:09 +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
Tagir Valeev
d52f6c789f [java-dfa] IDEA-355908 Add new mutation contract option: io
GitOrigin-RevId: 206fae268d8444d475a4feac6ebc5ef96ffc57bb
2024-07-04 21:05:23 +00:00
Tagir Valeev
b023c1d252 [java-highlighting] error.unnamed.variable.brackets: proof-reading
GitOrigin-RevId: b30031e9d76de357434f48e71b099cf27d4b90e4
2024-07-03 17:42:16 +00:00
Bas Leijdekkers
6916b6b005 Java: better error message when there are more arguments than parameters (IDEA-336129)
GitOrigin-RevId: a17a5f0f3878b9baf211737a614d1aa1a5103d31
2024-06-28 17:14:56 +00:00
Tagir Valeev
522f2ab43e [i18n] Fix internationalization warnings
GitOrigin-RevId: 7b4a959cf215d79d86d6d9a7727f0fc054097517
2024-06-18 13:46:50 +00:00
Tagir Valeev
567e0b0d05 [java-intentions] IDEA-270206 Nullability annotation at type parameter/wildcard: add a quick-fix to move it to the bound
GitOrigin-RevId: e8e56c2d27a77414045064c784f48ff712ad0d2d
2024-06-14 16:05:02 +00:00
Tagir Valeev
8fad668268 [java-inspection] IDEA-345669 Report value compared to itself with == or !=
GitOrigin-RevId: 601c0bb6c5beddaace52d3b094506d2229195d37
2024-05-15 15:55:21 +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
a3e3ed8591 [java-highlighting] Remove extra space
GitOrigin-RevId: 98a9c2395ef5f9605d39029dfe5e695d76c4237e
2024-04-23 09:43:59 +00:00
Tagir Valeev
f943967aec [java-inspections] Minor fixes for IDEA-346242 Add 'minimal java version' clause automatically to inspection descriptions
1. Add features to assertion inspections
2. Remove redundant feature message from HTML descriptions
3. Display Java 1.3 and Java 1.4 version properly
4. Display several features when necessary

GitOrigin-RevId: 133b46152ad8376a37aa4fd847bedf38d45f3135
2024-04-05 10:20:31 +00:00
Bas Leijdekkers
9e22b48c16 [java] show containing file name of implicit classes in batch inspection results (IJ-CR-130524)
GitOrigin-RevId: 280b18e1a50ed18db8dfcc79ce95dc2d9669f9df
2024-04-03 14:14:27 +00:00
Bas Leijdekkers
ab2af3d314 [java] don't show implicit classes as "anonymous" in batch inspection results (IDEA-334425)
GitOrigin-RevId: 1c636b01743409c25ef084faca47f34b0127ff4d
2024-04-01 10:52:12 +00:00
Tagir Valeev
d89c17fc59 [kotlin-dfa] Move inspection.data.flow.warn.when.reading.a.value.guaranteed.to.be.constant to JavaAnalysisBundle
Preparatory step for KTIJ-28908 Convert "Constant conditions" inspection to K2

GitOrigin-RevId: 68798782d260f8245947423efd936ae82bde841c
2024-02-24 12:22:09 +00:00
Tagir Valeev
64327f79d6 [java-inspections] IDEA-346242 Add 'minimal java version' clause automatically to inspection descriptions, based on the required feature(s)
GitOrigin-RevId: 50a25148d4d36c46e9552b3123d1ef966b40a2c2
2024-02-15 15:28:00 +00:00
Tagir Valeev
a7674dca70 [java] IDEA-345355 Refactor HighlightingFeature (in progress)
Create JavaLanguageFeature; move HighlightingFeature functionality there; move preview highlighting related utilities to new PreviewFeatureUtil class

GitOrigin-RevId: 116bcc9feb6fb40a0bd6a25ba10c2f35b41ffea6
2024-02-08 10:07:12 +00:00
Bas Leijdekkers
176a8e0bec Java: statements before super() part I (IDEA-340403)
GitOrigin-RevId: 7307a469267746ed3432acd1e73c894ccc87a254
2023-12-28 17:39:19 +00:00
Tagir Valeev
f7074186ea [java-inspections] PreviewFeatureInspection: add features from Java 20-22
Fixes IDEA-340983 Preview API (structured concurrency) usage in Java 21 is not highlighted

GitOrigin-RevId: cd02d5e1fe328104a47ac1fd684b2e2324b6558d
2023-12-14 15:51:27 +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
Mikhail Pyltsin
3f86cf9292 [java-highlighting] IDEA-339935 JEP 463
- rename unnamed classes to implicitly declared classes

GitOrigin-RevId: 2c6d7f16a1dc6d2371b8f8b5f5675246c9bc99f9
2023-12-11 15:49:28 +00:00
Bas Leijdekkers
a50138d2c8 Java: improve javac quirks inspection texts (IJPF-CR-15669)
GitOrigin-RevId: fa038ac62b8f9e0a4fd56a483578741a353e0886
2023-11-29 20:30:35 +00:00
Andrey Cherkasov
f6af5745f7 [llm] Declare the text attribute for internal actions in plugin.xml
instead of using property files, as we do not intend to localize all internal actions.

IJ-CR-120022

GitOrigin-RevId: bdf91572dd59128131e54537f382851acf29a762
2023-11-20 11:11:06 +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
Andrey Cherkasov
b22e497d8c [llm] StatisticCollectorAction: cleanup
See description of the "Eager creation of action presentation" inspection

GitOrigin-RevId: 3e05c90a81afe8cd1a178ce243b503523dd7b0b5
2023-11-14 11:42:13 +00:00
Tagir Valeev
17a223b66d [mod-command] NullableNotNullManagerImpl: OptionController; used in ChangeNullableDefaultsFix
GitOrigin-RevId: 66d6128248cd06e81cb3ec7826265ea4a23b7dbf
2023-11-14 11:01:16 +00:00
Alexey Kudravtsev
9b4cc7a05d new inspection: "missorted imports" with quick-fix-only severity, to fix IDEA-334084 No "Optimize imports" action is displayed
GitOrigin-RevId: 92028252fc0b4c8ab05b7236de15ff44090a7183
2023-11-08 14:55:31 +00:00
Bas Leijdekkers
8cbdbab21a Java: move old check to quirks inspection
GitOrigin-RevId: f1201462a504c09c1d4ca10e813c343d03be55ac
2023-11-06 11:16:53 +00:00
Tagir Valeev
943bacb4c0 [java-inspections] AnnotateMethodFix: mod-command
Now, works for in-code annotations only (but may work in batch). Was used for MissingOverrideAnnotationInspection and NullableStuffInspectionBase. The later uses old code now, as external annotations could be desired there.

Part of IDEA-322693 Migrate as much as possible Java intentions and quick-fixes to ModCommand API

GitOrigin-RevId: f580467c5e64782a629bbe7a48b7f95686f6b83c
2023-10-24 16:54:33 +00:00
Tagir Valeev
66d3646f6d [java-inspections] IDEA-331613 "Overridden parameter annotations" lint should be "Overriding"
GitOrigin-RevId: 7234832a572304695efe2fd21af60127679715df
2023-09-15 10:19:11 +00:00
Roman Ivanov
31928210fc [java] add move all members to class fix
GitOrigin-RevId: f5ad44f993f2f386c9847dc57ddac86cb4cf45d2
2023-09-07 08:48:06 +00:00
Roman Ivanov
4ef891cf5e add unnamed class feature and check for usage
GitOrigin-RevId: 51ab72778378fdf84d19cb801b10ef9fb1eb2929
2023-08-27 21:23:12 +00:00
Tagir Valeev
6495c1370c [java-dfa] IDEA-327154 String templates support in data flow inspection
GitOrigin-RevId: da9176e33611213fa6ab49ef1aba03d8550c2c12
2023-08-04 15:20:03 +00:00
Tagir Valeev
a828a34968 [java-highlighting] Fixes in unnamed variables highlighting (IDEA-323960)
1. Highlight C-style arrays
2. Do not highlight variables inside for initializer
3. Highlight variables without initializer
4. Better message for underscore references when unnamed variables are allowed

GitOrigin-RevId: 5bca18969cf8fb0ea6e052b0aef71323bbfa69b5
2023-08-02 21:04:54 +00:00
Tagir Valeev
6c02bcf415 [java-inspections] IfStatementWithIdenticalBranchesInspection: support if-else merge inverting the second condition
Fixes IDEA-323850 Null-check and 'instanceof' combination could be simplified

GitOrigin-RevId: 20f5706ac06d6b1b0771b744fc20898de2d452d1
2023-07-31 15:35:27 +00:00
Tagir Valeev
a41ef84fea [java] Unnamed variables
IDEA-323910 Implement parser for "JEP 443: Unnamed Patterns and Variables (Preview)"
IDEA-323960 Support error highlighting for unnamed variables (JEP 443)

GitOrigin-RevId: 1b9ee424063dfd4d32c2215fc8b0a9838dbdcd95
2023-07-31 13:41:28 +00:00
Tagir Valeev
76aa489d1d [java-dfa] Support failure handling in constant evaluator
Part of IDEA-326613 Support constant evaluation of Integer.parseInt and friends
Required for IDEA-324389 Inspection: Integer.parseInt() with a numeric String literal could be simplified
Also: added more Math methods

GitOrigin-RevId: 199a4bc5eaea9e8c2f26b6d4dfa5292ca8dd7795
2023-07-28 14:18:15 +00:00
Tagir Valeev
e55a975f7f [java-inspections] NewExceptionWithoutArgumentsInspection: add option to ignore certain exceptions
Fixes IDEA-325424 Inspection 'Exception constructor without arguments' should allow exclusions

GitOrigin-RevId: 9297554f1dc6d95b8e4e2be5499d7a47a6703d4b
2023-07-28 08:52:53 +00:00
Tagir Valeev
ab550ac4c0 [java] IDEA-326473 Implement unnamed patterns
GitOrigin-RevId: 1b5db700434306be23d07e38905537025e2cc892
2023-07-27 10:03:54 +00:00
Tagir Valeev
f7c30e6971 [java-intentions] MethodThrowsFix: ModCommand
GitOrigin-RevId: e9fab99693bcfcd8729703edc3c96a8d8a31840a
2023-07-18 12:27:43 +00:00
Mikhail Pyltsin
61e64487f7 IJPF-CR-12323 [java-highlighting] IDEA-324307 IJ-CR-110222 Allow to use qualified name for enum in switch
GitOrigin-RevId: ad5ab12cef7f639c5a0d738d335ed25bf805a96b
2023-07-17 11:27:31 +00:00
Bas Leijdekkers
b9baaeb614 Java: parser and PSI for Java 21 Preview String templates (IDEA-321503)
initial version, not entirely complete

GitOrigin-RevId: a4968d546f02a05081eb1c8e0e198138968509fe
2023-07-06 22:53:38 +00:00
Mikhail Pyltsin
33666a70fc [java-highlighting] IDEA-324307 IJ-CR-110222 Allow to use qualified name for enum in switch
GitOrigin-RevId: d165e80890f68ad8aa8524697b5ff4d22557fa7c
2023-07-06 00:03:23 +00:00
Mikhail Pyltsin
4bc43b46f4 [java-highlighting] IDEA-323955 Record patterns support available only for Java 20 preview. Fix compiler errors and tests
GitOrigin-RevId: 5f856519e56e61818e95cf63766fb6a54c6283ad
2023-07-05 12:09:22 +00:00
Tagir Valeev
cf2584bfdd [java-inspections] ReplaceWithConstantValueFix: suggest to extract side effects when applicable
Fixes IDEA-323618 Side-effect ignored by code assist

GitOrigin-RevId: 6206743a4af64948f95d722708e42caf05dda2f3
2023-07-03 21:09:36 +00:00
Tagir Valeev
2f1be4183d [java-inspections] More ModCommand fixes
GitOrigin-RevId: 0c09d9d462156b87b8cd8ef33d203d959a579baf
2023-06-27 11:08:29 +00:00
Tagir Valeev
ad40c945e2 [java-inspections] More quickfixes to ModCommand
GitOrigin-RevId: ccc6093d680712cb81c1325d997fb2771b61a0be
2023-06-25 19:05:51 +00:00
Bas Leijdekkers
01d55eeb9c Java: add parentheses to inspection warning
GitOrigin-RevId: c85afe8b4c44d05f30e3b1361286c22de7d84e2c
2023-06-22 14:48:20 +00:00
Tagir Valeev
9a63850218 [java-inspections] OptionalOfNullableMisuse: change message
GitOrigin-RevId: 168f791e21376d5a134683b7f3fc0661fdcaf091
2023-05-17 12:34:05 +00:00
Tagir Valeev
5906493339 [java-inspections] Less confusing warning & fix on misplaced annotation when fqn+array is used
GitOrigin-RevId: d490d2696d070827fbe6a3b958a05acd31afcdc7
2023-04-27 09:56:48 +00:00