Mikhail Pyltsin
46bfa503aa
[java-import] IDEA-364508 support optimize imports
...
- new options are added
- changes for optimize imports
(cherry picked from commit 82b0223f9e7e2972d13ab182ea651cdccd28a5d3)
GitOrigin-RevId: 99f0276e1d9464f75f5bbce91ad09727582d208b
2025-02-13 14:23:52 +00:00
Mikhail Pyltsin
dcb8e7a582
[java-inspections] IDEA-363980 Support JEP 495. Update ImplicitToExplicit /ExplicitToImplicit inspections
...
- tests
(cherry picked from commit 946428cb5f8e397625acbec9446d731fb0550225)
GitOrigin-RevId: b7240b0999796cb367dd01eb49ff51b63004de94
2025-02-13 14:23:52 +00:00
Tagir Valeev
3eea2c8961
[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
(cherry picked from commit 9a49f5687eccaa013e639cdf15950be911e100bc)
IJ-CR-151033
GitOrigin-RevId: be6c25b7e63a9d231077351fd0bf813515e7f9bf
2024-12-09 17:46:27 +00:00
Tagir Valeev
b6f684ed23
[java-dfa] IDEA-363270 Misleading warning for switch case when expression on Boolean values
...
(cherry picked from commit 449fdf6cb9137b7dcd038adca7b26ffc15f7d59a)
IJ-CR-150040
GitOrigin-RevId: 957b8f5555a16e1e4912bc19bfe9ff133715709b
2024-11-25 14:43:15 +00:00
Mikhail Pyltsin
b95c1b84e7
[java-inspections] IDEA-360880 Replace cast expressions with pattern variable does nothing inside of ternary operator
...
- use PsiStatement as scope instead of PsiIfStatement
- more tests
(cherry picked from commit 2602190296988a80d54520c7a0f15fd0f8e3d942)
IJ-CR-147991
GitOrigin-RevId: 45d61e2aa9e70c3aa68032d21a77f05754a76534
2024-11-12 11:25:29 +00:00
Mikhail Pyltsin
21b790bb3f
[java-inspections] IDEA-360755 Convert to enhanced switch erases the default value
...
(cherry picked from commit 7562bb688c2bf6e93bab7537113bb54246949006)
IJ-CR-147994
GitOrigin-RevId: 07dc28c498da2f45ccf2dd0d88c9f603ddfb46b1
2024-10-30 20:48:51 +00:00
Tagir Valeev
88e99a58b4
[java-dfa] Fix hardcoded contract for three-arg Arrays.binarySearch method (IDEA-359546)
...
(cherry picked from commit a4ff22126f7d6fc1b4a7d99ee47c3caf1b144c4c)
GitOrigin-RevId: 74f0bae69219b650eb170bc517e5c1bc0b1d9ad2
2024-10-17 13:15:40 +00:00
Tagir Valeev
bad69926e7
[java-inspections] Class can be record: fix Javadoc refs as well (IDEA-356432)
...
GitOrigin-RevId: 3dc09d1554037b46773b05b973b4a5905e5b3fe5
2024-10-14 15:13:57 +00:00
Tagir Valeev
676c19bc1f
[java-inspections] Report TYPE_USE nullability annotation on classes
...
GitOrigin-RevId: f5c6113ccd1738d72b0f58fe13a8352a043431c9
2024-10-11 08:10:27 +00:00
Tagir Valeev
8ea673ff41
[java-analysis] PsiSubstitutorImpl: better preserve context; more tests
...
GitOrigin-RevId: 4765f00cf6a5eafe902b9fae73c450f475e3d8c8
2024-10-08 20:08:05 +00:00
Tagir Valeev
f5463b7662
[java-inspection] NullableStuffInspectionBase: better determine annotation name
...
GitOrigin-RevId: 1c00dc9d26ce2e8ebf78379fefbd6b3a9e764007
2024-10-08 20:08:05 +00:00
Mikhail Pyltsin
066fa7fe85
[java-inspections] IDEA-360279 Narrow the scope for ImplicitToExplicitClassBackwardMigrationInspection
...
GitOrigin-RevId: 7d1e2b8da9983291201eb214f9437c68aaa12b87
2024-10-08 16:45:11 +00:00
Mikhail Pyltsin
a9a1a18b94
[java-inspections] IDEA-357275 "Convert class to record" quickfix throws IOE when inherit compiled class
...
GitOrigin-RevId: 3fef0a37b006d12b2728b98454071d0fd7d3b24f
2024-10-07 18:58: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
1de7339d44
[java-inspections] Class can be record: automatically use accessors if the fields are not accessible
...
Fixes IDEA-356432 'Convert to record class' could handle public fields more intelligent
GitOrigin-RevId: c1c458275e808e3c95e2a24a9a8c1919ac25011b
2024-10-04 17:21:43 +00:00
Tagir Valeev
9a88df1dad
[java-inspections] JSpecifyAnnotationSupport: do not apply NullMarked to cast type
...
Fixes IDEA-351866 jSpecify's @NullMarked influences 3rd party packages
GitOrigin-RevId: 418545583d0f421ec678d1c840e0eed11ff765bc
2024-10-04 17:21:43 +00:00
Bas Leijdekkers
2f23d849ea
Java: fix "Duplicate branches in 'switch'" inspection false positive on method reference (IDEA-355483)
...
GitOrigin-RevId: 0d5e06632a349494f05b79dab40d37988fdd7412
2024-10-03 18:24:19 +00:00
Tagir Valeev
b223a53bc3
[java-dfa] NotNullByDefault: implicit Object bound is affected by annotation; more tests (IDEA-359811)
...
GitOrigin-RevId: a3576ee5f2b100b7e68536881a55d0c9a2f9771b
2024-10-02 14:26:44 +00:00
Tagir Valeev
2f492127fc
[jspecify] IDEA-356144 JSpecify: Nullable upper bounds do not result in proper nullness
...
GitOrigin-RevId: 0b3a0065217879ca2ee2d70ee5fec2c41dba7bae
2024-10-01 10:42:29 +00:00
Bas Leijdekkers
af458693d5
Java: don't insert unnecessary casts on inlining method (IDEA-203962)
...
GitOrigin-RevId: c3f441b42d164438b1035112083a8114735a0a05
2024-10-01 09:31:57 +00:00
Tagir Valeev
1502820f0d
[jspecify] Update conformance tests to the latest
...
GitOrigin-RevId: 4bbf474f026e0c0ebde67536ae4dd45ffdfda3dc
2024-10-01 08:57:46 +00:00
Tagir Valeev
087825794e
[java] IDEA-359811 Support experimentally container annotation @NotNullByDefault
...
GitOrigin-RevId: 0f02149f8f9313357bab47e7d62d6f1ccfea6f9b
2024-09-27 10:37:49 +00:00
Tagir Valeev
ca9649997b
[java-inspections] Properly report 'not applicable on locals' warnings
...
IDEA-355699 Warning when annotating array elements as nullable with JSpecify
GitOrigin-RevId: ca9a3e0ea2ef3aa01d31afcaff2f92193af14dbe
2024-09-25 11:10:24 +00:00
Tagir Valeev
c3ecaaa190
[java-dfa] More annotations; annotations for comparators; warn on nullity violation from methodref return
...
GitOrigin-RevId: d0b1a4967d361f409d4d25562c595e2812fc8044
2024-09-19 19:06:26 +00:00
Tagir Valeev
35c9c6ca5a
[java-dfa] Basic support for Unmodifiable type annotation
...
GitOrigin-RevId: 4bc07e2533efa45356ba26b89c065b453a40d253
2024-09-18 20:27:35 +00:00
Tagir Valeev
b50767f679
[java] Basic support for external type annotations
...
Only in XML directly; no editing UI for now; no inlays for now; only for libraries (Cls), currently no intent to extend to sources (Psi)
Part of IDEA-231901 Support TYPE_USE in external annotations
GitOrigin-RevId: 672ed09f57ffc40b61e8fe4dd33d0f9acdac92dc
2024-09-18 20:06:30 +00:00
Yuriy Artamonov
47f1c44a90
[java] IJPL-158521 Actions: fix ellipsis in messages for Java actions
...
GitOrigin-RevId: bfce0d6efa8747660c4b9af3d8defbfa47e4509a
2024-09-15 14:50:09 +00:00
Aleksey Dobrynin
f590114d83
[java, highlighting] Fix module conflict highlighting for exported packages IDEA-352819
...
GitOrigin-RevId: d4479fb863280674ae8960c930e6e8b1628b7321
2024-09-13 06:24:34 +00:00
Tagir Valeev
c22a9186f9
[java-inspections] Support simple chaining in NotNullFieldNotInitializedInspection
...
Fixes IDEA-145194 Do not report 'Not-null fields must be initialized' when field is initialized indirectly
GitOrigin-RevId: c3bae51deaedbbbb4d035e5d7d3b55f2ca9b8c03
2024-09-11 20:52:54 +00:00
Tagir Valeev
7e2050cf72
[java-inspections] MagicConstantInspection: test to ensure that parameters and fields do not propagate automatically
...
GitOrigin-RevId: 7053c2c950894e6694353e90d77cb1f2ff772fb3
2024-09-04 12:07:39 +00:00
Bas Leijdekkers
0c4fc2ab23
Java: don't suggest to "Replace with text block" a text block (IDEA-358449)
...
GitOrigin-RevId: 4db08b1a6a9e5bb3c957e23af185e6df1f757c47
2024-09-02 21:52:50 +00:00
Tagir Valeev
84ce93ddc5
[java-dfa] Test for IDEA-357456
...
GitOrigin-RevId: b7b97300c5a4512009b006cdfafeba56bcfe4c69
2024-09-02 21:01:25 +00:00
Tagir Valeev
cd2be32f62
[java-inspections] Java9CollectionFactoryInspection: copyOf: respect declared nullity of source collection
...
Fixes IDEA-349386 Don't suggest List/Set/Map.copyOf when elements are annotated @Nullable
GitOrigin-RevId: f2c1298394f204732437d304f68272f6cf406cc0
2024-08-29 18:27:57 +00:00
Tagir Valeev
07c73fd64a
[java-dfa] Recognize String.strip/stripLeading/stripTrailing/isBlank
...
Also: limit the length of the resulting string if the length of the original string is known
GitOrigin-RevId: bfe3752b15949047366c3d3d79c7d13a49193abd
2024-08-29 14:08:22 +00:00
Tagir Valeev
13845dd38c
[java-dfa] Call restrictFromState when we track chained qualified value as well
...
It's possible that we track chained qualifier value only. E.g., under if (!str.trim().isEmpty()) we store nothing about str.trim, but we know that str.trim.length is 'int >= 1'. So if later we get a new fact about str, like if (str.equals("\n")), we still should call restrictFromState, as this fact implies that str.trim == "" and str.trim.length == 0, contradicting the current memory state, so we should not apply such a fact.
Fixes IDEA-357897 DFA produces exception: Precalculated value description.trim mismatches with method handler
Should fix at least partially EA-1080132 ISE: MethodCallInstruction.getMethodResultValue (String.trim, Enum.name)
GitOrigin-RevId: 47849768da15f2878957a0fcce9e358152fbd7e4
2024-08-28 17:54:26 +00:00
Tagir Valeev
59325634ab
[java-inspections] IDEA-356832 Inspections ignore redundant Class::cast method call
...
GitOrigin-RevId: 390a19d69020bc91f1395e6c4d23f14992ca396b
2024-08-28 17:54:26 +00:00
Mathias Boulay
d56883b763
fix(JavaDoc): formatter, inspections
...
GitOrigin-RevId: 77686401cbf38ea31e93311a608bac7472ccc73c
2024-08-26 10:42:10 +00:00
Mikhail Pyltsin
d3b39b27a9
[java-inspection] IDEA-357079 Convert switch expression to old style switch with boolean selector: do not add default branch
...
GitOrigin-RevId: c02a9cd74b36adbf1e46c012cce3ef4c490c4eb9
2024-08-02 22:53:47 +00:00
Mikhail Pyltsin
e9fdbf0b00
IJ-CR-141547 [java-inspections] IDEA-356841 Convert to switch expression generates invalid code on line comments
...
- support comments in the middle
GitOrigin-RevId: a56684193791a8dfc086843756796d0cbd5cf571
2024-08-02 18:19:13 +00:00
Mikhail Pyltsin
ccf2a6bae5
[java-inspections] IDEA-356982 PsiImplicitClass is created for certain invalid code and renders the whole file gray
...
- skip implicit classes in unused analysis
GitOrigin-RevId: 6eb880108723b3623b0cc449d76f9f87942fc8b7
2024-08-01 16:00:34 +00:00
Mikhail Pyltsin
1c6e73ad39
[java-inspections] IDEA-356841 Convert to switch expression generates invalid code on line comments
...
GitOrigin-RevId: 840ad7d5fe656b7cc443b67df30f60b0bb35b41d
2024-08-01 12:29:33 +00:00
Bas Leijdekkers
c014a1f2f1
Java: render incomplete polyadic expressions correctly (IDEA-356837)
...
GitOrigin-RevId: 6b9de40ba5ba85a0a27a1e7e8f85150058510fc9
2024-07-30 22:37:25 +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
Tagir Valeev
01e84b64d3
[java-inspections] Annotate parameter as Nullable: support record components (IDEA-356915)
...
GitOrigin-RevId: d9d972ba2559077b345aa65e447f7b24025be23c
2024-07-30 16:34:11 +00:00
Mikhail Pyltsin
d186699847
[java-inspection] IDEA-355916 update implicit<->explicit classes inspections
...
- tests
- optimize imports
- ReplaceOnDemandImportIntention supports module imports
GitOrigin-RevId: 228135179fc26f44064dd196ae70326fd91fb3ee
2024-07-26 12:44:48 +00:00
SirYwell
f49ee04957
[java-inspections] Fix false warnings on signature polymorphic method lookup
...
PR#2804
Reviewed-by: Tagir Valeev <tagir.valeev@jetbrains.com >
GitOrigin-RevId: 28a1abe7b3d83e40737df88c5ce1d39933858755
2024-07-17 09:49:37 +00:00
Tagir Valeev
79a4788e62
[java-dfa] Fix additionMayOverflow for long values
...
It appears that one cannot represent additionMayOverflow as a negation of subtractionMayOverflow, due to the special handling of Long.MIN_VALUE
Fixes IDEA-356345 "Constant values" false-positive, when adding Long.MIN_VALUE to a negative number
GitOrigin-RevId: 5144b29023860aab3be05edbeffe7527b4793337
2024-07-17 08:36:52 +00:00
Tagir Valeev
c53b8ee683
[java-dfa] TimeUnit.convert contract: returns first arg if qualifier is equal to the second arg
...
Also, report if the result is equal to the first arg (part of IDEA-172428)
GitOrigin-RevId: 1a9743305e75f1fdb772c7287e8cee0068bd31e1
2024-07-11 19:20:37 +00:00
Tagir Valeev
c2e018c7e3
[java-dfa] Do not flush the pure method result facts
...
Otherwise, we lose locality
GitOrigin-RevId: aed2cd27ea1c412f16deaaea346791484e02f390
2024-07-05 19:36:03 +00:00