Commit Graph
4326 Commits
Author SHA1 Message Date
Artemiy Sartakov 79f7d4dd58 Revert "Sealed classes: restricted keyword/identifier -> contextual keyword (IDEA-257414)"
This reverts commit a3b7cb3c

GitOrigin-RevId: bc91ae528d6f836e9cf43c19e9923286c8de0a9c
2021-02-04 09:33:52 +00:00
Tagir Valeev 49cd49dfa3 [java-dfa] Revise mutability: MUST_NOT_MODIFY
New level 'MUST_NOT_MODIFY' is introduced for parameters inside pure methods to signal that we should not modify these values, but we don't actually know whether they mutable or not (fixes IDEA-257286). Also, MUST_NOT_MODIFY is dropped inside nested closures, so we don't warn if parameter is modified there.

GitOrigin-RevId: f095e72be772eef8324ef2246fb0b7262beae20d
2021-02-01 08:25:58 +00:00
Tagir Valeev 0a1276cbe2 [java-highlighting] InstanceOfNameConflicts: new test
GitOrigin-RevId: c766833dd6ff293c807838ccf94fe9a416361206
2021-01-29 09:00:12 +00:00
Anna Kozlova a5278f0dbb java type annotations: treat nullability annotations as type_use to avoid reordering of a modifier list (IDEA-206570)
GitOrigin-RevId: 292b1052c44815db83d6033a30b44e56c8b4fa34
2021-01-28 19:05:48 +00:00
Tagir Valeev e8baf732eb [java-highlighting] Expression type is a subtype message fixed; added equals message
Review ID: IJ-CR-5352

GitOrigin-RevId: 16674439ea3998cceb4faf0326e53ac2de30d7b6
2021-01-28 05:40:26 +00:00
Anna Kozlova 59f82b7630 java: provide local classes type parameters from containers (IDEA-260187)
type of class literal according to 15.8.2, if C is a class name, then type is Class<C>, no implicit type arguments are assumed

GitOrigin-RevId: 89dcb823c6edd272e7ee0a16621385362c1a4b1f
2021-01-27 19:31:31 +00:00
Tagir Valeev 6fe2638869 [java] IDEA-257411 Update pattern matching for instanceof support for Java 16
1. Do not report error if non-final variable is reassigned
2. Report error in Java 15 if 'final' modifier is used
3. Allow specifying 'final' modifier on introduce variable
4. Support non-final variables in PatternVariableCanBeUsed inspection
5. Copy modifiers in PatternVariableCanBeUsed quick-fix

GitOrigin-RevId: d7b82261a018c9a48bcdcf237ade0d8c08f5978d
2021-01-26 05:55:43 +00:00
Tagir Valeev e8ee29f264 [java-highlighting] Support local variable annotations on pattern variables (IDEA-257411, JEP 394)
GitOrigin-RevId: 67130333b1cf306896c2cdae672ff2f0d40f3977
2021-01-26 05:14:02 +00:00
Tagir Valeev eeb8252d36 [java-highlighting] Disallow instanceof pattern on subtype since Java 16 (JEP-394)
Part of IDEA-257411 Update pattern matching for instanceof support for Java 16

GitOrigin-RevId: bc1a9af755b18f7f44bcb6b1cef9f0761820a403
2021-01-26 05:14:00 +00:00
Anna Kozlova b5ae17aeda testdata for IDEA-250434
GitOrigin-RevId: 2971531084debcf848f19d970f9beec9b9f702ae
2021-01-21 21:46:43 +00:00
Anna Kozlova 0efd80e15f unchecked warning: keep warning for all generic class types (IDEA-259694)
ignore if target type was raw, found by integration test

GitOrigin-RevId: eee1c2d03c94d25f25a9e709c1f6e776383b3401
2021-01-21 11:35:07 +00:00
Artemiy Sartakov 410e209f2d Sealed classes: fixed infinite recursion test (IJ-CR-5083)
GitOrigin-RevId: d6309295c2f77766fb22335c6aa1d65467a80fdc
2021-01-19 09:22:12 +00:00
Artemiy Sartakov 45d71a0820 Sealed classes: restricted keyword/identifier -> contextual keyword (IDEA-257414)
GitOrigin-RevId: a3b7cb3c6eb3a65f78cf473fb93ddfa9946dea38
2021-01-19 09:22:09 +00:00
Tagir Valeev 78652c8573 [java-inspections] RemoveInitializerFix: do not remove complete assignment when used
GitOrigin-RevId: 94dff2a177b1cc991c330276d093f5d3f652d6b9
2021-01-19 09:03:15 +00:00
Artemiy Sartakov 108183e621 Sealed classes: prevent infinite recursion (IJ-CR-5083)
GitOrigin-RevId: 162a2b3851a4303e48d99fcf41d319bdda6f84de
2021-01-19 04:28:47 +00:00
Anna Kozlova ad18c7f009 java inference: setup initial constraints with respect of unchecked warning rules (IDEA-259701)
GitOrigin-RevId: e922b0cdfdecf6dfc3a50a334aa21e084aa1dd97
2021-01-18 14:29:55 +00:00
Anna Kozlova d8b0b80a26 unchecked warning: keep warning for all generic class types (IDEA-259694)
GitOrigin-RevId: b5a09baadfb6837a9de679b2577732faaa05bcdb
2021-01-18 14:29:52 +00:00
Anna Kozlova 0a73a79b70 diamonds: fix parent hunting inside anonymous class (IDEA-259666)
GitOrigin-RevId: 51f47646dbe68e9182b75e3058b0d1216ada92e6
2021-01-18 10:18:03 +00:00
Anna Kozlova 51adbd8f32 introduce variable: ensure array initializer is wrapped in new expr for var usage (IDEA-259249)
GitOrigin-RevId: 910d524ec157012a46aa8586c200f1a1b310c38c
2021-01-15 11:54:05 +00:00
Vladimir Krivosheev 912da5a7e8 reduce trove lib usages
GitOrigin-RevId: da64d033d2fff69893958d9f8a652370c1a1212f
2021-01-14 16:56:35 +00:00
Nikita Eshkeev c40da789be [PreviewFeature] IDEA-259284 Support the new PreviewFeature annotation's package
This patch encapsulates the logic that checks if a used feature is annotated with PreviewFeature in its own visitor. The visitor now checks both PreviewFeature annotations with old and new packages.

GitOrigin-RevId: f3ddc2a840b8c3a8bb4e1a731e2c208002a29fd4
2021-01-13 20:54:42 +00:00
Artemiy Sartakov e35b38f161 Sealed classes: report narrow down conversion for sealed classes that have only sealed / final subclasses and don't have interface inheritors in hierarchy (IDEA-257414)
see JEP-397 - Sealed classes and conversions for details

GitOrigin-RevId: 297386ccd61f7762508b630a60894360215d9e11
2021-01-13 04:57:37 +00:00
Anna Kozlova 2005c6f14c java: testdata for IDEA-206570
GitOrigin-RevId: a4019ca264e699210cba91d30c47c266949d7563
2021-01-11 12:44:55 +00:00
Anna Kozlova 0e8e6abfcb java: override default with super call (IDEA-258822, IDEA-259098)
GitOrigin-RevId: 295ac3cb605800b005784674c2bac20f0de951ff
2021-01-11 12:44:53 +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
Anna Kozlova 7793b16164 java: replace explicit type with var: disable if TYPE_USE annotated (IDEA-259100)
GitOrigin-RevId: 4096a327d8c8f9f569fd82c2d6684f7f3d2090fe
2021-01-11 10:31:04 +00:00
Alexey Kudravtsev a2233e727f move test for fix in IJ-CR-4970 away from SuppressLIIJspTest because it has nothing to do with jsp
GitOrigin-RevId: 84111526ca761cc9b4cb468371e4455ef5b0fead
2021-01-07 13:57:00 +00:00
Anna Kozlova 888b1151d6 java: report error if repeatable annotation has Documented/Inherited annotation and its container doesn't (IDEA-256253)
GitOrigin-RevId: d6dab9a587b2e4d7663a5b0c44ecf65bba9113bd
2020-12-30 19:38:19 +00:00
Anna Kozlova 42bb6297bc java create field from usage: don't go polyadic too deep for reference expressions (IDEA-235781)
GitOrigin-RevId: e3b48d82a489fd91917ffb0027f383aa236c425f
2020-12-30 13:08:33 +00:00
Tagir Valeev b6c02d3fd2 [java-highlighting] StaticInInnerJava16: remove redundant comments
GitOrigin-RevId: 5ac0bb4da8e0d8e62b2143180b719f20a76bc17d
2020-12-30 06:23:52 +00:00
Nikita Eshkeev 0f5a1abe0f [inspection] IDEA-257415 Warnings for value-based classes (Java 16)
This renames ValueBasedWarningsInspection to SynchronizeOnValueBasedClassInspection and alters the logic, it checks first the original type of the monitor and if it's not a value-based class then it employs DFA to infer the type more precisely and checks the inferred type if it differs from the type of the monitor. This solution is more robust, because DFA might fail sometimes.

This patch also adds the suppressId to SynchronizeOnValueBasedClassInspection in order to support the new javac warning category.

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: f7c3520b84bf6f9080280dc2689ff4f63ac4be09
2020-12-29 22:41:46 +00:00
Anna Kozlova 454edfca70 java: move javac bug workaround to the suppressable inspection (IDEA-258347)
GitOrigin-RevId: 131d9adc783927a143393a59f98efe2afb414c68
2020-12-28 16:36:13 +00:00
Tagir Valeev 5d20b5dbb9 [java-highlighting] Allow statics inside inner since Java 16 (IDEA-257410)
Also remove redundant record tests

GitOrigin-RevId: ce57189891b3df3ba4659e8e3a2ded125234911a
2020-12-25 11:59:29 +00:00
Nikita Eshkeev 7760811391 [inspection] IDEA-257415 Warnings for value-based classes (Java 16)
This patch adds the inspection to detect usages of value-based classes' instances as monitors in the synchronize statement.

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>

GitOrigin-RevId: 178533c1415b2a8f11d48db17c19baa7e6ff4d1a
2020-12-24 02:00:16 +00:00
Artemiy Sartakov 7de400f55b Sealed classes: report permits classes that miss final/sealed/non-sealed modifier at permits list (IDEA-255805)
GitOrigin-RevId: 7d1c2c6d8f40302177b369838238858e44427c51
2020-12-22 10:40:52 +00:00
Anna Kozlova 1c6857ec2d java create class from new: don't create non-static inner if new expression can't be used afterwards (IDEA-97433)
GitOrigin-RevId: 89616c077ca5141db53b624ae08bc54b04d53cae
2020-12-18 19:01:32 +00:00
Anna Kozlova f535bd830e java create class from usage: setup super ref for created nested class (IDEA-257288)
GitOrigin-RevId: c5a37a119f50aa3468c74ce621108e00e1168852
2020-12-18 19:01:29 +00:00
Anna Kozlova e9fb32668e overload resolution: don't reject first inapplicable vararg method
GitOrigin-RevId: 3e8246e5cbdab35327da0587aa62111b04f7dbed
2020-12-16 15:32:31 +00:00
Anna Kozlova 7d0ce7b928 overload resolution: N parameters of varargs target should be less than N parameters of corresponding interface (IDEA-257526)
GitOrigin-RevId: 811135c478f3f98fa1923f4b58c27d6ca0144939
2020-12-15 20:45:46 +00:00
Anna Kozlova fd17a8bb75 language level 16, remove language level 14_preview (IDEA-257409)
GitOrigin-RevId: 1f9626ba04ffd9588b0cf9b8a9f699faa613359b
2020-12-14 20:59:58 +00:00
Roman Ivanov bbcb50af87 JavaParser: parse yield() as call
GitOrigin-RevId: 31b4b0f9687bbaa6d1df65e459dcbe05e5c2c6b4
2020-12-14 17:25:01 +00:00
Andrey.Cherkasov 99e697f12b IDEA-253512: Fix SlowAbstractSetRemoveAllInspection
GitOrigin-RevId: 4629a9d2c9b72a7e4b9974bf7c4d93dea98fe7fe
2020-12-07 20:34:07 +00:00
Anna Kozlova 6a0c39b3ee java: missed type cast suggestion on annotated types (IDEA-256942)
GitOrigin-RevId: 86dd16b919e602d375267b868c84384eb4e097cd
2020-12-04 21:20:39 +00:00
Tagir Valeev 58a638bab9 [java-tests] Record rename tests moved to RenameFieldTest
GitOrigin-RevId: d6b5c15752a7e821829caf55db968bc67ebffa8d
2020-12-04 08:06:39 +00:00
Tagir Valeev 7c62cd67fe [java-highlighting] IDEA-256804 Highlighting bug when using JDK 15 Records
GitOrigin-RevId: fd7fe3f1bcfe89e65f754038b4021ac003abb9f7
2020-12-04 08:06:37 +00:00
Andrey.Cherkasov 95a12db895 IDEA-253512: Fixes after review
GitOrigin-RevId: 0c9d42259d6a5169c449b536aa4e7b982446b10a
2020-11-30 15:12:44 +00:00
Anna Kozlova 3a646d1f0c java create local from usage: do not duplicate comments inside variable initializer (IDEA-256107)
GitOrigin-RevId: 3f9298e0d38ca0840a57922a7b9eb23c27277668
2020-11-26 12:11:11 +00:00
Andrey.Cherkasov d4dbc49dab IDEA-253512: Warn about possible O(N^2) in AbstractSet#removeAll calls
GitOrigin-RevId: 76f59d4f019482420142cdf760be3f9e4c7f4d1e
2020-11-25 15:18:45 +00:00
Andrey.Cherkasov 54ac372e2d Add tests for IDEA-173818
GitOrigin-RevId: 6646ccbf3c0ce543fba799d1a1f8ef5786ddc112
2020-11-24 18:20:43 +00:00
Tagir Valeev d35974faf8 [java-inspections] IDEA-255926 Support streams generated by StreamSupport StreamToLoopInspection
Only for non-parallel streams

GitOrigin-RevId: 08b517f557f0c376cc504ac654a9353a66ae9014
2020-11-24 04:36:33 +00:00