Commit Graph
1192 Commits
Author SHA1 Message Date
Tagir Valeevandintellij-monorepo-bot c01c39b90c [java-dfa] IDEA-377694 Nullable incompatibilities (not sure). Calls with nullable supertypes
Separate write-nullability and read-nullability

GitOrigin-RevId: 54d1b3509f99732466feba2b3932cf334d1ed086
2025-10-06 11:23:47 +00:00
Tagir Valeevandintellij-monorepo-bot a99324783a [java-psi] PsiLiteralExpressionImpl: return mandated not-null type
GitOrigin-RevId: 681c23757e1be9f8fc26fd23cb23ae90385fb8a8
2025-10-06 11:23:47 +00:00
Tagir Valeevandintellij-monorepo-bot 0afc6f7842 [java-psi] IDEA-379921 Guava. False positive NPE when return value from an unknown list
GitOrigin-RevId: 2a5ef25b56c60058db25210028e3e802cfbf0dc2
2025-09-30 08:46:32 +00:00
Mikhail Pyltsinandintellij-monorepo-bot 9a1cfdb7a6 [java-inspections] IDEA-379697 False warning about Comparator.nullsLast/nullsFirst passing null to comparator argument
GitOrigin-RevId: d3e361fa960d2b3ca36a54c98ccca4863c03c343
2025-09-29 12:37:10 +00:00
Tagir Valeevandintellij-monorepo-bot 02a063f866 [java-dfa] Test for IDEA-375523 False positive "Argument might be null" with Guava Streams
GitOrigin-RevId: b6569cf1c45c5de3486d823f37a1426f81d0382d
2025-09-29 09:18:43 +00:00
Tagir Valeevandintellij-monorepo-bot 7e4ed9a6c2 [java-psi] IDEA-379919 Guava. Possible NPE is not highlighted. Common type can be nullable?
GitOrigin-RevId: 1a7b4c1521d85e1424bf371fcaea97f062a6b50d
2025-09-26 15:31:28 +00:00
Tagir Valeevandintellij-monorepo-bot b44761dc38 [java-psi] IDEA-379789 Guava. Possible NPE is not highlighted
Correct nullability when inferring type variable from eq and lower bounds

GitOrigin-RevId: 3c41bda2c36fd24568710ef2c9ca8b5ba0c70414
2025-09-25 16:57:56 +00:00
Tagir Valeevandintellij-monorepo-bot 58d5de70e8 [java-psi] IDEA-377483 Wrong NPE message when iterating over Iterables.concat
Handle when `T extends @Nullable Type` is instantiated with unknown nullability

GitOrigin-RevId: 21d7cc928f4f5d9ac037fa42a632f936ed6c6516
2025-09-22 16:16:42 +00:00
Tagir Valeevandintellij-monorepo-bot e294c2f5c9 [java-dfa] IDEA-373973 Wrong inspection on String.isEmpty()
GitOrigin-RevId: a17fb96e3e4f9a7f23bdeb8be51c1bc16ff478fa
2025-07-21 10:14:00 +00:00
Tagir Valeevandintellij-monorepo-bot 9c6ce129bb [java-analysis] IDEA-375799 Container nullability annotation on the method has no effect on method return type
GitOrigin-RevId: f7cead47f32b2befeabe116a6c2df87682cb1cd2
2025-07-11 17:16:17 +00:00
Tagir Valeevandintellij-monorepo-bot f2c1dc3a24 [java-dfa] Use 'non-null variable' instead of 'variable annotated as @NotNull'
The annotation may differ, depending on library used. Also, it could be a container annotation like @NullMarked or @NotNullByDefault, so let's use more neutral wording

GitOrigin-RevId: cb4923f5ec3974f56ec1b6763c2405c1471bf601
2025-07-11 17:16:17 +00:00
Tagir Valeevandintellij-monorepo-bot ee46a78b92 [java-dfa] StreamChainInliner: support takeWhile and dropWhile
Fixes IDEA-374483 Invalid "Constant values" inspection result inside Stream.takeWhile

GitOrigin-RevId: 39c045d9bbee28cb80283d194f3ba9570b795063
2025-07-09 19:21:12 +00:00
Tagir Valeevandintellij-monorepo-bot 3c712bd3aa [java-analysis] Remove old algorithm for determining type nullability
Now, new one could be used which is more correct
Fixes IDEA-375493 Nullability of generic type with several bounds depends on bounds order

GitOrigin-RevId: 24e8aab73704d9b2b5ea7e47215bfeeadaed2f26
2025-07-04 15:05:13 +00:00
Tagir Valeevandintellij-monorepo-bot 358c17e047 [java-analysis] IDEA-375487 Nullability doesn't work for captured wildcard type
GitOrigin-RevId: ff31ea679c0497709d0141a3ecfbf988600872e3
2025-07-04 15:05:13 +00:00
Tagir Valeevandintellij-monorepo-bot 7d4934114b [java-analysis] Pass nullability in PsiConditionalExpressionImpl::getType and in PsiCorrectedClassType
Fixes IDEA-375416 False-positive nullability report on lambda with ternary and null in one branch

GitOrigin-RevId: 5679bb57205cb4d49b9e87cbc4b8236c30aced67
2025-07-03 17:08:20 +00:00
Tagir Valeevandintellij-monorepo-bot 30f7d3ec26 [java-dfa] PlainDescriptor: use identityHashCode
Improves LiveVariableAnalyzer performance, when there are many identically-named variables, as we have much less hash collisions
Improves IDEA-375149 Slow Java Debugger Data Views - ControlFlowAnalyzer.buildControlFlow()

GitOrigin-RevId: b9e7127cdfd2d4696f7066c3c48d5711cecab415
2025-06-30 12:27:19 +00:00
Tagir Valeevandintellij-monorepo-bot 73943d0839 [java-dfa] Simplify Mutability computation using external annotations
GitOrigin-RevId: 6570f36a8fa94ca14f4341875b5b980c7124641a
2025-06-16 15:03:39 +00:00
Tagir Valeevandintellij-monorepo-bot 2eb2bd2b94 [java-dfa] Test for IDEA-369562 False positive from Nullability inspection
Fixed earlier

GitOrigin-RevId: daf147620f07ac29b86b0dffe11182ae65b1d157
2025-06-13 13:56:22 +00:00
Tagir Valeevandintellij-monorepo-bot 4466a6556b [java-analysis] Use type nullability in DFA
Fixes IDEA-372347 Java type inference should respect nullability
Fixes IDEA-368244 Unexpected warnings when using @Nullable generic type bounds in @NullMarked context
Fixes IDEA-372223 Nullability inference for generic parameters
Fixes IDEA-367232 'Argument might be null' warning on JSpecify nullable enum

GitOrigin-RevId: 12745f82e22fadb35e23ad73f330501146c86b86
2025-06-12 12:11:23 +00:00
Tagir Valeevandintellij-monorepo-bot ee1c23f88b [java-dfa] Native support of ObjectUtils.{all,any}[not]Null methods
Fixes IDEA-373254 Recognized ObjectUtils.allNotNull method in data flow inspection
(at least, my understanding of it)

GitOrigin-RevId: 5bf63072a84b22a3a5de58d53c8521f1296a0fd1
2025-06-10 11:20:40 +00:00
Tagir Valeevandintellij-monorepo-bot 002f45f937 [java-dfa] Switching on expression of unknown type should not mark branches as unreachable
Fixes IDEA-371191 Unhelpful "unreachable switch label" warning

GitOrigin-RevId: d3e92efc518590ed7c5b7219b9ba0378c292507d
2025-05-23 16:06:16 +00:00
Tagir Valeevandintellij-monorepo-bot 74800bc0b5 [java-dfa] Support annotation nicknames in getAnnotationNullability()
Fixes IDEA-372080 Invalid null check for array with @Nullable
Also: do not attempt to fill nicknames in dumb mode

GitOrigin-RevId: 7955160a958d9891d382ef2736d4c72fe926dbbf
2025-05-15 16:11:33 +00:00
Tagir Valeevandintellij-monorepo-bot b628e41173 [java-dfa] Support type hierarchy for parameters
Fixes IDEA-371133 Missing warning when passing null to parameter of non-nullable generic type

GitOrigin-RevId: dff653e1e85d7633b744dc2ffbcdb140ac24fe4e
2025-05-14 15:30:12 +00:00
Tagir Valeevandintellij-monorepo-bot 39b1795487 [java-dfa] IDEA-370027 AssertJ false-positive with empty array and empty contains check
GitOrigin-RevId: 0766ce9e1b794f0495d5d22a020411ab7e4334eb
2025-04-28 16:39:47 +00:00
Tagir Valeevandintellij-monorepo-bot b6806f1e7b [java-highlighting] IDEA-369375 A syntax error (PsiErrorElement) should suppress the surrounding error
Also: allow a custom highlighter to supersede the default one

GitOrigin-RevId: c7d7a8be3ef762c9516ed3b637d467d4b544af00
2025-03-20 10:06:39 +00:00
Tagir Valeevandintellij-monorepo-bot c4e72cac0b [java-dfa] IDEA-358087 Local variable nullability annotations are ignored with default qualifier
GitOrigin-RevId: e640517083910df691b58415f7ba706be37223ec
2025-03-18 14:53:44 +00:00
Bas Leijdekkersandintellij-monorepo-bot 156e101767 Java: add range annotations for readNBytes() and skip() return types (IDEA-369027)
GitOrigin-RevId: 63ff5f0ad8a53cc71d61419bbd31fdb48df901c4
2025-03-13 10:50:04 +00:00
Tagir Valeevandintellij-monorepo-bot 7e3a48e6ad [java-psi] Proper order of annotations inside PsiNewExpressionImpl
Fixes IDEA-366918 Wrong order of annotations in new array expressions

GitOrigin-RevId: 29bbfb29123cd273f4c3d34f74e8a00bc6ab5ec1
2025-03-04 17:38:52 +00:00
Tagir Valeevandintellij-monorepo-bot 89dda01eeb [java-highlighting] Exhaustiveness checks migrated (the last error from HighlightVisitorImpl!)
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: c45b258fc18e267122946be7d3aebfd9dc77387f
2025-03-03 12:11:00 +00:00
Tagir Valeevandintellij-monorepo-bot 1ad36b0e7a [java-dfa] IDEA-365459 "Treat non-annotated members and parameters as @Nullable" inspections makes constructors @Nullable
GitOrigin-RevId: b4c0234154171b658451e9628fd1bbc873e4699f
2025-02-26 10:29:12 +00:00
Tagir Valeevandintellij-monorepo-bot ea8dfc74ec [java-dfa] IDEA-368172 Nullable return is not reported for lambda parameterized with unbounded type parameter under NullMarked
GitOrigin-RevId: 61623e582c856479d4a2222ef33a73178831e074
2025-02-25 17:24:00 +00:00
Tagir Valeevandintellij-monorepo-bot 9e458c909c [java-highlighting] checkLabelSelectorCompatibility extracted and moved to SwitchChecker
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: bec076c5bff67e22d06e64e573d3219a4c89dd4d
2025-02-19 17:57:38 +00:00
Tagir Valeevandintellij-monorepo-bot e94096afec [java-dfa] When reporting return type, type annotation should take preference over the inferred type
Fixes IDEA-367721 No 'nullable return' warning inside NullMarked scope

GitOrigin-RevId: ea77401d66d92b40cabfbd4fb16fe0a1bbb828bc
2025-02-18 11:55:50 +00:00
Tagir Valeevandintellij-monorepo-bot b007ebf865 [java-annotations] getOrDefault 2nd parameter is marked as nullable
Fixes IDEA-367387 Mismatch between IDEA and JSpecify on HashMap.getDefault(...) nullness

GitOrigin-RevId: 6e90dcdac5b61aa91431f96d007261ad448ea522
2025-02-13 11:05:42 +00:00
Tagir Valeevandintellij-monorepo-bot b9cd1e1a86 [java-analysis] Do not apply container annotation to local variables if their type is a bounded type parameter
Fixes IDEA-362982 JSpecify: Local variable incorrectly asserted as NotNull with generics

GitOrigin-RevId: c310d57d875b4f63370daf0b77caece902681a06
2025-02-12 20:34:11 +00:00
Bas Leijdekkersandintellij-monorepo-bot e41f056a6b Java: report errors again on qualified reference if the type of the qualifier is unknown (revert of fix for IDEA-240047)
GitOrigin-RevId: 28d8cda938544f81c5b32d931496b6ba707b5c35
2025-01-31 23:27:00 +00:00
Tagir Valeevandintellij-monorepo-bot 2b2b8c3e88 [java-dfa] Obsolete disabled test removed
GitOrigin-RevId: 9ad982b934c1f100bed7e84a330d0f2a803dde0d
2025-01-29 11:35:30 +00:00
Tagir Valeevandintellij-monorepo-bot c449c341b7 [java-highlighting] test-data adjusted (mostly anchors) after recent updates
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 1e1b77009dc78de49c7cc5c44d4704937397bb23
2025-01-29 11:35:30 +00:00
Tagir Valeevandintellij-monorepo-bot a891bc5b66 [java-highlighting] break, continue errors -> StatementChecker; wording adjusted
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: c16e11baec8b9191ac809a34fc919a4375dd0ebd
2025-01-28 17:28:10 +00:00
Tagir Valeevandintellij-monorepo-bot 059a080ab3 [java-highlighting] Fix testdata, tooltips
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: ed0cf0daf5dbfb034882d49ad5e9c03f264b451e
2025-01-22 10:33:39 +00:00
Tagir Valeevandintellij-monorepo-bot 0adf3c4bc9 [java-dfa] Test for IDEA-365762 False positive 'Method invocation may produce NullPointerException' warning
Fixed by IDEA-363662

GitOrigin-RevId: 94d3216ee928118cce2a3479d2f83bffef7baf2c
2025-01-17 20:33:14 +00:00
Tagir Valeevandintellij-monorepo-bot f670a28936 [java-dfa] Ignore instanceof for arrays with unresolved types as well (follow-up for IDEA-365304)
GitOrigin-RevId: 4533e880a0a57b46d37d95ea60267fdb0313cd0c
2025-01-08 16:42:47 +00:00
Tagir Valeevandintellij-monorepo-bot 0de99ed319 [java-dfa] IDEA-365304 Data flow analysis: ignore instanceof statements if operand type or check type is not fully resolved
GitOrigin-RevId: fad95d5a40cccc2b2a36d1a2180c3ac08b70fa5b
2025-01-03 10:57:09 +00:00
Tagir Valeevandintellij-monorepo-bot 315776757a [java-dfa] DfaCallArguments: do not flush private final variables
GitOrigin-RevId: 054aab1ac093caff699f8710576dd929f66b8674
2025-01-02 13:57:07 +00:00
Tagir Valeevandintellij-monorepo-bot ce18179a78 [java-analysis] Parameter nullability: prefer nullability known from type over nullability known from parameter declaration
Type nullability could be more precise if parameter is generic
Fixes IDEA-364343 False-positive NPE at unboxing inside lambda with JSpecify annotations

GitOrigin-RevId: 9a49f5687eccaa013e639cdf15950be911e100bc
2024-12-06 14:57:38 +00:00
Tagir Valeevandintellij-monorepo-bot b488983f95 [java-dfa] IDEA-364300 Better contracts for Objects.equals and Arrays.equals
GitOrigin-RevId: 78742f689c964ca8784709ad6f63ee5071995a56
2024-12-05 15:06:42 +00:00
Tagir Valeevandintellij-monorepo-bot b466c60859 [java] for-template: remove duplicate annotation; remove top-level nullability annotation (IDEA-361177)
GitOrigin-RevId: e672e664fd0abc2de37c3252fb7a83304bce51be
2024-12-05 15:06:42 +00:00
Tagir Valeevandintellij-monorepo-bot 050920691a [java-analysis] javaSimplePropertyGist: remove the getter/setter name restriction
Now, index can map getter/setter -> field for any name, not only with get/set/is prefix. This is already done for bytecode index, now for source index as well
Follow-up for IDEA-364131

GitOrigin-RevId: c8c0e09d94a12bfedf575f5aa3f2d79dabe34834
2024-12-04 15:17:36 +00:00
Tagir Valeevandintellij-monorepo-bot d7767eab92 [java-dfa] IDEA-364131 Inline overridable trivial accessors if the exact qualifier type is known
Getter inlining functionality moved to MethodCallInstruction

Also: get rid of MethodCallInstruction.myPrecalculatedReturnValue. In any case, we do a lot of ad-hoc computations inside MethodCallInstruction. So we can move two cases when myPrecalculatedReturnValue was used (getter processing and empty collection processing) into MethodCallInstruction as well. This unifies code a little, and provides more possibilities, as we know current abstract interpretation state and can use it (in particular, stability of qualifier)

Also: a new kind of MutationSignature 'transparent', which doesn't flush even private fields. It's not exposed to public annotations yet (appears to the user in the same way as 'pure')

GitOrigin-RevId: 548ab12afc0d0314829f47e0ef51caec59985698
2024-12-02 14:43:44 +00:00
Tagir Valeevandintellij-monorepo-bot 68e240546f [java-dfa] IDEA-363270 Misleading warning for switch case when expression on Boolean values
GitOrigin-RevId: 449fdf6cb9137b7dcd038adca7b26ffc15f7d59a
2024-11-22 15:34:30 +00:00