Commit Graph

5559 Commits

Author SHA1 Message Date
Mikhail Pyltsin
d6bb45a7d4 IJPF-CR-29151 [java] IDEA-374204 JEP 512: use 'Compact Source Files' for implicitly declared classes
- fix naming

(cherry picked from commit 91c2c095f5ca3b2ac3d6fc6de8d85b4f7205cfe7)


(cherry picked from commit e9c066e0a80b0154b69f1cf94334ab1e209dd74f)

IJ-MR-169535

GitOrigin-RevId: 305bc4173b42de65872f95e867b193eaef35a8c8
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
08cc5dd193 [java-highlighting] WIP IDEA-372968 Support JEP 511: Module Import Declarations
- test for quick-fix "increase language level"
- fix templates

(cherry picked from commit 37009091dc826c81d496e90cdb3a2c3b2da147c3)


(cherry picked from commit c0f3ed9451db84ec02e4e3af118f82f5bc4d7fdf)

IJ-MR-169535

GitOrigin-RevId: 7e4152035b0502b6229747ef55056b5cd613359a
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
a20e0b6340 [java-highlighting] IDEA-369743 Incorrect proposed language level for fixes for "statements before super"
(cherry picked from commit 94aaaa37713d2df34c939298d3bc1be721e7ac38)


(cherry picked from commit 864adf41e4b630de48aebd9719b39e24777aa890)

IJ-MR-169535

GitOrigin-RevId: 88137eae05c26682b1a373a59cea99d25aea0577
2025-08-04 12:58:50 +00:00
Mikhail Pyltsin
26de6fc1df [java-highlighting] WIP IDEA-372969 Support JEP 512: Compact Source Files and Instance Main Methods
- update language levels partially
- fix tests

(cherry picked from commit 8d7b599772eda8dfd999bee9f816ec2609be4adb)


(cherry picked from commit 98a507ba78b8fc496651b5800fc3936c9c87b689)

IJ-MR-169535

GitOrigin-RevId: 898e8b4dfc303eb60da6cfff5d756304c461c424
2025-08-04 12:58:49 +00:00
Mikhail Pyltsin
2111b032dc [java-highlighting] WIP IDEA-372968 Support JEP 511: Module Import Declarations
- nothing changed in jep, more tests

(cherry picked from commit 03e655a19855acdfe1f7983b25c6aa7158b73393)


(cherry picked from commit fab1d353a464fd4585aa86ef7fe7595f01793aa5)

IJ-MR-169535

GitOrigin-RevId: 1c0782d7c341c0f9e2ff1b3704f13e5e94dadcb7
2025-08-04 12:58:49 +00:00
Mikhail Pyltsin
88d9028b60 [java] IDEA-374214 Support JEP 507: Primitive Types in Patterns, instanceof, and switch (Third Preview)
- there aren't changes, just new tests for java 25 and java 25 preview

(cherry picked from commit 1d73ea675b90c8e3380152ecbad6853431400e2d)


(cherry picked from commit eaa5a77e47e7b9ff4b423d1080c4e0b5c399fd69)

IJ-MR-169535

GitOrigin-RevId: 448392699fa88bee2d06bf0b4949f5d33405c986
2025-08-04 12:58:49 +00:00
Mikhail Pyltsin
a631076474 [java] IDEA-374204 JEP 512: use 'Compact Source Files' for implicitly declared classes
(cherry picked from commit e77a013fa84cbafbfec866f6489147115532f656)


(cherry picked from commit 4619021e3dc70c3bec362b174b02a25212b954db)

IJ-MR-169535

GitOrigin-RevId: 639568fba9e6ac43f505e88d4cd5510f6203dd55
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
7737d87729 Java: fix error message when assignment before chained constructor call (IDEA-375281)
(cherry picked from commit 49c4a8ce04845726d1c35aa114612bf5410e1a37)


(cherry picked from commit 65c5e6c26545cad86d03d71f9d1ab818b4f8e1af)

IJ-MR-169535

GitOrigin-RevId: 099919c02438d74a307aa939f2128ad00aac15f9
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
0321ccb557 Java: detect method call before supertype constructor called in anonymous class argument list (IDEA-375801)
(cherry picked from commit 0066baefa439fe1eccf838ffb863c0a0753260d4)


(cherry picked from commit fad6252a4945573dedadc7ae3c5a3d4c2454527f)

IJ-MR-169535

GitOrigin-RevId: 9c2b45cc8db846b9850ad89ce1673356a3d1da8a
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
a1481db89d Java: report primitive patterns in switch after case null branch correctly (IDEA-374619)
(cherry picked from commit 3afe71cd1d81188830b1cc332689f42c33e8da8b)


(cherry picked from commit d82959372171236d6d5f36dce4da5e615a3c4790)

IJ-MR-169535

GitOrigin-RevId: 07628789dd9e46eac39c3811ca4534b83777f19f
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
9d345bbb34 Java: report local class instantiation from a different static context (IDEA-372971)
(cherry picked from commit 6bc936ee3dd849db2db187b03edac58f4c9b2c73)


(cherry picked from commit 18853b7d75a40f6a8761489a5655602be915a1ba)

IJ-MR-169535

GitOrigin-RevId: 058ac27f8f0ef5c605c962e596711dafb1eeb5fc
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
695481c17c Java: fix quotes in error message (IDEA-372971)
(cherry picked from commit 6d5fb46cea97bfb20acfce6beed64e33ca3d5142)


(cherry picked from commit 187fd43da740a0b415c38719332402b4725ef19f)

IJ-MR-169535

GitOrigin-RevId: 69a062f0d96dd4770bdd5131a95508a0a6858ea3
2025-08-04 12:58:49 +00:00
Bas Leijdekkers
fcc5e59573 Java: fix incorrect "Static member qualifying type may not be annotated" (IDEA-210876)
(cherry picked from commit 48d08a4d0d3db72fa458d7d67f6ccd72a435b4c8)

IJ-CR-168601

GitOrigin-RevId: ca9dfd435af2f6c580af42d6eb2061d01cad98cf
2025-07-25 09:08:33 +00:00
Tagir Valeev
e79d3d8824 [java-highlighting] IDEA-374968 Red code in ConcurrentSkipListMap.java
(cherry picked from commit cfb9b5cbf965190668e9cb4cb9ed102f26fcd3f7)

IJ-CR-166980

GitOrigin-RevId: 529629a073d5107bd13a12203f0528b49e3b5613
2025-06-26 14:43:03 +00:00
Tagir Valeev
6cb3ca0045 [java-inspections] CreateLocalFromUsageFix: remove external annotations
Fixes IDEA-367190 NotNull annotation when creating local variable references library which is not in the project
Also: do not resolve reference for writing to a package

GitOrigin-RevId: 31f996515323e250d487bf9b7d343f101d788907
2025-06-12 16:51:42 +00:00
Mikhail Pyltsin
e842105580 [java-highlighting] IJ-CR-165049 IDEA-374019 Don't show error about 'main' method if there is an error with braces
- highlight for java 21 duplicated classes

GitOrigin-RevId: 31a935297e6b2dcb843cfd5ce1d10acb78774df1
2025-06-10 22:18:37 +00:00
Mikhail Pyltsin
708f2a6328 [java-highlighting] IJ-CR-165049 IDEA-374019 Don't show error about 'main' method if there is an error with braces
- don't highlight if there is package statement
- skip duplicated nested class for implicit classes

GitOrigin-RevId: eadb287b7e52bfedd04340b8841597b9d6839ee5
2025-06-09 13:40:12 +00:00
Bas Leijdekkers
0a60753921 Java: don't report casts of constants (IDEA-373869)
in "Constant expression can be evaluated" inspection

GitOrigin-RevId: aa1bac4aef1e306c5c9671b9cdf3aca638feb95b
2025-06-05 20:37:31 +00:00
Mikhail Pyltsin
dc8ca06f05 [java-highlighting] IDEA-374019 Don't show error about 'main' method if there is an error with braces
GitOrigin-RevId: 38e303a7ace428d45c6e869fce3acc655dba1a6d
2025-06-05 16:28:21 +00:00
Bas Leijdekkers
7a0ce59678 Java: generate correct code for native methods (IDEA-373315)
for the "Generate overloaded method with default parameter values" intention

GitOrigin-RevId: d595a7b1f736cdb60549c0a872da367a1ffe1a92
2025-05-26 13:23:28 +00:00
Mikhail Pyltsin
bb218c792d [java-inspections] IDEA-371955 delete covered cases after deleting guards
GitOrigin-RevId: 712396793650bb88555cb67e116db96ad72fc148
2025-05-15 16:07:01 +00:00
Louis Vignier
4a14a3afd0 [javadoc] Fix JavadocDeclarationInspection for module links
#IDEA-370362 Fixed

GitOrigin-RevId: b96aa8111d33c93a80102300ea23b7a052874cb9
2025-05-08 11:35:48 +00:00
Tagir Valeev
a94b0d76bc [java-inspections] Do not treat import as unused if it's a potentinally class-import
Fixes IDEA-372121 Optimize imports does nothing on unresolved reference

GitOrigin-RevId: e70ceab4f23092e2b7f7a84edbc0c4159c504084
2025-05-05 14:55:33 +00:00
Bas Leijdekkers
f93991ab92 Java: fix implicit class' use scope (IDEA-371297)
GitOrigin-RevId: 1165c265bbb527d6474b5c10888ad8c7a683706f
2025-04-28 11:12:48 +00:00
Tagir Valeev
69fc3018bb [java-highlighting] Avoid duplicate highlighting for duplicate classes when dangling modifier lists are present inside the class
Fixes IDEA-370725 Multiple 'Duplicate class' errors for the same class

GitOrigin-RevId: 1712abbfd7594028d839b5962c5a4ca13881250f
2025-04-15 07:15:41 +00:00
Mikhail Pyltsin
ef8332f0fb [java-inspections] IDEA-370073 incorrect field type
GitOrigin-RevId: 0c256aef706e7674d123ee2fd00278a7e17a2ccb
2025-04-03 10:17:49 +00:00
Louis Vignier
d82a6a1d1a [java] Preserve comments in ReturnReplacementContext#stripUnnecessaryBlocks
#IDEA-369976 Fixed

GitOrigin-RevId: d20a4a7d92ffb5fc7bda36c879868a2d3e2e8413
2025-04-02 22:05:33 +00:00
Tagir Valeev
cb2bafc26f [java-intentions] IDEA-365579 Extend class quick-fix shouldn't be shown, leads to a red code if executed
GitOrigin-RevId: 49fd47d8848d2241274262d926a967c14d900013
2025-04-02 17:24:07 +00:00
Tagir Valeev
cdc2589ff4 [java-highlighting] IDEA-369731 IAE on non-physical element during error highlighting
GitOrigin-RevId: 3096b6d371c9248db65dc15941b57dbae134c609
2025-04-01 17:27:14 +00:00
Mikhail Pyltsin
9cfd575fec [uast-inspections] IDEA-370038 incorrect field type
GitOrigin-RevId: 20f8c4000322b05d090b0009688068f31c4e4947
2025-04-01 16:21:48 +00:00
Tagir Valeev
f6b5d7935a [java-psi] One more test for lambda parameter type under ambiguous resolve
GitOrigin-RevId: 41a80dd4ce9f232d6e5cc273adc8f02dd1a01780
2025-03-26 18:21:27 +00:00
Tagir Valeev
a8dac43c9e [java-highlighting] Do not report incompatible type on calls when found type is lambda
Fixes IDEA-336129 Incorrect error if excess arguments passed to a function with lambda

GitOrigin-RevId: 712960416933e710740b9053b3604039c9a9b2ef
2025-03-21 14:59:41 +00:00
Tagir Valeev
c855231a3b [java-highlighting] Do not report incompatible type when found type is lambda
GitOrigin-RevId: 511c42c0fbbb713ec34b6a25d1ceddb0d5612b2f
2025-03-21 14:59:41 +00:00
Tagir Valeev
cc8b90376c [java-highlighting] Do not allow unchecked conversion for explicit new expression types
Fixes IDEA-326353 Generics error is not displayed in new expression

GitOrigin-RevId: 661bf57ed3451096fcee245204dd30adae49e9e1
2025-03-20 18:59:14 +00:00
Tagir Valeev
1b0fcea7e2 [java-intentions] IDEA-368928 Unnecessary cast fix for lambdas
GitOrigin-RevId: dec2f6e7bedca3686532264db331371119146527
2025-03-20 11:41:31 +00:00
Tagir Valeev
ef4334ea4b [java-psi] Multi-resolve of functional interface type improvements
- Support constructors
- Support diamond types
- Infer lambda parameter type even if functions differ
Also: PsiCall.multiResolve method; used where possible
Improves IDEA-364426 Missing variable type inference of lambda in a method call while typing a first parameter if all parameters haven't been provided yet (until overload is chosen, even though the first parameter can be inferred already)
Fixes IDEA-318792 Stray "Cannot resolve constructor" error

GitOrigin-RevId: 3227c2da22ef417457ad07a524403b405aeebbcd
2025-03-20 10:06:40 +00:00
Tagir Valeev
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 Valeev
53ddaa64da [java-highlighting] Improve error message in IDEA-369310
Previous hasError status (after syntax error) was not reset. As a result, we did not report the next error on the surrounding element.

GitOrigin-RevId: 60c0be1cc6ca4967eb72e2fc24278cdc5cf2728e
2025-03-18 14:53:44 +00:00
Tagir Valeev
f9bf970c56 [java-highlighting] IDEA-369310 NPE in error highlighter
GitOrigin-RevId: 0944d4f1c9594d138df85041748ff72fb56e436d
2025-03-17 15:01:10 +00:00
Tagir Valeev
830860950b [java-highlighting] Avoid highlighting outside of PsiField psi element
Fixes IDEA-368916 IAE in error highlighting when several fields are declared with shared modifier list

GitOrigin-RevId: 012b6564f9ca1a775894a3fc2b003c4feb2477e6
2025-03-10 21:59:42 +00:00
Bas Leijdekkers
c1cbbc96f1 Java: make suppress intention insert annotation in scratches and injections (IDEA-368668)
GitOrigin-RevId: 5a336e0ffaab8b530458dba3bba689e6eea70ace
2025-03-06 10:26:37 +00:00
Tagir Valeev
bca1a631f8 [java-highlighting] IDEA-368498 Errors about incorrect TYPE_USE annotations are not reported by IntelliJ IDEA
GitOrigin-RevId: 05b017fe457e4efaf0685d429bfd6c2e743936cb
2025-03-04 17:38:52 +00:00
Tagir Valeev
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
Alexey Kudravtsev
be9dc3e624 remove syntax errors from test data to avoid highlighting the same range twice to get rid of duplicating errors
GitOrigin-RevId: 13db442a342a7ba8dec73715bde479f8a062dba3
2025-02-26 20:33:42 +00:00
Tagir Valeev
64c766f622 [java-highlighting] Testdata: restore accidentally removed attributes
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 6432a126ae165fe06a6549753082a650fb1161c2
2025-02-26 18:59:35 +00:00
Tagir Valeev
6d7ef89b5a [java-highlighting] Migrate fallthrough-related errors
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 0a2b7e91a93e8207101368c0fcfb3cf58a793203
2025-02-26 10:29:12 +00:00
Tagir Valeev
2250bb64ee [java-highlighting] Finish moving module access errors
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: 0f89a7cd9609aea2780e132118aae892a6b0bafd
2025-02-25 17:24:00 +00:00
Aleksey Dobrynin
5151559045 [java, jigsaw] Support JDK-8197532: add tests (IDEA-367339) IJ-CR-154794
GitOrigin-RevId: e3acb5c8848ae13da6f28c1593b432e27c81cd14
2025-02-24 10:44:41 +00:00
Tagir Valeev
96bc4480b1 [java-highlighting] Unrelated defaults checks moved to MethodChecker
GenericsHighlightUtil.java is removed completely
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only)

GitOrigin-RevId: de2bddb49469c21efe1088e86f6a1ec5b9d35b4a
2025-02-21 10:35:05 +00:00
Bas Leijdekkers
abf7dd20c2 Java: compute constant value shouldn't be available on parentheses (IDEA-367924)
GitOrigin-RevId: bc1540b49e395db9385ba3e87bb3930014907dd1
2025-02-20 18:48:19 +00:00