Commit Graph

141 Commits

Author SHA1 Message Date
Tagir Valeev
a1141237c8 [java-inspections] When analyzing annotation conflict, ignore container annotation if non-container is present
Fixes IDEA-369220 JSpecify support - wrong warning when Nullable method is declared in NullMarked scope and overridden


(cherry picked from commit 50163bfda72bd1f583dda644c668b78859fac022)

IJ-CR-159281

GitOrigin-RevId: fc33b9c9f8ae165baba5a70c00b91267e57d68b1
2025-04-12 07:11:23 +00:00
Tagir Valeev
87a0f8f217 [java-dfa] IDEA-358087 Local variable nullability annotations are ignored with default qualifier
(cherry picked from commit e640517083910df691b58415f7ba706be37223ec)

IJ-CR-157989

GitOrigin-RevId: 1bea6bffbedaf9d2b1b372a9c5683da64e5373d5
2025-04-01 11:29:08 +00:00
Tagir Valeev
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
Vladimir Krivosheev
051ed2529b cleanup
GitOrigin-RevId: 6fa4f979e0a6641885e2225eb985b13713373ac5
2024-12-26 14:56:01 +00:00
Tagir Valeev
bfda3761a4 [java-analysis] NullableNotNullManager: take into account container for super owners as well
GitOrigin-RevId: b64e2e9453855fb5cad0279dd59a71080630931c
2024-10-07 18:02:44 +00:00
Tagir Valeev
9a8c7a0397 [java-inspections] NullableNotNullManager: prefer container annotation over inherited for methods
Part of IDEA-359811

GitOrigin-RevId: 530af5840eedbd35c1f247381781c4ebc128b25b
2024-10-07 10:02:40 +00:00
Tagir Valeev
330a18544a [java-dfa] Ignore type annotations hierarchy on local variables
Fixes IDEA-348069 Local variable holding result of JSpecify-`@Nullable`-annotated method in `@NullMarked` package is unexpectedly non-null

GitOrigin-RevId: c43ef9636dd903250ae698d30e571d2df7f793d8
2024-07-30 16:34:11 +00:00
Mikhail Pyltsin
330ba98e01 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- fix NullableManager, when it can't find annotation in type

GitOrigin-RevId: 121927429534971abb4a50d1f670afbed9384045
2024-06-26 20:34:48 +00:00
Yuriy Artamonov
ed4b509b66 [java] IDEA-341622 Better cache NullableNotNullManager#findEffectiveNullabilityInfo for library methods
GitOrigin-RevId: ecc23faa48a12ae14ad91be62d0a2216eca74e7a
2024-04-21 17:28:15 +00:00
Tagir Valeev
e4d46e812c [java-analysis] Support container annotations on JPMS module
Fixes IDEA-323691 JSpecify's NullMarked not considered when Java module is annotated

GitOrigin-RevId: d84fe78d9e2f0c4a2bbe7471855310762e833ba4
2023-10-17 17:54:20 +00:00
Tagir Valeev
5f3ce51f8a [java-inspections] NullableStuffInspectionBase: do not report "non-annotated overrides annotated" in the presense of container annotation
Fixes IDEA-323362 IntelliJ gives "Not annotated method overrides method annotated with @Nonnull" despite @NonNullApi

GitOrigin-RevId: 1b4298ffc3a1fc9ce4f4e5b9412e3af5a3b116d9
2023-07-26 10:00:14 +00:00
Tagir Valeev
f46f96d05f [java-analysis] NullableNotNullManager: remove deprecated and unused methods
GitOrigin-RevId: eaad92b7ab9a4908a9591f46747f75ad27eb9f1d
2023-07-26 10:00:12 +00:00
Alexey Kudravtsev
eadeade0de mark several methods Unmodifiable to highlight more probelms
GitOrigin-RevId: 18e5e68e451ffef4333c057e33d03f865deeeb65
2023-02-21 04:13:14 +00:00
Nikolay Chashnikov
bcf5757d44 [API] remove inVersion attribute from @ApiStatus.ScheduledForRemoval to avoid confusion (IDEA-288466)
GitOrigin-RevId: 861789b61fce6b99fb61db38bef66dceb42c40f7
2022-02-18 09:35:09 +00:00
Tagir Valeev
f286fd9dba [java-analysis] Use PsiUtil.getTypeByPsiElement where possible
GitOrigin-RevId: 0ac4f53d81d66a49202794c4300abfe3ebbbf042
2022-02-11 08:30:17 +00:00
Tagir Valeev
86d0145b26 [java-dfa] Support JSR-305 unknown nullability
Fixes IDEA-278618 JSR-305 @Nonnull(when = UNKNOWN) not handled correctly

GitOrigin-RevId: 5983fbdcaad42dd5db8e1c8adb27cedbb9a746e2
2021-09-24 05:54:17 +00:00
Tagir Valeev
7427f881fd [java-analysis] NullableNotNullManager: prefer type annotation over inherited annotation
Fixes IDEA-272250 False-positive warning when overridden method has a nullability type annotation

GitOrigin-RevId: a05ae5bdad95e475ac8a2af7736bcafc0e008364
2021-06-25 11:42:21 +00:00
Tagir Valeev
85e64205ca [java-analysis] findNullabilityDefault: use context at first level as well
Necessary for synthetic record accessors
Fixes IDEA-268161 NonNullApi does not work with Java record "getters"

GitOrigin-RevId: 365df82890ccb7d42144bac8cd8c87d727403f57
2021-05-07 09:46:47 +00:00
Vladimir Krivosheev
809b7ca201 deprecate ServiceManager.getService(project)
GitOrigin-RevId: 3805c3aac4e084c828558bf1b1570339f7f3b4a3
2021-03-26 21:30:32 +00:00
Tagir Valeev
b7661b3900 [java-analysis] Better nullability type annotations support (JSpecify)
GitOrigin-RevId: af9c058258e857643e3f10a05128e553ce7509b4
2021-02-12 05:56:24 +00:00
Tagir Valeev
8ada8eeed6 [java-analysis] Support UNKNOWN annotations in conflict reporting
GitOrigin-RevId: 3df4ccc51ab5800aa905c6019910a1449af0dd87
2021-02-12 05:56:20 +00:00
Tagir Valeev
3c16b5d11b [java-analysis] Better support for container and unknown nullability (JSpecify)
GitOrigin-RevId: 590dd3fe95d172242bf96791feafcfc371161f1e
2021-02-12 05:56:17 +00:00
Tagir Valeev
a6bc8802f1 [java-analysis] Report nullability annotations on enum constants and on locals (for JSpecify)
GitOrigin-RevId: 48f21b639a1eaf3ca9c2d75e1cf846bddd726260
2021-02-11 07:05:25 +00:00
Tagir Valeev
aa3b987530 [java-analysis] Report incorrect locations of nullability annotations (JSpecify)
GitOrigin-RevId: bc4915321fc45458caa79dc9424467dde05a9957
2021-02-10 10:02:41 +00:00
Tagir Valeev
11771e3ba1 [java-analysis] Better support for unspecified nullness (for jspecify); report some inherently not-null places
GitOrigin-RevId: 03fdd34aa1e5d6b591478ccd65ad2279a0e69566
2021-02-10 07:09:32 +00:00
Anna Kozlova
d66d66d259 type annotations: skip type annotation in generated code if it also has normal applicable targets (IDEA-206570)
GitOrigin-RevId: 651526af474d80f2664229f8c000c790152b3f0d
2021-01-11 10:31:05 +00:00
Tagir Valeev
6178d87978 [java-analysis] Fixes in NullableNotNullManager (IJ-CR-4616)
1. NotNull/Nullity annotations
2. Indentation
3. Javadocs
4. findNullityDefaultFiltered extracted

GitOrigin-RevId: 73d666ba4e765e3312b99f1f65428023bbf0fc19
2020-12-16 06:26:10 +00:00
Tagir Valeev
2002634b32 [java-analysis] NullableNotNullManager reworked
Now, more methods go through findEffectiveNullabilityInfo, so their semantics is more aligned.
Fixes IDEA-256427 Warning "Not annotated parameter overrides @??? parameter"

GitOrigin-RevId: f00eeb27ea4690e477be161a3a018cd4d13c0e56
2020-12-14 12:03:52 +00:00
Tagir Valeev
3a777933db [java-dfa] Fix inference for array types when type-use annotation is used as nullability default
GitOrigin-RevId: 6153dbe5336409efee85327a9e530e3f6866ab06
2020-10-20 05:29:55 +00:00
Tagir Valeev
653d690ee2 NullableNotNullManager#findDefaultTypeUseNullability: fix local variables handling
We should not use container annotation for top-level local variable type, but may use it for nested ones.

GitOrigin-RevId: 507cfd221f073dffc78ccec3fd9ba6b79b888c76
2020-04-29 09:39:08 +00:00
Tagir Valeev
659710fb77 NullableNotNullManager#findNullabilityDefault: avoid propagating default nullability to local variable type
GitOrigin-RevId: c89c89138ae819767dfecfa2b2e47fc126ecc9f1
2020-04-29 07:15:24 +00:00
Tagir Valeev
5195a3cb84 Support default annotation for types
Fixes IDEA-236740 NonNullByDefault not working with Generic Types.

GitOrigin-RevId: 88bfc4b9dd87bd28f7a137bed4e3271485d89406
2020-04-28 10:51:57 +00:00
Tagir Valeev
d47e93c5e2 findTypeAnnotationInHierarchy -> findAnnotationInTypeHierarchy; javadoc updated (IDEA-CR-58580)
GitOrigin-RevId: f1f50de2e4988c3bc5b3bd6debfcf5d8c84705e9
2020-02-19 08:46:59 +00:00
Tagir Valeev
320de07c32 IDEA-231900 Support TYPE_USE Nls
GitOrigin-RevId: 40c7aedb9cc07d0a1902c2c5f6b46056fe8e34ad
2020-02-19 07:09:55 +00:00
Tagir Valeev
3667540bc6 IDEA-233117 Nullability gutter always present for @NotNull on inner class type annotations
GitOrigin-RevId: 5079867f722ad4d16f22f9b46ce28f4e02a37923
2020-02-18 11:42:56 +00:00
Tagir Valeev
2c486b2d0a Improved type annotation support
PsiTypeElementImpl#addAnnotation implemented
AddAnnotationPsiFix, NullableNotNullManager adjusted
Fixes IDEA-232258 "Annotate overridden method parameters @NotNull" erroneously adds notNull to the param, not its type
Fixes IDEA-232565 Intention "Annotate overriding methods as NotNull" doesn't respect "type use"
Also, AddAnnotationPsiFix can be applied in batch now when annotations are not external.

GitOrigin-RevId: 0b652d3b032ed0d1c701beeda102c5e3c841762c
2020-02-12 06:13:13 +00:00
Tagir Valeev
e31d15867a Code-analysis: bound annotation should win over default annotations
GitOrigin-RevId: 6c3630239906f333c4fc12c4482ecddfa60a0e40
2020-02-03 09:39:27 +00:00
Tagir Valeev
78a91459c4 Array annotations changed to type-use style (not compilable now)
GitOrigin-RevId: 68aa4ba200618083684599228e13dfdba35967a4
2020-01-16 08:11:51 +00:00
Tagir Valeev
00eb737bda Refactor NullableNotNullManager: extract support of particular annotation packages to separate classes
GitOrigin-RevId: 43ed85f1cca9b5feb55048272ac03b20d6a33874
2019-10-16 11:33:31 +00:00
Tagir Valeev
c2af9c1d1f IDEA-224546 "Cannot annotate with both @NotNull and @NotNull" warning
GitOrigin-RevId: 28ff56adebd81918856c5a562cda051e52a33c32
2019-10-10 10:34:02 +00:00
Roman Shevchenko
f03ca2caba Cleanup (deprecated API)
GitOrigin-RevId: 71446641e262a5d79ed77457ef4aafd1d2bf7d75
2019-09-11 21:14:38 +00:00
Sergey Patrikeev
07adca2a57 Add @ScheduledForRemoval for "to be removed in X" APIs.
GitOrigin-RevId: 81633778930c7db30c6ec638cd3f1e68d3fdc201
2019-07-02 06:52:16 +03:00
Rustam Vishnyakov
123242c4b2 EditorConfig documentation test
GitOrigin-RevId: fd52ace3d7a32ecd02c2c5ab90e077967604c15e
2019-06-16 04:03:21 +03:00
Egor Zhdan
c1813cfb52 Cleanup: NotNull/Nullable
GitOrigin-RevId: b8e892f32ea84c2115973155dba7127b892cc36e
2019-06-16 04:02:08 +03:00
Anna Kozlova
91f7445298 constructor reference: don't ignore constructor parameters during method reference inference (IDEA-185578)
GitOrigin-RevId: e836468e05db28157713e9edd3c70382f8ecdebc
2019-06-13 03:15:49 +03:00
Egor Zhdan
39d2d77155 Cleanup: NotNull/Nullable
GitOrigin-RevId: b8e892f32ea84c2115973155dba7127b892cc36e
2019-06-13 03:14:35 +03:00
Tagir Valeev
ed9066772a NullableNotNullManager: javadoc to discourage usage of getNullable/NotNullAnnotation
GitOrigin-RevId: 3c423bd1ffef49dcea41906e67dd6778f80a1563
2019-05-31 10:05:04 +03:00
Tagir Valeev
eade38b537 NullableNotNullManager: explicitly stop nullability check at MonotonicNonNull annotation (consider it as unknown nullity)
Fixes IDEA-214972 Checker Framework's @MonotonicNonNull doesn't seem to cancel @DefaultQualifier(NotNull.class)
Also reduce collection copying in doFindEffectiveNullabilityAnnotation

GitOrigin-RevId: 6b4d65db09f11ba17aa28e47128457cabfea4881
2019-05-28 12:09:08 +03:00
Aleksey Rostovskiy
185284cee6 get rid of intellij.build.toolbox.litegen parameter and use BuildOptions.TOOLBOX_LITE_GEN_STEP to skip it instead
GitOrigin-RevId: 9aac8ee4ed1ebf2a29de18a238825fafb1ab88f9
2019-05-27 15:08:08 +03:00
Alexandr Suhinin
9215f4240b [duplicates] enable duplicates analysis in PyCharm/WebStorm/PhpStorm/RubyMine
GitOrigin-RevId: 1545b79fdca4888f4b94f47f22703fd37694fa7a
2019-05-27 15:07:30 +03:00