Commit Graph

7606 Commits

Author SHA1 Message Date
Mikhail Pyltsin
386ddcd575 [java-dfa] IJ-CR-132826 Support JEP 455: IDEA-352186 dfa for primitives in patterns
- refactoring

GitOrigin-RevId: 64bd95f5bb49fec96ed807bad2d892f5cf89b83a
2024-05-01 21:37:21 +00:00
Mikhail Pyltsin
f27595c831 [java-highlighting] IJ-CR-132825 IDEA-352187 Support JEP 455: highlighting for instanceof with primitives
- use `HighlightUtil.checkFeature` for PRIMITIVE_TYPES_IN_PATTERNS
- simplify tests
- add javadocs a bit

GitOrigin-RevId: 61019896534a11e1c7e2f281054d49a32a8ab8e6
2024-05-01 21:37:16 +00:00
Alexey Kudravtsev
3102effabf make highlight visitors run concurrently; fix tests, get rid of HighlightInfoProcessors to fix IJPL-149030 HighlightVisitors should run in parallel
GitOrigin-RevId: 8a77dd409a575d3eaf28d6935ffeb87fce35dbd4
2024-05-01 11:53:23 +00:00
Tagir Valeev
860bc0e5e7 [java-intentions] DefineParamsDefaultValueAction: add cast by default when ambiguous overloads are present
GitOrigin-RevId: 10d5c9f66fa5bef5ab5e5be71987d14757fd07e2
2024-04-30 16:09:51 +00:00
Tagir Valeev
ec42e3be57 [java-inspections] Do not report redundant cast if any of labels is incompatible with the selector expression
Fixes IDEA-352510 False positive 'redundant cast' warning in switch

GitOrigin-RevId: b31e6f906bebb9de15c82439006502cc8e01f76f
2024-04-30 15:38:08 +00:00
Mikhail Pyltsin
45160db0df [java-highlighting] IDEA-352588 Support JEP 455: highlighting for switch with primitives
GitOrigin-RevId: 06636352b202037ec3400b2f9763e101d8ed6042
2024-04-29 21:17:42 +00:00
Mikhail Pyltsin
8416740b8c [java-dfa] Support JEP 455: IDEA-352186 dfa for primitives in patterns
GitOrigin-RevId: 2033b095f35f02222aa40f43d37e07b0019c4324
2024-04-29 21:17:42 +00:00
Mikhail Pyltsin
0f5c405185 [java-highlighting] IDEA-352188 Support JEP 455: change error messages for records
GitOrigin-RevId: a6e9fe75500155ca9e77514eca8d00f5e4e94e51
2024-04-29 21:17:42 +00:00
Mikhail Pyltsin
c8995f3cc8 [java-highlighting] IDEA-352187 Support JEP 455: highlighting for instanceof with primitives
GitOrigin-RevId: cbd688d0945b03bffb05af85825c610889383fc4
2024-04-29 21:17:42 +00:00
Tagir Valeev
8ee089b9b2 [java-highlighting] Do not show error on override if there's an unresolved superclass
GitOrigin-RevId: 03bd2f1e2a303f8a36ac33c81ad9ccd64c3b5084
2024-04-26 14:23:18 +00:00
Bas Leijdekkers
732fea2829 java: minor cleanup
GitOrigin-RevId: a05f9dd3a29db329db26eb402c08e3182819fe92
2024-04-25 13:50:00 +00:00
Bas Leijdekkers
cfbb00fa01 java: improve some inspection texts
GitOrigin-RevId: 5a0670e84850599d8107f206b76eee1f8f84de17
2024-04-25 13:49:54 +00:00
Bas Leijdekkers
57b1788fa5 java: track java usages of annotation methods in Unused Declaration inspection (IDEA-256632)
psi hack because UAST lacks annotation property references

GitOrigin-RevId: 9d5f2fd8e9d55584be60ca529512dd0714fb551d
2024-04-25 13:49:49 +00:00
Bas Leijdekkers
45cb0ab7d0 java: small cleanup
GitOrigin-RevId: 91d9a5fff0f0b9def8d204b4bbce9ff740115db4
2024-04-25 13:49:43 +00:00
Bas Leijdekkers
5a7449d17c java: fix global unused declaration inspection suppression (IDEA-256471)
GitOrigin-RevId: 5764b1db0c2d1acd5fb4574af04a3510ccb26448
2024-04-25 13:49:38 +00:00
Bas Leijdekkers
a5ab84ef3d java: cleanup read actions in global references
GitOrigin-RevId: 6774854349186713bb18da82938bd2439d862afb
2024-04-25 13:49:32 +00:00
Tagir Valeev
55390abe52 [java-intentions] Do not start action from the java file
It could be a class file without sources. In this case, non-physical copy is impossible. Anyway we are not going to change it, so it's a waste of resources to copy it.

GitOrigin-RevId: 2ac06bf10d0b3c2fff9acd213bc16c611563f8a8
2024-04-25 09:18:50 +00:00
Tagir Valeev
896ebf2dfe [java-intentions] SuppressAllForClassFix: preserve comments
GitOrigin-RevId: 42da370c5b7fef5f2471df4b7d6868bbd9af3631
2024-04-23 15:04:42 +00:00
Tagir Valeev
ee495db972 [java-intentions] MoveMembersIntoClassFix: improve and revive property test
After implicit classes, out-of-class member is parsed. If it was mistakenly put out of the class, it may have many unrelated compilation errors. E.g. extra Override annotation, unresolved reference (to another member of the class), etc. These errors were masking the 'Move member to class' action, because its scope was larger (the whole method).
Now, we put 'feature not available' error specifically to the method/field name identifier, so it's almost always available. Also, action name is more friendly now, and JavaOutOfClassDefinitionPropertyTest is tuned: caret position and language level set correctly.

GitOrigin-RevId: 39917d11fb216be4db3f6fbc9e984ca7378f7302
2024-04-23 10:35:24 +00:00
Bas Leijdekkers
3b492a9147 java: don't report class as used when "non-java usages" disabled and usage is external from e.g. xml (IDEA-294996)
GitOrigin-RevId: 8d18431026be14fec7af4072b2395c90a0de5669
2024-04-22 23:27:54 +00:00
Bas Leijdekkers
c95f7d842f java: seal hierarchy
GitOrigin-RevId: 252e4b6e0ffbf6f31599d832580ad70f473deef1
2024-04-22 23:27:25 +00:00
Bas Leijdekkers
eef685aeb4 java: cleanup
GitOrigin-RevId: d71f79074c641e4a05e32c1f5b38f77776beb6f2
2024-04-22 23:27:21 +00:00
Bas Leijdekkers
34d1d3a30f java: report unused utility classes with unused methods as unused (IDEA-217378)
for "Unused declaration" inspection in batch mode

GitOrigin-RevId: f19b13dd262f0059adc4c08237e620ec8256e013
2024-04-22 23:27:18 +00:00
Tagir Valeev
0387148c7d [java-intentions] MoveMembersIntoClassFix: simplify using PsiBasedModCommandAction
GitOrigin-RevId: 5b26de32a62f8a03e877a04b602283f69b4ab6dd
2024-04-22 19:34:13 +00:00
Mikhail Pyltsin
c68043df18 [java-inspection] S IDEA-350713 consider reference in guards as effectively final for UnnecessaryLocalVariableInspection
- improvements for lambda

GitOrigin-RevId: 1b1520ffa259e314df0e718cf92f5457d7e23744
2024-04-22 16:21:35 +00:00
Tagir Valeev
2ab30a5915 [java-dfa] Handle exceptions from implicit toString in string concatenation
Fixes IDEA-352207 Incorrect unreachable code warning due to exception handling from implicit toString

GitOrigin-RevId: a79c89eaa5ec6a06fea72985c21244980d0fbcbb
2024-04-22 11:00:51 +00:00
Yuriy Artamonov
ed4b509b66 [java] IDEA-341622 Better cache NullableNotNullManager#findEffectiveNullabilityInfo for library methods
GitOrigin-RevId: ecc23faa48a12ae14ad91be62d0a2216eca74e7a
2024-04-21 17:28:15 +00:00
Tagir Valeev
854a0fdff9 [java-analysis] ArgumentFixerActionFactory: avoid copyTopLevelCall when possible
GitOrigin-RevId: d7422215b715ce26ada14b5486ed5243afb63473
2024-04-19 17:42:22 +00:00
Tagir Valeev
053d59f113 [java-psi] Move JavaLexer utility methods to PsiUtil to make them accessible from java-psi-api
GitOrigin-RevId: 88a728c1d021f703dc9f882e1f9213cd8477ed7a
2024-04-19 17:41:51 +00:00
Tagir Valeev
2f7b700aff [java-intention] AddTypeCastFix.createCastExpression: remove reformat+shortening
Done anyway in the quickfix. Unnecessary and time-consuming during quickfix creation

GitOrigin-RevId: 2c279bbcef53838eef71a493d2a62b84af1ad978
2024-04-19 09:51:56 +00:00
Tagir Valeev
ceb6e8e97f [java-dfa] TypeConstraints.normalizeClassType: avoid unnecessary raw type creation
GitOrigin-RevId: 4ca61a4bb38cd2f109003c230ec60304c641b0dd
2024-04-19 09:51:53 +00:00
Mikhail Pyltsin
977556d83a [java-inspection] IDEA-350713 consider reference in guards as effectively final for UnnecessaryLocalVariableInspection
GitOrigin-RevId: b86300af52688491abe9a8c537092082ea44a7cb
2024-04-18 14:52:48 +00:00
Mikhail Pyltsin
74e210570e [java] Pattern variable can be used mass cleanup
GitOrigin-RevId: 46452d7711435b63fca78af3a6f634bcec862139
2024-04-18 14:03:54 +00:00
Tagir Valeev
ff1cfed0de [java-dfa] Do not assume that fields are non-initialized in readResolve() when readObject() is present
Fixes IDEA-351947 False positive warning 'Nullability and data flow problems' in readResolve

GitOrigin-RevId: 26c71c3e26c087334741a5a098812f91144bdcd4
2024-04-17 14:20:27 +00:00
Tagir Valeev
f783f78a9f [java-intentions] Do not suggest QualifyMethodCallFix in unrelated situations
GitOrigin-RevId: 9aedf1eb95d47d9b87080107b0c58b33e7f84125
2024-04-16 16:24:27 +00:00
Tagir Valeev
c41f8b8269 [java-inspections] IDEA-351562 False negative for integer division in floating point context when using var
GitOrigin-RevId: 064ddb6d50110ba83060fe8785935ca2b4107234
2024-04-16 16:24:22 +00:00
Mikhail Pyltsin
0e4caec126 [java-inspections] IDEA-337706 Support conversion System.out to log calls
- fix quick-fix message

GitOrigin-RevId: 0e81b3efffaa4af7fb739b72ee232ea68665a40e
2024-04-14 18:41:14 +00:00
Mikhail Pyltsin
d8f8800d93 IJ-CR-131028 [java-inspection] IDEA-310469 Java inspection for "Pattern variable can be used" does not find all cases
- rename option

GitOrigin-RevId: 26dc0cfa17c438aa8e41fcc9d52d764573814021
2024-04-14 18:28:41 +00:00
Bas Leijdekkers
0b1872f794 java: report string.toCharArray().length -> string.length() (IDEA-351174)
for "Redundant 'String' operation" inspection

GitOrigin-RevId: 96c3b5d310b9639c74241f48348257bbb83dbe93
2024-04-11 09:52:00 +00:00
Piotr Tomiak
67ff55e124 IDEA-350192 Opening < is missing for generics in inspection message
GitOrigin-RevId: d2b71049e9b48261a36b428d1a2f75e50dceb889
2024-04-10 14:53:33 +00:00
Mikhail Pyltsin
00351758c5 [java-inspection] IDEA-310469 Java inspection for "Pattern variable can be used" does not find all cases
- support more cases

GitOrigin-RevId: 28301b79d4c4acd343a35474d1ab44096dcea8cd
2024-04-09 15:49:16 +00:00
Tagir Valeev
23f17b761b [java-analysis] ExpressionUtils.isConstantArray: support passing array as a method argument
GitOrigin-RevId: 5b8c550cfb132272d0b9080d226a3e6ab1ea3c70
2024-04-09 09:41:29 +00:00
Bart van Helvert
03f636ac44 [kotlin] Add JUnit 5 Kotlin assertions support
Adds support for Kotlin bindings to JUnit 5 assertions #KTIJ-29366

GitOrigin-RevId: 43062c8cda70f91ac1bd58b6a3c27b5fe80086cf
2024-04-09 01:17:54 +00:00
Bas Leijdekkers
bcbd01ca20 [java] ignore non-serializable fields in enums (IDEA-274137)
GitOrigin-RevId: 2268d012377931be155463a846f7a257208d7e1d
2024-04-08 09:55:33 +00:00
Bas Leijdekkers
f9361a5042 [java] don't warn about @Serial on non-private serialVersionUID field (IDEA-321824)
GitOrigin-RevId: 726179763dabea03661d3a64696021f1b08fd8df
2024-04-08 09:55:28 +00:00
Bas Leijdekkers
c19a1c5ee4 [java] move serialization related methods to utility class
GitOrigin-RevId: 9d9e70fcf7972651edaae75649010491bbda8f7a
2024-04-08 09:55:08 +00:00
Bas Leijdekkers
89c8dc03ed [java] better error message on @interface throws/extends list not allowed (IDEA-350501)
GitOrigin-RevId: 1f89c42ac5ffda1d026f6e40cb922b08a095d1dc
2024-04-08 09:54:38 +00:00
Tagir Valeev
f943967aec [java-inspections] Minor fixes for IDEA-346242 Add 'minimal java version' clause automatically to inspection descriptions
1. Add features to assertion inspections
2. Remove redundant feature message from HTML descriptions
3. Display Java 1.3 and Java 1.4 version properly
4. Display several features when necessary

GitOrigin-RevId: 133b46152ad8376a37aa4fd847bedf38d45f3135
2024-04-05 10:20:31 +00:00
Tagir Valeev
274b476799 [java-inspections] Skip reporting on synthetic elements
Fixes IJPL-934 There is no highlighting for JSP file

GitOrigin-RevId: 95d12b410db7ec3f8a3891c46486e4803200b10a
2024-04-05 10:20:28 +00:00
Alexey Kudravtsev
b52286c7d1 cleanup: notnull
GitOrigin-RevId: c075fe9846be03408b4b03a8fe93fe8bdcb93d39
2024-04-04 20:16:08 +00:00