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
914432b67a
[java-dfa] IDEA-368172 Nullable return is not reported for lambda parameterized with unbounded type parameter under NullMarked
...
(cherry picked from commit 61623e582c856479d4a2222ef33a73178831e074)
IJ-CR-156030
GitOrigin-RevId: 450b280f93a17b3c8500b6cfeaf9be7464e4edd3
2025-04-01 08:23:22 +00:00
Tagir Valeev
1efe361fe9
[java-inspections] ExtractMethodRecommender: disable for non-denotable output variable
...
Fixes IDEA-364433 "Method can be extracted" with 'var' and anonymous class leads to compile error
(cherry picked from commit 8d2f0b12059c8412ed6e1c91d9b8e79ee70cb31c)
IJ-CR-156964
GitOrigin-RevId: ebc0ceab00b591e4b139f79bd9bdf2fbd24af1ee
2025-03-12 11:16:49 +00:00
Tagir Valeev
f2cfc536e6
[java-inspections] ObviousNullCheckInspection: disable for methods that don't return the parameter
...
Even if the return value is not used, it's subject for IgnoreResultOfCallInspection to report it (as we consider only pure methods). It could sometimes be suppressed (e.g., inside assertThrows), in which case it's desired not to report anything.
Fixes IDEA-368213 False positive and code-breaking autofix for ObviousNullCheck
(cherry picked from commit 0ab2fd64b8a8f8599920cffad76fc830790f8269)
IJ-CR-156868
GitOrigin-RevId: cda30602e0c2af93f21a33501f7ad855b89fda1c
2025-03-10 22:29:02 +00:00
Tagir Valeev
e6aa4536a9
[java-psi] Proper order of annotations inside PsiNewExpressionImpl
...
Fixes IDEA-366918 Wrong order of annotations in new array expressions
(cherry picked from commit 29bbfb29123cd273f4c3d34f74e8a00bc6ab5ec1)
IJ-CR-156763
GitOrigin-RevId: 2eac2a8cae68edddc4f538f164764cb1cdcc2f0d
2025-03-06 10:09:58 +00:00
Tagir Valeev
2954f198ce
[java-dfa] IDEA-365459 "Treat non-annotated members and parameters as @Nullable" inspections makes constructors @Nullable
...
(cherry picked from commit b4c0234154171b658451e9628fd1bbc873e4699f)
IJ-CR-156081
GitOrigin-RevId: 817d0389f7e0da1476a024d538fe588300c6e5e1
2025-02-28 12:47:10 +00:00
Tagir Valeev
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 Valeev
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 Valeev
e6691d9ea8
[java-highlighting] SwitchBlockHighlightingModel.checkSwitchBlockStatements migrated
...
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)
GitOrigin-RevId: 463b1549d45bf98586e6ae9dafb4bc4b330bbe52
2025-02-18 09:36:18 +00:00
Tagir Valeev
2350d69472
[java-highlighting] JavaCompilationErrorBundle.properties proofreading (DOC-34381)
...
GitOrigin-RevId: 05bdca159a63027ea0d1e3d767d4adb9b258f47e
2025-02-14 12:45:24 +00:00
Tagir Valeev
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 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
Mikhail Pyltsin
4543b3fe66
[java-import] IDEA-366927 and IDEA-366926 improve auto-import
...
- fix inspections
GitOrigin-RevId: 629202f11b819d73aadbf9d0a6c6ce85b58bf39b
2025-02-05 15:36:45 +00:00
Bas Leijdekkers
bd5e9ca16b
Java: make "Field can be local variable" Flexible Constructor Bodies aware (IDEA-364189)
...
GitOrigin-RevId: 370bf973497cc428ff1fa8047684c62e793941be
2025-02-05 10:21:50 +00:00
Leonid Shalupov
40795fe787
IJI-2422: community/java: move resources under resources root
...
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00
Bas Leijdekkers
b4544c7a42
Java: clearer name for inspection and quick-fix
...
GitOrigin-RevId: 0ee29991b00d4ac8341c031a4a111b23bb44b800
2025-02-04 14:01:33 +00:00
Bas Leijdekkers
6082a8c4eb
Java: fix false negative on anonymous class argument (IDEA-352287)
...
for "Field can be local" inspection
GitOrigin-RevId: 6343d49ea97183f67765966bf05108c80a4d3094
2025-02-04 14:01:33 +00:00
Bas Leijdekkers
3d0993abb5
Java: FieldCanBeLocalTest cleanup
...
GitOrigin-RevId: 370f0584ecdc2e6229db59d3493b6faba1a04e1d
2025-02-04 14:01:33 +00:00
Bas Leijdekkers
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 Valeev
2b2b8c3e88
[java-dfa] Obsolete disabled test removed
...
GitOrigin-RevId: 9ad982b934c1f100bed7e84a330d0f2a803dde0d
2025-01-29 11:35:30 +00:00
Tagir Valeev
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 Valeev
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 Valeev
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 Valeev
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
Mikhail Pyltsin
3cb38fccaa
[java-imports] IDEA-13817 Create "favorites" for static import and completion
...
- part of "favorites" for static import. Inspection and refactoring
GitOrigin-RevId: a764a70000c3f0918e50a814908e5969b93688d7
2025-01-16 14:21:49 +00:00
Tagir Valeev
e9fe15f4e9
[java-inspections] IDEA-364649 Warning both with and without @NotNull annotation on parameter
...
GitOrigin-RevId: 2d9b88faef2947ef3719040c6078821e3efbf9de
2025-01-10 15:58:52 +00:00
Tagir Valeev
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
Mikhail Pyltsin
23412cfb01
[java-inspections] IDEA-365453 'Switch expression can be replaced with enhanced switch' is proposed for empty switch expressions
...
GitOrigin-RevId: c9363210df47ccfad09802790a095c2108b07498
2025-01-08 11:32:34 +00:00
Tagir Valeev
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 Valeev
315776757a
[java-dfa] DfaCallArguments: do not flush private final variables
...
GitOrigin-RevId: 054aab1ac093caff699f8710576dd929f66b8674
2025-01-02 13:57:07 +00:00
Bas Leijdekkers
24557b8338
Java: fix inappropriate quick-fix for bodyless methods in record (IDEA-299166)
...
fixes error message as well
GitOrigin-RevId: 2b9d54fa48b282dc003753645237ebfdb50c0d01
2024-12-29 13:41:59 +00:00
Mikhail Pyltsin
1c5efb8d49
[java-inspections] IJ-CR-152124 IDEA-365031 Propose on info level convert to record for classes without getters
...
- conditions simplified
GitOrigin-RevId: 6288c1b6cba0503a0416abb4216c99a509ff0467
2024-12-26 10:30:16 +00:00
Mikhail Pyltsin
d3e75c5951
[java-inspections] IDEA-365031 Propose on info level convert to record for classes without getters
...
GitOrigin-RevId: 77f56876a99f3e924bf39232f9cf5a32fb174211
2024-12-20 13:34:02 +00:00
Bas Leijdekkers
2b32d9bb56
Java: basic support for Valhalla Value Classes (IDEA-364548)
...
GitOrigin-RevId: 93b0394866aae35772ccc90e7de822af8a94c6ce
2024-12-18 18:05:29 +00:00
Mikhail Pyltsin
ab52fbdf4e
[java-import] IDEA-364508 support optimize imports
...
- new options are added
- changes for optimize imports
GitOrigin-RevId: 82b0223f9e7e2972d13ab182ea651cdccd28a5d3
2024-12-10 19:06:21 +00:00
Mikhail Pyltsin
3c78fe69e6
[java-inspections] IDEA-363980 Support JEP 495. Update ImplicitToExplicit /ExplicitToImplicit inspections
...
- tests
GitOrigin-RevId: 946428cb5f8e397625acbec9446d731fb0550225
2024-12-06 19:03:38 +00:00
Tagir Valeev
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 Valeev
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 Valeev
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 Valeev
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 Valeev
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
Mikhail Pyltsin
13e4c24bba
[java-inspections] IDEA-364128 Inspection PatternVariableCanBeUsedInspection shouldn't propose converting for variable
...
- skip cast for variables
- not extend parameters for cast
GitOrigin-RevId: 6eb3a63d923fd1625c2c593afb65ce5762a1c0e4
2024-12-02 14:36:32 +00:00
Mikhail Pyltsin
cccb22d78e
[java-inspections] IDEA-360429 Support guards in switch UAST
...
GitOrigin-RevId: 6679acb5d8380073f75ef7be8a8261c59e6b392b
2024-12-02 11:30:30 +00:00
Tagir Valeev
9d5757374f
[java-inspections] OverwrittenFieldAnalyzer: set initial field write anchor to prevent subtle bugs
...
GitOrigin-RevId: 5138540545f8553a96a4cad042ed87e71d223dd6
2024-11-29 17:30:18 +00:00
Bartek Pacia
6682d9efc3
[java-inspections] Non functional style Optional.isPresent - missed opportunity
...
IDEA-360860 fixed
* split tests into individual methods, to make debugging easier
* add javadoc for VariableAccessUtils#isVariableTypeChangeSafeForReference
(cherry picked from commit f6b3468079959f7adec737e0b8ec3ad1d97e7ad2)
IJ-MR-150176
GitOrigin-RevId: 4b430e49819c7cba1e08ecee47b881f05be570d4
2024-11-28 23:23:40 +00:00
Mikhail Pyltsin
7404f51dfc
[java-inspections] IDEA-286507 Warn when colon-style expression switch uses yield or throw in every branch
...
GitOrigin-RevId: 2e79504ab44609427f51fe5652cb995ec72d17d6
2024-11-26 16:55:45 +00:00
Tagir Valeev
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
Tagir Valeev
6a6e2c2eca
[java-inspections] OverwrittenFieldAnalyzer: Fix branching and method call handling (IDEA-362869)
...
GitOrigin-RevId: 4695c81d99d13cec4d04d64c5c97a2837765eac8
2024-11-22 15:34:30 +00:00
Mikhail Pyltsin
dc39a8897c
[java-inspection] IDEA-363631 Highlight redundant instanceof with primitive type
...
- add one more test
GitOrigin-RevId: b9b75efe82711ceb4179614b2bab696b6058c02f
2024-11-21 14:58:08 +00:00