Commit Graph

7115 Commits

Author SHA1 Message Date
Tagir Valeev
0f07763950 [java-dfa] IDEA-329980 "Constant values" false positive for Thread.currentThread
GitOrigin-RevId: ae59b89b689fbb2a756869fe5f4c916b1934ab06
2023-08-18 19:00:12 +00:00
Bas Leijdekkers
428f94e656 Java: fix replacing unicode escaped tab char replacement and quick-fix text (IDEA-329685)
GitOrigin-RevId: c8a1201c2c4355175c53a0844a1e7b998134b7b9
2023-08-18 15:30:04 +00:00
Bas Leijdekkers
4a049023f6 Java: more efficient folded check for text block indent drawing (IJ-CR-112537)
GitOrigin-RevId: 67a5bff2ad8c15d5c69b3247734fa7c9f2330239
2023-08-18 15:29:58 +00:00
Tagir Valeev
c6a9526921 [java-intentions] IDEA-330175 'Move switch branch' doesn't work if should be moved within the same switch label
GitOrigin-RevId: 6b2f8926573791d7ed0ae44f3269803ca3ca18ea
2023-08-18 13:19:19 +00:00
Tagir Valeev
3dd5f3d6f0 [java-highlighting] Fixes for unnamed patterns in switch (IDEA-326939)
1. More uniform messages
2. Better anchor when var is defined in multiple patterns
3. Separate error messages for Java 20 and Java 21

GitOrigin-RevId: d7c6ab5b4445b7929bdcf200ac0838fc5431e803
2023-08-18 11:33:05 +00:00
Tagir Valeev
efbff7c99c [java-highlighting] Move guard expression to switch label
Part of IDEA-326939 Support multi-pattern switch labels that define no variables

GitOrigin-RevId: c236438af58e1c74a2bf12a5985b33cedadb9cbb
2023-08-18 08:18:06 +00:00
Tagir Valeev
5618627fa4 [java-highlighting] IDEA-326939 Support multi-pattern switch labels that define no variables
GitOrigin-RevId: fb0360f00314417c17566637db6bbda4c21e6faa
2023-08-16 08:59:25 +00:00
Tagir Valeev
0d9c9c392f [java] Cosmetic
GitOrigin-RevId: 90aa0a6926c47b59fb6fe29e64e02a1785ddafa1
2023-08-14 12:18:22 +00:00
Mikhail Pyltsin
c83b6fd069 [java-highlighting] IDEA-304893 allow array init before super
GitOrigin-RevId: 9a20ede1944cfc2d9511753ba9490c5beb94b21e
2023-08-11 21:40:38 +00:00
EgorKulikov
a68f022ea8 Merge branch 'master' of ssh://git.jetbrains.team/ij/intellij
GitOrigin-RevId: 17760d33b233893cb38ef1242a980f79e75bdd34
2023-08-11 18:22:31 +00:00
Mikhail Pyltsin
45b830b55c [java-inspections] IDEA-328192 Errors from kotlin with .kts and .md
- add Nullable annotation

GitOrigin-RevId: 5bca0fa6e73772fb7787bf4314326c5359b23e3e
2023-08-11 17:50:24 +00:00
EgorKulikov
00613b9767 [kotlin] merge kt-master to master
GitOrigin-RevId: ee9a781cd33d36d8479b20d1e7181e916f7f9cfa
2023-08-11 17:14:41 +00:00
Izmar Verhage
06190372c4 Deprecate AbstractStubIndex::get and migrate usages
In this commit we implement a logical implication of the fact
that StubIndex::get is deprecated, combined with the fact that
AbstractStubIndex::get is not deprecated but calls
StubIndex::get with the exact same arguments it received. The
absence of deprecation of AbstractStubIndex::get obfuscates
the fact that we want to phase out StubIndex::get calls.

Apart from deprecating said method, we add some convenience
methods in AbstractStubIndex inheritors that ensure a few things:
- The not-deprecated and preferred StubIndex::getElements is
  called with appropriate arguments, including a properly
  specialised requiredClass argument.
- Shorter syntax and DRY: only 3 arguments are required to pass
  into the convenience method, whereas getElements requires 2
  more. These 2 arguments are fields of the AbstractStubIndex
  inheritor, so it makes little sense to get them from there
  and pass them into StubIndex::getElements everywhere.

Wherever we can, these convenience methods are now used.

If you have access to JetBrains internal resources, also see:
https://jetbrains.team/p/ij/reviews/112930/timeline
https://jetbrains.slack.com/archives/CMDBCUBGE/p1691509451975689

GitOrigin-RevId: c51ef4de44aa85841799640b1ece9d291208dc69
2023-08-11 16:14:17 +00:00
Louis Vignier
d70b833129 [java-analysis] Don't report unnecessary semicolons between import statements
IJ-CR-110702

GitOrigin-RevId: 1b5ac3b03577fc02be9ab5f0af05455539d52416
2023-08-11 14:51:57 +00:00
Louis Vignier
89cfc1c9fc [java-highlighting] Report only semicolons between import statements
IJ-CR-110702

GitOrigin-RevId: d30e7021a979e4fc1b0ad5ce5078c5a8d805858a
2023-08-11 14:51:50 +00:00
Louis Vignier
fef81252d6 [java-highlighting] Update redundant semicolon warnings
IJ-CR-110702

GitOrigin-RevId: 12ecc516040a1caa05609ffce0c6bbd9d13c116c
2023-08-11 14:51:47 +00:00
Anna Kozlova
e2d7214918 [kotlin] ensure that UastCallableReferenceExpression preserves receiver expression
- uast based visitor in unused declaration should analyse receivers which might contain references to variables/functions/etc

- Currently simple references in receivers are not processed and thus test has false positive

^ KTIJ-23958

- KotlinJavaApiUsageInspectionTest.`test reference in callable reference` doesn't test actual problem because UastVisitorAdapter is used: meaning that psi hierarchy is traversed and converted to uast one-by-one.

GitOrigin-RevId: 01b2c31fe42181c428b2c8767dc18db73bdfd659
2023-08-08 07:37:39 +00:00
Alexey Kudravtsev
e6a6dbe439 javadoc
GitOrigin-RevId: b2a9592708ebbae92fafc2063b5037ea114aad0b
2023-08-07 15:44:15 +00:00
Bas Leijdekkers
edfa8f41a5 Java: update "Non-terminal use of '\\s' escape sequence" now that PsiTemplate is not an expression anymore (IDEA-326944)
GitOrigin-RevId: cea018045f87fad01824bf68ebf10ecdb798e39d
2023-08-04 19:58:18 +00:00
Bas Leijdekkers
599fb6bf19 Java: update "Unnecessarily escaped character" inspection for string literals (IDEA-326944)
GitOrigin-RevId: 49792b6510b8deaf20e49c509c948ba51f508de1
2023-08-04 19:58:12 +00:00
Tagir Valeev
dd079774bf [java-inspections] Disable CStyleArrayDeclarationInspection for unnamed variables, as this is a compilation error
Part of IDEA-321474

GitOrigin-RevId: a59beb43ca18a0de5fe5dd8e0c9fef574e3e9561
2023-08-04 16:44:01 +00:00
Tagir Valeev
13cf92eb7f [java-inspections] ConstantExpressionInspection: minor fixes
1. Disable for literals
2. Checkbox description moved to the form

GitOrigin-RevId: 48303e0c704ef9db5e09f64f34d3ee32d2743194
2023-08-04 15:20: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
eafaa0e48b [java-dfa] IDEA-327531 Improve string concatenation handling in data flow analysis
GitOrigin-RevId: 353a1632dbb588f7c4f95cde16deec03764bceb2
2023-08-04 15:19:59 +00:00
Bas Leijdekkers
0d8bea1143 Java: better message for raw processor (IDEA-321466)
GitOrigin-RevId: 4d0df99352f5dfbd819ab7e353df89c3f200c2f8
2023-08-04 01:22:58 +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
e67e95619f [java-dfa] IDEA-327174 Report always true/false when result of floating-point computation may be NaN
GitOrigin-RevId: 270985f171a16c41dc8f11cb1b53a400804c38c2
2023-08-02 10:52:05 +00:00
Bas Leijdekkers
eae15cee93 Java: don't draw text block indent when the code is folded (IDEA-230062)
GitOrigin-RevId: 1e88822e085db93ef9386fff7ca82e2382f26a97
2023-08-01 11:58:36 +00:00
Bas Leijdekkers
8354caf1f5 Java: highlight bad escapes in string template fragments (IDEA-321466)
GitOrigin-RevId: 3d7fb0ab16db230d216bac4eb8b9ac5301232902
2023-08-01 11:58:28 +00:00
Bas Leijdekkers
cdb4d0e7ae Java: highlight sealed, non-sealed and permits keywords as not supported on lower language levels
GitOrigin-RevId: 17ff33c11a6d5ede697aaa3a7c749bff44dc7d67
2023-08-01 11:58:12 +00:00
Tagir Valeev
3698e4735f [java-analysis] Merge InspectionGadgetsAnalysis into java-analysis-impl (IDEA-327018)
GitOrigin-RevId: 8d6c6a1b935618fff47cbc0c1622a7b69c4bccc0
2023-07-31 17:44:29 +00:00
Tagir Valeev
66d5a034d5 [mod-command] Move Presentation to top-level
GitOrigin-RevId: d9e495719328ca4fa9bb25bc8ce9a9d24c5ca5ce
2023-07-31 13:41:35 +00:00
Tagir Valeev
5f7ba99e21 [mod-command] ModCommands utility methods moved to ModCommand interface itself
GitOrigin-RevId: 56d8829b42d0942fd3a10bf6cdeca934f44f036e
2023-07-31 13:41:31 +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
Mikhail Pyltsin
93df39d4eb [java-highlighting] IJ-CR-110704 Exhaustiveness for record patterns
- not process type every time. used instead of it resolved class

GitOrigin-RevId: 756801182fad791561b39dd34acd9f73294e2b51
2023-07-28 19:29:42 +00:00
Tagir Valeev
29b6822774 [java-inspections] IDEA-325283 "Deprecated API usage" inspection should honor "since" value in annotation
GitOrigin-RevId: 81745fc9ea86715e914f7d7202d556690c45c443
2023-07-28 14:18:31 +00:00
Tagir Valeev
da373298a5 [java] Minor fix in unnamed pattern
GitOrigin-RevId: a5dca3625c665c0ad745c4788c8ee0a2b9bf1788
2023-07-28 14:18:22 +00:00
Tagir Valeev
ccd2793d2d [java-dfa] More custom handlers for Math functions
GitOrigin-RevId: 07b54bc87972ec40018b148a64041b7f50914baa
2023-07-28 14:18:18 +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
Mikhail Pyltsin
ccf1cbe216 [java-highlighting] IJ-CR-110704 Exhaustiveness for record patterns
- Added new cache for `getPermittedClasses`
 - Disable finding missing classes for large sets
 - inner class for probe converted to lambda

GitOrigin-RevId: a0e7f936a83cbbc2e936e911e8a12c401dd90908
2023-07-28 14:00:40 +00:00
Anna Kozlova
ee5d687203 [uast] [unused declaration] false positive on implicit invoke call on properties (IDEA-295430)
GitOrigin-RevId: 3075f11d592ddbe6e076410ae4982a1f30c67eac
2023-07-28 12:59:08 +00:00
Tagir Valeev
7a7e094d2d [java-dfa] IDEA-326613 Support constant evaluation of Integer.parseInt and friends
GitOrigin-RevId: 178e0b4309a84b07a1f01c5fc782a49f03feeb79
2023-07-28 09:45:33 +00:00
Tagir Valeev
159dbaaaa8 [java-dfa] IDEA-326612 Perform double/float math on constants in data flow analysis
GitOrigin-RevId: 81580363852afff9f54c1a04c51d7116d71dfd1b
2023-07-28 09:45:26 +00:00
Mikhail Pyltsin
8d856b3e23 [java-highlighting] IDEA-324313 Annotations are not allowed in deconstruction types.
Fix when type is not defined

GitOrigin-RevId: 48eac5296a5451da15aa6c6519b239b98dc48231
2023-07-28 09:26:07 +00:00
Tagir Valeev
3e9a5182b4 [mod-commands] ActionContext moved to top-level
GitOrigin-RevId: 8a4621b5b48fed952c8a2865c8699039e42b1edb
2023-07-28 08:52:46 +00:00
Mikhail Pyltsin
54628b055d [java-highlighting] IJ-CR-110704 Records patterns.
Increase a threshold for max iteration, now it is approximately equals max file size * 10.
 Change context to add indicator to stop

GitOrigin-RevId: 3612ee1c35d9df20b3421f67aa762d25815f9cd2
2023-07-27 16:34:11 +00:00
Mikhail Pyltsin
7bc25b13ee [java-highlighting] IJ-CR-110704 Records patterns.
Increase a threshold for max iteration, now it is approximately equals max file size * 10.
 Change context to add indicator to stop

GitOrigin-RevId: eadeccfa236a3304db6bc7877ce878594b8cfdd9
2023-07-27 16:34:07 +00:00
Tagir Valeev
ab550ac4c0 [java] IDEA-326473 Implement unnamed patterns
GitOrigin-RevId: 1b5db700434306be23d07e38905537025e2cc892
2023-07-27 10:03:54 +00:00
Tagir Valeev
4fd18eebf9 [java-analysis] PatternHighlightingModel: refactoring (more instance methods)
GitOrigin-RevId: a52f216ddcf942d25bcf637c00518a2c6780e08b
2023-07-26 15:37:18 +00:00
Mikhail Pyltsin
e67ee5687e [uast-inspection] IDEA-326309 Process context for unsafe string
GitOrigin-RevId: d8caee212e7c3dbb89221bab92d988a001f9406e
2023-07-26 15:10:00 +00:00