Commit Graph

2713 Commits

Author SHA1 Message Date
Mikhail Pyltsin
855a23bf6e [java-inspections] IJ-CR-125834 EA-1063946 more filters for yield statements
- more tests

GitOrigin-RevId: da9cb8318212633c8ee6eae92f7c43f3f3167036
2024-03-20 11:14:13 +00:00
Mikhail Pyltsin
a6ea6ed644 [java-inspections] IJ-CR-125834 EA-1063946 more filters for yield statements
- more tests

GitOrigin-RevId: 83b0ffbbeb982d269a8fc0333e6d7cf6799d1c1b
2024-03-19 20:39:36 +00:00
Tagir Valeev
6a98eecf0f [java-dfa] Copy state for catch (regression after AIOOBE handling)
Fixes IDEA-349343 Exceptions during DFA Dataflow interpretation error (wasForciblyMerged = false), throwable=java.lang.IllegalStateException: Stack for instruction 72 increased by 13; it's likely that IR was built incorrectly

GitOrigin-RevId: 2ebeeb9b58d6daa94ff885d20c606cae6e5391bb
2024-03-18 15:33:49 +00:00
Tagir Valeev
e07cedf5b3 [java-dfa] Skip checking derived variable equivalence if derived vars are incompatible
Fixes IDEA-349276 IDEA ignores null cases when simplifying Constant Values

GitOrigin-RevId: b7a989feb1ae329aa0b2f278ec3d3552db559a63
2024-03-18 15:33:46 +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
Bas Leijdekkers
aca900dbfd [java] Report more unnecessary substring() calls (IDEA-345335)
GitOrigin-RevId: 2620edfb2707c8bc5bdf62a6cbfd7911ed4bf386
2024-03-18 00:08:39 +00:00
Tagir Valeev
4a2a326a25 [java-dfa] Visit catch(AIOOBE) block in case if array access can be successful
GitOrigin-RevId: 49249d1a34b1b29b709bdb76e367ab3c705a05ef
2024-03-15 14:05:59 +00:00
Tagir Valeev
37e7478c3c [java-inspections] IDEA-344097 'collect(maxBy())' can be replaced with 'max()' replacement produces code that can not be compiled
GitOrigin-RevId: ba45e04a5946a73949d9d3afb15d764df2376d98
2024-03-14 19:34:55 +00:00
Tagir Valeev
f97c404a75 [java-dfa] IDEA-349101 Dataflow analysis: visit all catches on unresolved method call
GitOrigin-RevId: 4c6c8ccfe4989393d604cb7482ea5147494836b5
2024-03-13 21:17:52 +00:00
Tagir Valeev
5e168b68c6 [java-dfa] IDEA-349093 Cast to unresolved reference inside try-catch causes 'Unreachable code' warning
GitOrigin-RevId: c9098e741070cddd1c89936045481521d5823bf7
2024-03-13 21:17:47 +00:00
Tagir Valeev
e19f123a6c [java-dfa] IDEA-349054 Ignore current object field nullity inside readResolve()
GitOrigin-RevId: dfe65dc4aa335626874a8b2a01aa68fe627e8ed9
2024-03-13 21:17:42 +00:00
Tagir Valeev
1fd43a5df9 [java] IDEA-349062 Allow "Join lines" for text blocks to convert to a regular string
GitOrigin-RevId: d435698b23f56ef9ce05305266118c0e75bdb9ef
2024-03-13 21:17:32 +00:00
Tagir Valeev
97b7d32eb0 [java-inspections] PatternVariableCanBeUsed: equivalence check should be performed in narrowing cast as well
Fixes IDEA-348779 "Pattern variable can be used" inspection false positive

GitOrigin-RevId: a1ac8fe39011db2127d8d6d627cfae913320995a
2024-03-13 21:17:22 +00:00
Bart van Helvert
f896419d92 [jvm] Split JUnit usage provider per framework
Will allow for disabling them individually. #IDEA-346510 Fixed

GitOrigin-RevId: 7b879111b92f38a7a55166d67d657520c6d9314d
2024-03-12 01:13:37 +00:00
Aleksey Dobrynin
8b3d830ecd [java, groovy, import] fill in the 'module-info.java' with 'requires' on snippet pasted. IDEA-347999
GitOrigin-RevId: 0cae8730083dc7724026b6dca5da510f25820071
2024-03-01 22:56:24 +00:00
Jinseong Jeon
07fab541fc KT UAST: always preserve receiver expression of class literal
...similar to dbaaeef (for callable reference).

This time, only receiver expression is discarded if type is resolvable.
Similarly, Java UAST counterpart has both information always.

GitOrigin-RevId: fd1aa3cccaa0d5063e1272ff6df32f7b3815c8ce
2024-02-28 13:41:00 +00:00
Jinseong Jeon
87949659cd Showcase wrong unused inspection on callable
...that is actually used with class literal

GitOrigin-RevId: 492bee6a5bb61253c81d07b10709fae02b7cadda
2024-02-28 13:40:56 +00:00
Jinseong Jeon
dbaaeef8dc KT UAST: always preserve receiver expression of callable reference
It seems like qualifier type and qualifier expression did not co-exist,
but that only made users (like Lint detector) deal with inconsistent
examination of both information that are sometimes available or not.

Java UAST counterpart has both information always, so no good reason to
keep such contract in Kotlin UAST.

GitOrigin-RevId: 69f96325910cf8eea056449c984151925dffcf10
2024-02-21 13:54:08 +00:00
Tagir Valeev
388ce94e56 [java-dfa] Return source value from assignment when target is not a variable
Fixes IDEA-346500 Assignment of non-null value to volatile field might be null

GitOrigin-RevId: 1105f7ed467e038df48922b036895faae40cc304
2024-02-19 14:21:08 +00:00
Aleksey Dobrynin
2fcfda59c0 [java, fix] handle invalid module names
GitOrigin-RevId: 2b2a88ae4536a47376ee5e9d21d418c7165e4d69
2024-02-16 11:31:17 +00:00
Aleksey Dobrynin
1714ca86b3 [java, inspection] generate necessary requires for empty module-info.java file. IDEA-341665
GitOrigin-RevId: 47bce7db3bc4429cdfd78bbb3518e8fea1cc80b8
2024-02-16 11:31:15 +00:00
Tagir Valeev
1b105a0cf2 [java-inspection] IDEA-344750 Warning the usage of Stream.count() may have side-effects as per Javadoc apiNote for Java 8+
GitOrigin-RevId: cee842e9966051f95d86f83c8e8509a08fb48c64
2024-02-15 13:23:36 +00:00
Bas Leijdekkers
a8f1480bac [java] handle empty statements in "'if' statement with identical branches" quick fix (IDEA-233980)
GitOrigin-RevId: 388e5c5195bda88b61526f0a393ed9d81ec18830
2024-02-15 00:54:37 +00:00
Mikhail Pyltsin
8813548cbb [java-highlighting] IJ-CR-125397 IDEA-344235 support calls with checked exceptions for instanceOf patterns
- reimplement, changing only mayCompleteNormallyVisitor

GitOrigin-RevId: 67be02c535ec3d5df7a9ec9cd77395305db27e14
2024-02-13 21:45:04 +00:00
Mikhail Pyltsin
aa94146c31 Revert "[java-highlighting] IDEA-344235 support calls with checked exceptions for instanceOf patterns"
This reverts commit 15d80e2f3028bd59c1ec9a73a7a3af4c1c5f1027.

GitOrigin-RevId: a770a8ce645fa6a578d5a923098d39456d7fd379
2024-02-13 21:44:54 +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
8be49e4bb0 [java] Remove EnhancedSwitchMigrationInspection20Test.java
IDEA-345498 Remove explicit Java 20-preview support and parenthesized patterns (in progress)

GitOrigin-RevId: 08edb1fd67ce2fe1b088e1ae015a5416eec08fc3
2024-02-12 19:12:29 +00:00
Mikhail Pyltsin
b7e09b8c76 [java-inspections] EA-1063946 more filters for yield statements
GitOrigin-RevId: c7b426ff0b815ac710a1a7ac269960286b015fe5
2024-02-12 10:56:18 +00:00
Tagir Valeev
6adc9a28d7 [java-dfa] AssertJ: recognize describedAs and as methods in Descriptable superclass (IDEA-209246)
GitOrigin-RevId: f1374bfa5a5a3fb81763cb07206d36172712a1e6
2024-02-08 10:07:02 +00:00
Mikhail Pyltsin
4948c8af8c [java-highlighting] IDEA-344235 support calls with checked exceptions for instanceOf patterns
GitOrigin-RevId: 15d80e2f3028bd59c1ec9a73a7a3af4c1c5f1027
2024-02-05 19:22:52 +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
Tagir Valeev
04ab76833e [java-dfa] Fix nullability of nested generic patterns (IDEA-339860)
GitOrigin-RevId: 3c035ab282515ad39b0fdff167d8105297c48515
2024-01-30 13:12:18 +00:00
Tagir Valeev
0ceb02ac9a [jvm-inspections] Move Java test data for EmptyMethodInspection to JVM module; suppression top-level test
GitOrigin-RevId: 645e9ea69d7d2c81d65bfe73d6e74dc30c4e22e6
2024-01-30 11:13:43 +00:00
Bas Leijdekkers
ac330832ba Java: warn on string template single line trailing whitespace (IDEA-331315)
GitOrigin-RevId: c3c1d5ef02d3086a2c8dbf29a9fea5b1d31d18d4
2024-01-29 16:23:18 +00:00
Bas Leijdekkers
41b6cfab0b Java: fix SIOOBE in "Escape trailing whitespace characters"
GitOrigin-RevId: 1f975c570b0192a94b651e219b517f742b3b0ba0
2024-01-28 15:39:38 +00:00
Bas Leijdekkers
d18e2bf145 Java: better messages for "Class can be record class" inspection
GitOrigin-RevId: ed850cd155a3fcda76d62b2f27a2d4da07ce69a9
2024-01-28 01:18:30 +00:00
Bas Leijdekkers
fca5c367cc Java: fix false positive in "Trailing whitespace in text block" inspection (IDEA-331315, IDEA-330589)
GitOrigin-RevId: 790d24c10069542bfed988ccf2eebc872ac666ff
2024-01-27 11:45:02 +00:00
Bas Leijdekkers
b744d62219 Java: convert test from parameterized to to regular inspection test
so that highlighting is tested as well and it is easier to run a single test

GitOrigin-RevId: 1dab45eaaf98897c6a76500c0daa00c178b31d76
2024-01-27 11:44:40 +00:00
Tagir Valeev
434301c3b9 [java-dfa] Stop analysis completely after impossible cast outside of try-catch
Improves UnreachableCodeInspection

GitOrigin-RevId: 87a98ad8c3c0ca544e86c9bb1c98267dc939a728
2024-01-26 22:02:05 +00:00
Tagir Valeev
7b77a3c1ad [java-dfa] Correctly unbox variables for contract check
Fixes IDEA-343951 Warning about boolean value is always true is wrong

GitOrigin-RevId: 365f32fc0ff0fc293bf2608e3b0ad1bb3b58f040
2024-01-26 22:01:45 +00:00
Bas Leijdekkers
206dfd6e21 Java: don't allow text block backward migration on string templates (IDEA-343727)
GitOrigin-RevId: d00838e0760694d8f1fa2c556d74512cff97a8bf
2024-01-24 20:02:41 +00:00
Mikhail Pyltsin
172c052cf4 [java-inspections] IDEA-343758 Explicit class declaration can be converted to implicitly declared" for test classes
- skip test classes

GitOrigin-RevId: 79d50c079b9b935a0afa78167926abb962c1fb44
2024-01-23 20:26:16 +00:00
Tagir Valeev
2aa5b98599 [java-dfa] IDEA-342366 "Constant values" false-positive for new switch with guard expression
GitOrigin-RevId: 7e65b4c3d2773eb9e6f8600c1cbd8d55e775d87d
2024-01-22 10:54:26 +00:00
Tagir Valeev
d01d523de1 [java-inspections] Unreachable code inspection (IDEA-342966)
GitOrigin-RevId: 4bcbf2d43bddca5ded941c2b1497715ff977ca0b
2024-01-19 11:20:26 +00:00
Bas Leijdekkers
019144e115 Java: make quick fix available to create text block from any string literal (IDEA-287070)
GitOrigin-RevId: c6393e03f710177d526f07e121a768a7eb5e0ad2
2024-01-16 16:20:59 +00:00
Alexandr Suhinin
d75d619ab9 [extract method] IDEA-251837 use type element to annotate method nullability
[extract method] IDEA-251837 fix texts

GitOrigin-RevId: 37da2e7e8f83a4d85a87c644788a66ce6ea1e05f
2024-01-12 16:42:18 +00:00
Tagir Valeev
8bde40c26a [java-dfa] IDEA-341808 <T extends @Nullable Object> should not always be treated as nullable.
GitOrigin-RevId: 4098d3ed009b5aa06a453b1870ac4604fecd02e0
2024-01-10 13:55:22 +00:00
Mikhail Pyltsin
858b2cd664 [java-inspections] IJ-CR-123164 IDEA-341641 Intention to convert implicit class to explicit and vice versa
- more tests
- small optimization
- preserve first comment in created implicitly declared classes
- fixed java docs
- move highlighting to the whole declaration

GitOrigin-RevId: e7ea706151f09852473e31d3831bb3008da62475
2024-01-09 11:04:51 +00:00
Georgii Ustinov
6ca3373c89 [Java. Code Formatting] Fix type annotations wrapping in RecordCanBeClassInspectionTest
IDEA-342196

GitOrigin-RevId: 8f1c8e7fbd72f93b115b6c267cb549bd703bf8d0
2024-01-08 17:41:06 +00:00
Mikhail Pyltsin
5568197815 [java-inspections] IDEA-342216 Fix place for call inspection ExtractMethodRecommenderInspection
GitOrigin-RevId: 507f2d2fabb98a46e7a519a9edf904182fe5b3fb
2024-01-04 16:15:41 +00:00