2497 Commits

Author SHA1 Message Date
Tagir Valeev
071179ffed [java-intentions] IDEA-363624 Create Class generates invalid and redundant annotation @NotNull @NotNull for constructor parameter
(cherry picked from commit 9c3c9c55517369e6715c65a9696c287514261a10)

IJ-CR-151031

GitOrigin-RevId: 8306c8925395abd7dcee24de847335e4e9b1f535
2024-12-09 10:58:58 +00:00
Tagir Valeev
d2d87a71f3 [java-intentions] IDEA-363734 "Make Xxx impelent Yyy" quick fix inserts @NotNull
(cherry picked from commit 4e9a3f94cf1aedadd0b2c4699e168ccb3be0e405)

IJ-CR-150708

GitOrigin-RevId: ced9d4595e513387ebf996bf8dd0894877ef0f3e
2024-12-05 01:08:15 +00:00
Tagir Valeev
32684d7e9f [java-intentions] Create method from usage should skip external type annotation
Fixes (finally) IDEA-360115 Create method from List.of results in long jetbrains NotNull annotation


(cherry picked from commit 8e1657ad1d3af686e50c048eea1f7c439ec7365b)

IJ-CR-149633

GitOrigin-RevId: 1c86e8a1b9b0d5902f095ca7393bef8e2dea66d9
2024-11-19 14:11:05 +00:00
Bas Leijdekkers
dfae4a26c2 Java: "Generate overloaded constructor with default parameter values" for records (IDEA-360071)
GitOrigin-RevId: a20fd5478241de404df3243f1b8b9a7d1a73829e
2024-10-02 20:13:41 +00:00
Bas Leijdekkers
95ed423db6 Java: don't create final fields from parameters when this does not compile (IDEA-359981)
GitOrigin-RevId: 3a85c9310c8928cf65459ae1ff1825fabf31ec03
2024-10-02 20:13:41 +00:00
Bas Leijdekkers
14096f0f03 java: don't create final field from parameter when this does not compile (IDEA-359980)
GitOrigin-RevId: d7ce31fbb607a409afa0e2b988eed424440cc336
2024-10-02 20:13:41 +00:00
Tagir Valeev
5905b6f62a [java-inspections] TrivialFunctionalExpressionUsageInspection: more accurate side-effect handling
IDEA-355026 "Trivial usage of functional expression" breaks semantics if one argument updates the variable used in another

GitOrigin-RevId: e3d9374ecc427d62cee0d821473e9119ae240fc5
2024-10-01 14:50:18 +00:00
Mikhail Pyltsin
f474d8047b IJ-CR-145218 [java-inspections] IDEA-201932 Provide inspection to highlight redundant creation operations in java date time api
- combine into one inspection
- fix messages

GitOrigin-RevId: d4e064948f8c730c4d68c58e6c9b1277c6b66b4d
2024-09-27 17:12:29 +00:00
Bart van Helvert
690f1167ff [java] Don't suggest generating broken overload constructors
In implicit and anonymous classes, constructors can't be declared. #IDEA-359731 Fixed

GitOrigin-RevId: 76e978d04052dffd955bfac6c1016fa707201b29
2024-09-27 16:07:34 +00:00
Tagir Valeev
be4f6cd282 [java-inspections] Redundant keySet()/values(): support entrySet(); avoid warning inside Map implementations (IDEA-346005)
GitOrigin-RevId: ebf925ab3ff7c1357248a65201fe654aada0f4e8
2024-09-19 19:06:26 +00:00
Tagir Valeev
ac0c57748b [java-inspections] IDEA-346005 Add new inspection: Unnecessary keySet() call
GitOrigin-RevId: d1f1db0ae939017a8550b91cd8742dc222a8db99
2024-09-17 07:28:39 +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
Tagir Valeev
9092a09789 [java-intentions] BindFieldsFromParameters: disable for existing field if static or type doesn't match
GitOrigin-RevId: ad1d93533626f5e76a3f53c5ab25b06a5aa07f1e
2024-09-10 23:44:56 +00:00
Tagir Valeev
0f2865b919 [java-intentions] DefineParamsDefaultValueAction: better check of possible signature conflicts
GitOrigin-RevId: 5eb26ee62852e2e5e6188e740b807c775ded0277
2024-09-10 23:44:55 +00:00
Tagir Valeev
cf460af83e [java-inspections] IDEA-358770 Stream/Optional desugaring: support Predicate.not
GitOrigin-RevId: af9cdb5e674406bbbe94a746e85a662a590a4d3d
2024-09-05 12:54:57 +00:00
Bas Leijdekkers
f198a23cdf Java: don't evaluate enum constants as constants expressions
GitOrigin-RevId: c5d703ce78b569a3bdab9e8e9dcc2e95bdadd07f
2024-08-29 19:03:09 +00:00
Bas Leijdekkers
ed81723f17 Java: don't evaluate constant for incomplete expressions
GitOrigin-RevId: 15542db6b8631edbc96bd7ea9cc2b1a975fcbcbb
2024-08-29 19:03:09 +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
Georgii Ustinov
940f66f53d [Java. Inspections] Add tests for not showing popup for add exception to method signature
IDEA-358300

GitOrigin-RevId: a7b8c716d772ae5ca631037ebb923bb796946af9
2024-08-27 10:05:40 +00:00
Bas Leijdekkers
18cb209fa7 Java: add cast to single branch of conditional expression when possible (IDEA-358278)
GitOrigin-RevId: 8f3137172d8a1526da2228e3c9ed911f9805c16c
2024-08-26 18:38:16 +00:00
Bas Leijdekkers
83bba063e7 Java: improve message for cast fix
GitOrigin-RevId: 40cd180ca8fdae46a3ea0216ec7b08e82ca22364
2024-08-26 18:38:16 +00:00
Mathias Boulay
d56883b763 fix(JavaDoc): formatter, inspections
GitOrigin-RevId: 77686401cbf38ea31e93311a608bac7472ccc73c
2024-08-26 10:42:10 +00:00
Bas Leijdekkers
1a5e213e96 Java: "Suppress for <x>" fix should not make code uncompilable (IDEA-358115)
GitOrigin-RevId: 754d0bac805a0e9d56489c63e5486d6e7e15a4db
2024-08-22 15:27:14 +00:00
Bas Leijdekkers
bd7f1f4270 Java: proper order of 'true' and 'false' in quick-fix name (IDEA-357973)
also fixes internationalization and the incorrect comma in the name
for "Create missing switch branches" quick-fix

GitOrigin-RevId: 16285e054447d8d15318df8889499bbbf91243a7
2024-08-21 09:12:08 +00:00
Mikhail Pyltsin
cb37003541 [java-inspections] IDEA-357323 Propose case null during adding all cases
GitOrigin-RevId: 6d7ffccc28d64ed0f52db0235c41796d1d81284e
2024-08-09 11:00:42 +00:00
Bas Leijdekkers
4426c2fc85 Java: create field from parameter with method type parameter type correctly (IDEA-357162)
GitOrigin-RevId: 3a9947fa58b394f0e0b5377fbe75702f3d4b8f6a
2024-08-06 10:48:28 +00:00
Bas Leijdekkers
24aaef624d Java: fix false positive on reference to enum constant (IDEA-357156)
GitOrigin-RevId: 7c833e46823ab41c9bdf275308ccee226d7e1a5f
2024-08-06 10:48:28 +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
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
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
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
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
330ba98e01 [java] IDEA-354964 Migrate standard descriptors like JAVA_21 to TYPE_USE annotations
- fix NullableManager, when it can't find annotation in type

GitOrigin-RevId: 121927429534971abb4a50d1f670afbed9384045
2024-06-26 20:34:48 +00:00
Tagir Valeev
838cf2d73c [java-incomplete-model] Assume that any unresolved class-type is assignable to java.lang.Object
Partially improves inference in incomplete mode

GitOrigin-RevId: 1d9c7c75afd524ea02980be8f96c19fba1eaaf54
2024-06-25 13:54:11 +00:00
Georgii Ustinov
bea3fefda2 [Java. Code Formatting] Restore caret in files for AnnotateMethodTest#testAfterDoNotAnnoI
IDEA-353192

GitOrigin-RevId: 5f930ffb06158c40e786cd948c8f8d0982e61814
2024-06-21 15:13:57 +00:00
Georgii Ustinov
41cf8f6fe3 [Java. Code Formatting] Add check to TypeAnnotationUtil that language level is at least 8
IDEA-353192

GitOrigin-RevId: e8d2d8270dbc1c39300d5a2d55ef993e433ccdbc
2024-06-21 15:13:57 +00:00
Mikhail Pyltsin
73bbc5d00d [java-completion] IDEA-355252 Don't suggest deconstruction with incorrect name
GitOrigin-RevId: 9bdb1273f507054c479eaa86597eadaf4568a9dd
2024-06-20 17:53:33 +00:00
Tagir Valeev
567e0b0d05 [java-intentions] IDEA-270206 Nullability annotation at type parameter/wildcard: add a quick-fix to move it to the bound
GitOrigin-RevId: e8e56c2d27a77414045064c784f48ff712ad0d2d
2024-06-14 16:05:02 +00:00
Tagir Valeev
636172d7db [java-intentions] UnimplementInterfaceAction: do not try to remove synthetic methods
Fixes IDEA-354044 Error in Unimplement Interface when invoked on record

GitOrigin-RevId: 9c07e03d1f86ded0aeea3bd0f373dfc263e72eb4
2024-06-14 16:05:02 +00:00
Tagir Valeev
77ec9855d8 [java-inspections] AddFinallyFix: handle end comments
GitOrigin-RevId: b8dbc546122362e256c92be5a3a696275639f2a5
2024-06-11 18:03:36 +00:00
Tagir Valeev
49ed49dc2d [java-inspections] EA-1160494 - IOE: BasicJavaParserUtil.parseFragment
GitOrigin-RevId: 5a13ceb97f8105766928d67336fe9a87df62053a
2024-06-11 13:01:56 +00:00
Tagir Valeev
78d4bd2c8b [java-intentions] Quick-fixes to change method/var return type when inference fails
Fixes IDEA-354184 Quick-fix for generic types

GitOrigin-RevId: 65d513f5303a082c26283e09275470840df90d30
2024-06-06 18:15:52 +00:00
Tagir Valeev
2d3ed0f730 [java-intentions] CreateConstructorParameterFromFieldFix: fill variables before modifying constructors
When chain target constructor is already updated, it affected other constructors from the same chain
Fixes IDEA-345876 Unable to add constructor parameter via quick-fix

GitOrigin-RevId: e13d1d24ad16dbd32281b7f13be6d656871acef2
2024-06-05 15:08:25 +00:00
Tagir Valeev
a8788fa3b8 [java-highlighting] Do not try to resolve star-import if existing explicit import fails to resolve
Otherwise, wrong class may be resolved in incomplete project model
AnonymousHashCode.java changed, because java.lang.Object import was unresolved (no JDK configured) and we now refuse to resolve to same-package class if there's a suitable explicit import
beforeHierarchy.java/afterHierarchy.java changed, because the import was incorrect, and it prevented importing implicit java.lang.Exception
predicates2.java changed: incorrect import removed (now prevents importing java.lang.String)
MoveInnerProcessor changes: import refs should be rebound first; otherwise they disallow to rebind normal refs
SpringDataMongoDbQueryCompletionTest changed: erroneous import removed

GitOrigin-RevId: f380409c445306bb9b8aceb5fe4dce1351511283
2024-06-04 20:27:13 +00:00
Georgii Ustinov
a4d5e41d7f [Java. Code Formatting] Rewrite the way of detection type annotation in JavaFormatterUtil
IDEA-353192

GitOrigin-RevId: 34e375e4e1e059be03aad12c2839911b8315ed06
2024-06-04 06:46:24 +00:00
Georgii Ustinov
3b50806cf1 Revert formatting type annotations on the same line before the type in method
IDEA-353192 IDEA-354026

GitOrigin-RevId: cbf3e0b332517194f35d979a631cbbb0121893b4
2024-06-01 09:59:49 +00:00
Georgii Ustinov
77bfbe1b39 [Java. Code Formatting] Fix tests which relied on old version of Nullable/NotNull annotations
IDEA-353192

GitOrigin-RevId: f913b37c8fb9c7c754d7c6fcd5c1cdd215a7f295
2024-05-17 11:16:41 +00:00
Bas Leijdekkers
106130b6f8 [java] better quick fix text (IDEA-353386)
GitOrigin-RevId: ebc64c441f2140181ad4e996005a45b19936b7d3
2024-05-14 10:29:57 +00:00