Commit Graph

12566 Commits

Author SHA1 Message Date
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
Mikhail Pyltsin
7b0eaea1e9 [java-inspection] IDEA-356474 Support JEP 477: support implicitly imported modules in optimize imports
GitOrigin-RevId: d4fb59ccffbf0a51f97b1ba965f2d0d59834940e
2024-07-26 12:44:48 +00:00
Tagir Valeev
1fe9c2e631 [java-intentions] Do not suggest to add a cast to new expression (except) upcast
Part of IDEA-356767

GitOrigin-RevId: e9f9e6c1a46ade85c14f20811444299e8aff0c17
2024-07-26 10:51:23 +00:00
Mikhail Pyltsin
11f2d22415 [java-inspection] IDEA-356474 Support JEP 477: support implicitly imported modules in optimize imports
- added test
- the main logic was implemented in IDEA-356672

GitOrigin-RevId: cea8a71db91527ae175da2060c65423dec740b46
2024-07-25 09:33:08 +00:00
Mikhail Pyltsin
6d101f8467 [java-inspection] IDEA-356699 Support JEP 477. UnusedImportInspection doesn't support implicit imports and modules
GitOrigin-RevId: b3fbb9aea04067e704e3ef3dba9e16262e33b0c6
2024-07-25 09:33:08 +00:00
Mikhail Pyltsin
ee4964a9a9 [java] UnusedImportGlobalInspectionTest convert to string block
GitOrigin-RevId: cfa22e2d932d1dad579e907d2a7e018a8e277587
2024-07-25 09:33:08 +00:00
Mikhail Pyltsin
8f3e75e7db [java-inspections] IDEA-356672 Support JEP 477. Incorrect intentions and actions with implicit imports
- improve ImplicitImportChecker to support modules
- check conflict for modules
- new method `PsiImportModuleStatement.findImportedPackage` is added

GitOrigin-RevId: 0d0f61916bdda17b8c9d9146a13aa8d6d0876bb1
2024-07-25 09:33:07 +00:00
Bas Leijdekkers
7f47f19875 Java: support for JEP 382: Flexible constructor bodies (IDEA-355054)
GitOrigin-RevId: f6146f9e06b0f618f1512b7b864532e126d7beda
2024-07-19 20:23:55 +00:00
Bas Leijdekkers
5b1dbe4383 Java: fix and improve error message (IDEA-356573)
GitOrigin-RevId: 0b3ff17ed8d439ff99ce1e2294a6fac2dcb83770
2024-07-19 20:23:55 +00:00
Bas Leijdekkers
291bb89726 Java:Highlight "Recursive constructor invocation" error on the constructor call (IDEA-356563)
GitOrigin-RevId: ec04cb0aa5b234ea9814d78400c83fa70e6bd29b
2024-07-19 20:23:55 +00:00
Mikhail Pyltsin
b0c458cfac [java-highlighting] IJ-CR-140387 IDEA-356470 Support jep 455. Generate true and false cases for boolean selector
- support constants, fix test

GitOrigin-RevId: 9f00f2d2a896af54e15e1ea72d35a473fddf18b8
2024-07-19 19:51:57 +00:00
Mikhail Pyltsin
01b39de56a [java-highlighting] IJ-CR-140387 IDEA-356470 Support jep 455. Generate true and false cases for boolean selector
- support constants

GitOrigin-RevId: ff51020da5086de2e59439647588e8b5c4ba4c85
2024-07-19 11:56:23 +00:00
Mikhail Pyltsin
0b30038602 [java-highlighting] IDEA-356470 Support jep 455. Generate true and false cases for boolean selector
GitOrigin-RevId: fbd879f172639f3db1b0d9c12f98fcb3868fa1a9
2024-07-18 20:11:33 +00:00
Tagir Valeev
097332e117 [java-completion] IDEA-356400 Join lines adds \n outside text block literal
GitOrigin-RevId: 8afe6a733da77bb78e42feec646437af62400d23
2024-07-18 14:59:48 +00:00
Mikhail Pyltsin
d0c8d95e30 [java] IDEA-356446 Support module imports
- Support keyword completion

GitOrigin-RevId: 10dcdc049838efa601e6bf0bbaf180ab4a8556de
2024-07-17 18:18:57 +00:00
Mikhail Pyltsin
eee416a4e8 [java] IDEA-355777 Support implicit imports
- Support implicitly imported modules

GitOrigin-RevId: dbf10158847f652936c405a1ad20ce4dd04dbba7
2024-07-17 18:18:57 +00:00
Mikhail Pyltsin
8ce06c83bb [java-inspection] IJ-CR-135317 IDEA-352587 Support JEP 455: Improve conversion from if to switch
- fix naming
- add more tests
- check cases when variables can be assigned
- track primitive variables when new cases are created

GitOrigin-RevId: 84a77676a627cc0fffce8e7219daa2b1fd13949d
2024-07-17 18:18:57 +00:00
Aleksey Dobrynin
c96bc2d64f [java, import-module] resolve "import module" jep 476 IDEA-355535
GitOrigin-RevId: 4a4ee8cfafdba657d062317d3e014061af69a3e4
2024-07-17 12:27:11 +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
2c766e6df0 [java-inspections] TrivialFunctionalExpressionUsage: do not report for any parent statement
Also: report any lambda inside parent return statement
Fixes IDEA-356003 Method call should not be simplified

GitOrigin-RevId: cb39dd33d27ba402a503707daffcc831ab59b49e
2024-07-16 16:41:55 +00:00
Eugene Zhuravlev
0143e8951f adjust test data to test that only direct subclasses are affected
GitOrigin-RevId: 91017ce9dd9038879a7ce0e44a6c1dc9c2dfd000
2024-07-11 20:07:18 +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
Georgii Ustinov
b1466c2651 [Java. Code Formatting] Add migration test to JavaCodeStyleSettingsTest
IDEA-110857

GitOrigin-RevId: 99e5f481fd6a1351728d8194f56421bb23c07be1
2024-07-11 12:29:38 +00:00
Georgii Ustinov
029e881a2f [Java. Code Formatting] Fix tests in JavaFormatterAroundBlankLines after new behaviour
IDEA-110857

GitOrigin-RevId: 61e86ace3749d42347ace6738c6b9f2a1a341148
2024-07-11 12:29:38 +00:00
Tagir Valeev
5778a45943 [java-inspections] FunctionalExpressionCanBeFolded: disable if qualifier subtype overrides default methods of function
Fixes IDEA-310524 "Method reference can be replaced with qualifier changes" suggestion changes behavior in unwanted ways. (Spring Security)

GitOrigin-RevId: f927ab534894188fa418a499c98af3a7c169b0cd
2024-07-11 11:02:28 +00:00
Bas Leijdekkers
90930f2998 Java: handle reassigned parameters better (IDEA-256096)
for "Convert to instance method" refactoring

GitOrigin-RevId: 957b0b0cecf93f6ff849d4105ed864bc6ba99c8f
2024-07-10 19:17:56 +00:00
Bas Leijdekkers
610358505b Java: stable method ordering for "Convert to instance method" (IDEA-356128)
GitOrigin-RevId: 81b2e38494d7792dfe3ec13703851e4eb1539e71
2024-07-10 19:17:56 +00:00
Mikhail Pyltsin
61eda5ef9f [java-inspections] IDEA-356142 Support several unconditional cases in "Replace if with switch"
GitOrigin-RevId: 55d493b34da246aa205be0fab09bf538d25b49fa
2024-07-10 18:15:49 +00:00
Bas Leijdekkers
d3f94f2739 Java: test qualifiers shown in ui (IJ-CR-138368)
for "Convert to instance method" refactoring

GitOrigin-RevId: a4bb1ef732d71359e52ed778f9ad36c776533e47
2024-07-10 15:32:54 +00:00
Bas Leijdekkers
941612674c Java: need to check if resolve is valid, otherwise there is no conflict (IJ-CR-138369)
GitOrigin-RevId: 2f895cdc66ded3ec8fb4c59843c1969e95f1c2d1
2024-07-10 15:32:54 +00:00
Tagir Valeev
02b38656a1 [java-inspections] ExpressionComparedToItself: do not duplicate reports of constant values (IDEA-345669)
GitOrigin-RevId: 4a7158afc602b12e7dbcf4d8d55a75c9a66f642a
2024-07-09 16:13:26 +00:00
Tagir Valeev
ca672acb50 [java-refactoring] Replace constructor with builder: do not touch anonymous classes
Fixes IDEA-354668 "Replace constructor with builder" does not handle anonymous classes correctly

GitOrigin-RevId: f7d340c1fe3f82bbdaba04db35512faa8ace7289
2024-07-09 16:13:26 +00:00
Tagir Valeev
bc024ed383 [java-inspections] AbstractClassNeverImplementedInspection: suppress for deprecated abstract classes
GitOrigin-RevId: 4c6f5eeec061cebd203a27ae845c9a4cf394ac6b
2024-07-09 16:13:25 +00:00
Aleksey Dobrynin
c7d2022be3 [java, import-module] Improve feedback
IJ-CR-138322 IDEA-355529

GitOrigin-RevId: 46e71e26b9a939c15b7a411a546c5a56e1d7e587
2024-07-09 13:11:41 +00:00
Georgii Ustinov
dbc682a07e [Java. Code Formatting] Attempt to fix non-deterministic formatting when dependent whitespaces are used
IDEA-181768

GitOrigin-RevId: a31e63ad2a6145aec5ddfe329c9a7cf10d116cc7
2024-07-08 15:36:50 +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
Eugene Zhuravlev
40bbc9947b JPS: support java16 instanceof pattern matching
GitOrigin-RevId: 5a2777c4234e63621c1daf4bc11da402edaae8f5
2024-07-05 17:52:09 +00:00
Eugene Zhuravlev
7ffc3f8f8b JPS: generalize support for java17 sealed classes; supported case when permitted list gets reduced
GitOrigin-RevId: 9be5ef80b3dd00509cbe9e5dce2f9f00c4b6557a
2024-07-05 17:52:09 +00:00
Mikhail Pyltsin
634c6b833b [java] IDEA-352189 Support JEP 455. Implement increase language level check and fix
- add more tests

GitOrigin-RevId: 2545d756cff9650487cc2b12c0b8b5390d1863e7
2024-07-05 11:34:47 +00:00
Tagir Valeev
d52f6c789f [java-dfa] IDEA-355908 Add new mutation contract option: io
GitOrigin-RevId: 206fae268d8444d475a4feac6ebc5ef96ffc57bb
2024-07-04 21:05:23 +00:00
Mikhail Pyltsin
ee1495d613 [java-inspections] IDEA-355916 Support JEP 477 Update ImplicitToExplicit inspection
- first part. update for implicit static imports

GitOrigin-RevId: 8c0fdf1c8ebd424a80e53b93c707fba02a07448a
2024-07-04 20:24:54 +00:00
Georgii Ustinov
a01e2c2c9f [Java. Code Formatting] Add tests for blank lines with rearrangement
IDEA-110857

GitOrigin-RevId: f21d7c0a9decf830d76c5a25085f4f77448971a8
2024-07-04 19:56:49 +00:00
Georgii Ustinov
37c6900424 [Java. Code Formatting] Add tests for blank lines around annotated/non-annotated fields
IDEA-110857

GitOrigin-RevId: 84dcb160fb09831989b1defee8ee83cace3beb45
2024-07-04 19:56:49 +00:00
Georgii Ustinov
6134c3049a [Java. Code Formatting] Update jsonExport
IDEA-110857

GitOrigin-RevId: 4cb74026d322756f34ec2aa29f674618591ea3f9
2024-07-04 19:56:49 +00:00
Mikhail Pyltsin
847a369e5d [java-inspections] IDEA-355900 JEP 477 Convert to implicit class should not be suggested if the class is annotated
GitOrigin-RevId: 748b90d19a74d0023573448557286433c9300646
2024-07-04 15:45:39 +00:00
Mikhail Pyltsin
ff1ce5a0bd [java] IDEA-352189 Support JEP 455. Implement increase language level check and fix
GitOrigin-RevId: d69e01d624fcfc4ddb3af7292693ed056efc88a4
2024-07-04 15:25:05 +00:00
Tagir Valeev
174c24c450 [java-highlighting] Fix testdata (IDEA-355703)
We report less errors after [java-incomplete-model] Assume that any unresolved class-type is assignable to java.lang.Object

GitOrigin-RevId: a94eda62a430367a8fb1b5159fae4446a35687e1
2024-07-03 22:09:42 +00:00
Mikhail Pyltsin
f90bd8b6f1 [java-inspections] IDEA-355790 JEP 477. Suppress for class doesn't work
- These changes disable suppressions for implicit classes

GitOrigin-RevId: ff2fac065c092f257548bbfec5c799d48e116cac
2024-07-03 22:08:48 +00:00
Mikhail Pyltsin
07178b990f [java-highlighting] IDEA-355777 Support JEP 477: implicit imports
- support implicit import for java.io.IO
- reimplement implicit static imports

GitOrigin-RevId: 3e2650128d43b1cff40c21c0539869070c6094d0
2024-07-03 22:08:38 +00:00