Commit Graph

3126 Commits

Author SHA1 Message Date
Tagir Valeev
960e3448ae [java-psi] IDEA-377693 Support unbounded wildcards
Better implementation through the PsiCapturedWildcardType

GitOrigin-RevId: 35c30dcf936bd96e17c72795cc6fe09a370ccb9e
2025-10-01 15:50:23 +00:00
Tagir Valeev
ca97498b37 Revert "[java-psi] IDEA-377693 Support unbounded wildcards"
This reverts commit 5283895c887c59b3b4386c51ce2a06c67688e170.

GitOrigin-RevId: b56c4733616caed180dc170d6b73a30d0eb31321
2025-10-01 15:50:23 +00:00
Tagir Valeev
cce68d9b4d [java-inspections] IDEA-377761 Incorrect usages of annotations. Opposite container annotations together
GitOrigin-RevId: 2a9ceb46787ef8cdff3677cd1c1c72782951c9cc
2025-09-30 17:43:53 +00:00
Tagir Valeev
f6b49100b4 [java-psi] IDEA-377693 Support unbounded wildcards
New exceptions are added with a discussion opened in JSpecify tracker:
https://github.com/jspecify/jspecify/issues/771

GitOrigin-RevId: ebcd3cfb99fc26e8b18c4c4ab25b10ed74ca8c11
2025-09-30 08:46:32 +00:00
Bartek Pacia
9f4e296856 [chore] re-enable formatter for Markdown Javadocs containing code blocks
The formatter had to be disabled because of IDEA-371809, but that bug is now fixed.

GitOrigin-RevId: ffe7eb9e3ed02f2b73f3c312d30380e92e42d97a
2025-09-29 12:41:26 +00:00
Georgii Ustinov
bf0b7011c2 [Groovy] IDEA-355525 instance main methods for groovy
GitOrigin-RevId: 3761ed4dafb616e9f6d99a68430c6d8581ecbdda
2025-09-29 10:44:34 +00:00
Ilia Kirianovskii
f43aa95086 [bazel] Update build files (IJI-3062)
GitOrigin-RevId: 98a67396a48bddc3d084cc93c50ae2f2017bfe8c
2025-09-29 00:11:15 +00:00
Tagir Valeev
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
Bas Leijdekkers
ff4d693212 Java: introduce PsiArrayInitializerMemberValue.getInitializerCount() (IJ-CR-176760)
GitOrigin-RevId: d2cd802dbb3edff7218517221db96b39840e720a
2025-09-26 14:02:14 +00:00
Bas Leijdekkers
1143fea0b7 Java: introduce PsiArrayInitializerExpression.isEmpty() as well (IJ-CR-176760)
GitOrigin-RevId: 2f0757929d780ff01930cc8001001daf59ec4500
2025-09-26 14:02:14 +00:00
Bas Leijdekkers
5db7b62f2e Java: improve javadoc
GitOrigin-RevId: 24c2aaa7182c9a19734b9c639ac700d58bc6df5c
2025-09-26 14:02:14 +00:00
Tagir Valeev
ac74ac484e [java] IDEA-379795 Add hasAnnotations() to PsiAnnotationOwner, PsiModifierListOwner and TypeAnnotationProvider
GitOrigin-RevId: dbe2d9508f45fb5bbbff26c1ba81792f5120c690
2025-09-26 11:09:02 +00:00
Marcin Mikosik
2ea0d03d4d [java] IDEA-379571 Improve PsiPackageStatement.getAnnotationList() so it never returns null value.
#IDEA-379571 Fixed
Merge-request: IJ-MR-176432
Merged-by: Marcin Mikosik <marcin.mikosik@jetbrains.com>

GitOrigin-RevId: 0d575fd55751ccac0b098b189ba3e90bbb081299
2025-09-26 08:03:20 +00:00
Mikhail Pyltsin
a99d6a79da [java-highlighting] IDEA-378781 Quick fixes for typos in keywords
- more cases
- move primitive types to PsiTypes.java

GitOrigin-RevId: 3a94f2e8fe84e9e2cb95d84bc7ebb13f77579916
2025-09-24 17:40:19 +00:00
Tagir Valeev
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
Mikhail Pyltsin
eebb6c4bb2 [java-highlighting] IDEA-378781 Quick fixes for typos in keywords
GitOrigin-RevId: 3984441825712d7f566461eaea10748d5b78f024
2025-09-22 14:16:34 +00:00
Bas Leijdekkers
a1c7ca404c Java optimization: introduce PsiArrayInitializerExpression.getInitializerCount() and use it where possible (IDEA-375485)
GitOrigin-RevId: 1d54ca3773469a22db195a1667ce21cdc679a324
2025-09-19 17:27:37 +00:00
Bas Leijdekkers
99dc01d75a Java: annotate PsiExpressionListStatement.getExpressionList() as @NotNull
GitOrigin-RevId: 509212ab37f403b04109dc7535cc4a6e1fdf3478
2025-09-19 17:27:37 +00:00
Tagir Valeev
fbd13ff64c [java-psi] IDEA-377644 PsiImmediateClassType, PsiArrayType: reset nullability when annotations changed
Also: do not merge annotations during the substitution (unnecessary anymore after nullability is implemented and causes problems)
Some tests that rely on annotation merging during the substitution are removed/updated. The behavior was inconsistent anyway.

GitOrigin-RevId: c13e68616507bbb10cbe0384d122334879e166df
2025-09-18 15:04:14 +00:00
Tagir Valeev
f34bbe78ef [java-psi] Contract annotations
GitOrigin-RevId: 2fbd0d37d08dbb2a2db3bae9ed1c5cf115663f1a
2025-09-18 15:04:14 +00:00
Louis Vignier
115c73bc1e [javadoc] Highlight unresolved fragment references
IJ-MR-174748
#IDEA-376337

GitOrigin-RevId: 4352c370375c968392ea81cdcfab262ebd7fa5ab
2025-09-17 19:25:19 +00:00
Louis Vignier
3cf7c13a11 [javadoc] Add interfaces for fragment reference PSI elements
IJ-MR-174748

GitOrigin-RevId: 0db4a62e4216d01f52e49dfbe68f94654709c097
2025-09-17 19:25:19 +00:00
Bartek Pacia
2b6f045d49 [java-psi] main method utils: improve Javadoc a bit
GitOrigin-RevId: 94e7625f0541742bedb9d8a327e9870510895004
2025-09-17 16:10:41 +00:00
Bartek Pacia
4979c6d877 [java] IDEA-364759 JavaMainMethodProvider and PsiMethodUtil: create getMainClassQualifiedName()
This also deprecates PsiMethodUtil#getMainJVMClassName and JavaMainMethodProvider#getMainClassName because they are badly named and have no usages that make sense.

GitOrigin-RevId: fab10314a594d94b8f1b7eb76b451f77f284a6eb
2025-09-15 22:53:18 +00:00
Max Medvedev
934b1eedf2 add docs for PsiPackage#containsClassNamed
GitOrigin-RevId: 3b1147a5b04647e68e88e4f60a3bbd587dd9afae
2025-09-14 16:43:37 +00:00
Max Medvedev
3db4905b69 IDEA-367535 add docs for PsiPackage#findClassByShortName and its impl
GitOrigin-RevId: 2a0aee458ece289d1d306ad9ce9f81d6b7ef332b
2025-09-14 16:43:37 +00:00
Max Medvedev
7429c6c37a IDEA-367535 use more descriptive shortName parameters instead of name
`name` is ambiguous, it can stand for `shortName` or `fully qualified name`

GitOrigin-RevId: d6327ca368925fe35946134275d6d468cc9b9c76
2025-09-14 16:43:37 +00:00
Tagir Valeev
56f9ec5abb [multiple] cleanup: ClassFilter as a functional interface; convert anonymous classes to lambdas/method references
GitOrigin-RevId: e30b38c2fa0e3c59eee568e15a16fbf868e77cbf
2025-09-12 16:59:10 +00:00
Tagir Valeev
2bd42bb487 [java-intentions] IDEA-379168 Suggest renaming underscore variable when it's used.
GitOrigin-RevId: eb0cfd7ddf8d5d730198ea5cd064cca79724348e
2025-09-11 18:13:46 +00:00
Mikhail Pyltsin
2c84ccce06 IJ-CR-175022 [java-highlighting] IDEA-378880 False compilation error in a compact source file
- add javadoc

GitOrigin-RevId: 7bd65e9f5046b505efde747f5dd65540612f9a80
2025-09-10 11:58:31 +00:00
Mikhail Pyltsin
1063c3b546 [java] IDEA-379006 Bump Java language level to 25 for java plugin
GitOrigin-RevId: 1160ed19d25744b92f428fc372552d0321e5202a
2025-09-10 11:58:31 +00:00
Bartek Pacia
8b29bed2b9 [java] MethodSignatureBase: throw ISE with clear error message instead of AE
GitOrigin-RevId: f85e17eff3e8c918561ebc7ca6d31731f7cb8b97
2025-09-09 16:47:21 +00:00
Mikhail Pyltsin
c2d7c558ee [java-highlighting] IDEA-378880 False compilation error in a compact source file
- disable correction by scope for classes inside compact source files

GitOrigin-RevId: 44831301a6c14f60d26ae4715df18c4cd24e1ee8
2025-09-09 12:11:34 +00:00
Tagir Valeev
4b06f4efee [java-psi] Disable nullity processing during upper bound capturing
We rely on PsiCapturedWildcardType identity when creating recursive types (the upper bound of a PsiCapturedWildcardType may refer to the same type). However, when we are under NullMarked annotation, the PsiCapturedWildcardType instance could be recreated, which prevents us from creating a proper PsiType object.
Fixes IDEA-378142 Regress issue with resolve type of returned generics value

GitOrigin-RevId: 4fb3c306e302715ab8de93f606397cd2a3dcb864
2025-09-08 19:06:53 +00:00
Bartek Pacia
f9c0d46abd [java] Add Javadoc to PsiIntersectionType and GenericsUtil#getLeastUpperBound
GitOrigin-RevId: 61e1e32b21ce1213534b94132f12a0700fe70a3e
2025-09-04 18:38:28 +00:00
Georgii Ustinov
8fb486f0c9 [Java. Code Formatting] IDEA-168035 Treat jspecify annotations as type annotations in formatter
- Add module import for jetbrains annotations

GitOrigin-RevId: c42016573959a8e9815b479d4517b3143a9bc2b2
2025-09-02 10:50:25 +00:00
Georgii Ustinov
ad9133f69f [Java. Code Formatting] IDEA-168035 Treat jspecify annotations as type annotations in formatter
- Use language level from module and fix tests after this
- Check name of the import module explicitly

GitOrigin-RevId: a0cd8502f4d3d00c9de8b38cea66f61eb3e940d1
2025-09-01 15:05:49 +00:00
Georgii Ustinov
560cafcc94 [Java. Code Formatting] IDEA-168035 Distinct annotation formatting option for type/value/field/method annotations
- Add support for module imports checking for type annotations

GitOrigin-RevId: 780b2a8d63884214c7670b2df69b27552f407ff2
2025-08-28 16:10:40 +00:00
Georgii Ustinov
168c2a50db [Java. Code Formatting] IDEA-168035 Distinct annotation formatting option for type/value/field/method annotations
- Add jspecify nullability annotations as known type annotations

GitOrigin-RevId: 6560fc183a995a7c5b43b50e0c27995df090b7a6
2025-08-28 16:10:40 +00:00
Bartek Pacia
2cbcb44c79 [java-psi-api] IJ-CR-172416 Undeprecate ClassUtil#getJVMClassName
Instead, we simply document the differences between ClassUtil#getJVMClassName and ClassUtil#getBinaryClassName.

GitOrigin-RevId: 36e51c5ad57eba54bfa365b0473eb71e634d5d2d
2025-08-26 12:55:56 +00:00
Aleksei.Cherepanov
c7515bfd3a KTIJ-35250 [Bazel] Promote "Missing dependency superclass" warning to error (part 2)
This commit enables check only for modules WITH a Kotlin facet
Bazel generator was updated as well

GitOrigin-RevId: 90a3427d4b5a3ebc29e257693cb3748ac09bfc6a
2025-08-24 18:49:00 +00:00
Ilia Kirianovskii
dc268560b6 [bazel] Update build files (IJI-2835)
GitOrigin-RevId: 275260ab73f59d3c08f0b4cb9f4c89b74054094a
2025-08-20 08:49:22 +00:00
Marcin Mikosik
0ed1dcdfe9 [java] Improve javadocs in PsiClass
PsiClass contains methods "getAllInnerClasses" "getInnerClasses" "findInnerClassByName". They are misnomers. They actually returns nested classes. There are two categories of nested classes:  non-static nested classes (also called inner classes) and static nested classes.
We cannot fix the name easily but for now I fixed javadocs.

Merge-request: IJ-MR-171498
Merged-by: Marcin Mikosik <marcin.mikosik@jetbrains.com>

GitOrigin-RevId: 8c5c173c27069b0d8185fddadca7574ee0e8e681
2025-08-14 12:26:52 +00:00
Max Medvedev
6d9e4203b7 IJPL-339 mark multiverse APIs experimental
GitOrigin-RevId: 204ea71b172e0ef282db999be7bf1eb6e4ede2de
2025-08-05 19:31:10 +00:00
Bart van Helvert
1aca405c20 [java] Fix assertion that would be thrown on broken code
Don't process parent overloads when inferring the functional expression parameter type if the expected type can already be deduced from the parent. #IDEA-376855 Fixed

GitOrigin-RevId: b1d12d47e713267506bc7a55d83b5bd68b6b380f
2025-08-05 13:28:44 +00:00
Tagir Valeev
ac013e30b2 [java] Make default annotations context-dependent
Default annotation is now defined from PSI context using an ordered list of nullable or notnull annotations. The first available annotation is selected.
For Spring Boot 3, default annotation is org.springframework.lang.NonNull/Nullable
For Spring Boot 4, default annotation is org.jspecify.annotations.NonNull/Nullable
Legacy settings with an unordered annotation list are converted to make them ordered
Non-context-specific default annotations are still used as a default for external and inferred annotation; also it's a fallback option in contexts where no annotation is available at all
ChangeNullableDefaultsFix is removed, as now it's unlikely to produce the desired result (and probably was not useful before as well)
Fixes IDEA-372145 Support for third-party nullability providers

GitOrigin-RevId: 31794eb024ba310ca35d4b3df33420d0bb344898
2025-07-17 15:56:29 +00:00
Mikhail Pyltsin
33488c1660 IJ-CR-167991 [java] IDEA-375376 Support JVM Runners for new instance main methods
-small refactoring

GitOrigin-RevId: 90f8ebc2feae64cb504e0ada6a5625bd25d0b6c9
2025-07-15 09:07:21 +00:00
Tagir Valeev
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 Valeev
bf33ec4ff9 [java-psi] NotNull package name (IJ-CR-168611)
GitOrigin-RevId: f7aa536b3c3d2b4414d5619dc54067bed8b82c80
2025-07-11 17:16:17 +00:00
Mikhail Pyltsin
b5dcf9d6d5 [kotlin][java-highlighting] KTIJ-34788 IDEA-372969 False negative: Instance 'main' method should be highlighted as unused
- check if it is java for instance main methods

GitOrigin-RevId: b848579f6fad413393198c974154e96288b83937
2025-07-10 16:09:13 +00:00