Commit Graph

2520 Commits

Author SHA1 Message Date
Anna Kozlova
d7dc142632 [java] isSuperMethod should not accept package private supers in foreign package (IDEA-277888)
GitOrigin-RevId: a43d3067e443a6a439d020507b7acccab3a712a6
2021-09-10 19:22:53 +00:00
Anna Kozlova
e6fb2d8b9c [java] remove 15 Preview language level, finally (IDEA-273436)
GitOrigin-RevId: b5ec2f4843f865e84bdb73bf91966b5998909d37
2021-09-10 19:22:45 +00:00
Nikolay Chashnikov
a90508fbca [java] API cleanup: remove deprecated API (IDEA-271555)
GitOrigin-RevId: 78ca994b689a03aba22eee5e05385bc726e03e85
2021-09-10 18:08:28 +00:00
Ilyas Selimov
8dca1ce0cb [property tests] - replaced psi pointer on boolean flag to make the fix preview-friendly
GitOrigin-RevId: 852c33401253a066abeb81e53ac1e573a277781c
2021-09-06 13:30:02 +00:00
Ilyas Selimov
6ca7f7fbb1 EA - better naming and description
GitOrigin-RevId: 0d2471c7a19419e190ca573422b77c7091423c16
2021-09-03 14:57:23 +00:00
Ilyas Selimov
4590cb7fea IDEA-169223 - added an option to be able to highlight unused parameters apart from hierarchy and quick fix to replace parameter name to "ignored"
GitOrigin-RevId: 4ffc252043c5c1532ec123c146e199e5ce950328
2021-09-03 14:57:20 +00:00
Bart van Helvert
d8e10a2d8d [jvm] IJ-CR-13060 Field request improvements
GitOrigin-RevId: e8320346568e01f48adab6237be2d166a2168036
2021-09-03 12:51:23 +00:00
Tagir Valeev
e182d3705b [java-psi] Document JavaMainMethodProvider
GitOrigin-RevId: 6dbfcd25b35cc52ad6e24639d92490e036a98703
2021-09-03 03:15:45 +00:00
Bart van Helvert
ab4c7671ed [jvm] IJ-13060 JvmValue API improvements
GitOrigin-RevId: 1337891adc9d8476e84b59e689a86956d811c144
2021-08-31 15:59:26 +00:00
Ilyas Selimov
17f7978a6c EA - moved the index-related logic out from EDT
GitOrigin-RevId: e9d18a23406f2ce975220e169862decbc91c85af
2021-08-31 10:22:10 +00:00
Anna Kozlova
f26219d78a keep Java 15 Preview language level for kotlin compatibility
GitOrigin-RevId: d337e2592d2f5aaa7be73b1bb7091081439e8b64
2021-08-31 06:25:41 +00:00
Anna Kozlova
f55ce0722f remove Java 15 Preview language level (IDEA-273436)
GitOrigin-RevId: efe6feafd81a99bde15e892530c1085fc4fb8772
2021-08-31 06:25:32 +00:00
Bart van Helvert
ecf1637c92 [jvm] Introduce JvmValue
GitOrigin-RevId: 2698b4916c21fbd083ceff4232963a6b29ad28ec
2021-08-27 08:51:14 +00:00
Artemiy Sartakov
4d17737f2b AnnotationCacheOwnerNormalizer: added normalizer for elements with cache (EA-354371)
GitOrigin-RevId: 523de13f3c36509682dbd8bbcbe15e1c7270233f
2021-08-26 07:40:59 +00:00
Bas Leijdekkers
78491f661b PSI: update catch section javadoc
GitOrigin-RevId: cc97207372443ba46c57fc6de8246dec69045a92
2021-08-15 14:33:47 +00:00
Alexandr Suhinin
316040e1b7 IDEA-274201 [extract method] parameter folding: pass array access expression as single parameter
GitOrigin-RevId: 23cd2879531de08914969bbdd0f0155c40f92a94
2021-08-03 06:43:05 +00:00
Anna Kozlova
07fe5de1ce [java inference] treat intersection type in one more place (IDEA-274350)
GitOrigin-RevId: d31b30aab900748010f28b02c483c56982d26040
2021-07-27 06:56:28 +00:00
Ilyas Selimov
2e784cc278 java - patterns for switch: renamed preview language level description
GitOrigin-RevId: fe1ab63861ff9ab56bdc920ed0cf7eeb5cb4aa0d
2021-07-20 10:10:49 +00:00
Alexey Kudravtsev
d75f19e731 make fastutil, StreamEx, icu4j libraries unavailable to api modules to avoid exposing them in OpenAPI, add test to enforce this contract
GitOrigin-RevId: 9f6b4a3ed011246c9a34055d251bd6a62e50358d
2021-07-14 12:35:04 +00:00
Alexey Kudravtsev
ca1f84752b avoid using int-object maps from "fastutil" library in api modules
GitOrigin-RevId: d07e123190c4e6f72f9a5c522f2f6e023e640321
2021-07-14 01:43:28 +00:00
Alexey Kudravtsev
246ea60fe7 hide MethodSignatureUtil.HASH_STRATEGIES to avoid dependency on fastutil
GitOrigin-RevId: 16e8bef6dcbff5bf70f46a86098955cdb16fe70c
2021-07-13 23:44:10 +00:00
Alexey Kudravtsev
7d1d737e10 encapsulate usages of fastutil Hash.Strategy to reduce dependencies by using CollectionFactory.createCustomHashingStrategyMap()
GitOrigin-RevId: 87c1c3a8d395e79939fa2c4ab37da587e18fba80
2021-07-13 21:41:43 +00:00
Anna Kozlova
a56acb68b9 add javadoc for correctClassByScope
GitOrigin-RevId: 4b8e2c3da72cb861a3b6831e8ba5598db18ea745
2021-07-12 16:28:54 +00:00
Alexey Kudravtsev
892f44e31c encapsulate method signature map to hide impl
GitOrigin-RevId: c6de5f87c73ff5281a38cce3f1f55c565010c3f8
2021-07-09 10:41:31 +00:00
Anna Kozlova
6baa2ff1c3 [java] ensure inner class is not preferred when package and outer class have the same names
fixing AdvHighlighting14Test.testPackageObscuring

GitOrigin-RevId: 08a3cad8d9730851008754586f2df04da1e9ccf5
2021-07-07 20:19:48 +00:00
Tagir Valeev
7427f881fd [java-analysis] NullableNotNullManager: prefer type annotation over inherited annotation
Fixes IDEA-272250 False-positive warning when overridden method has a nullability type annotation

GitOrigin-RevId: a05ae5bdad95e475ac8a2af7736bcafc0e008364
2021-06-25 11:42:21 +00:00
Nikita Eshkeev
0e5e22a101 [java][resolve] IDEA-271676 Pattern matching for switch: fix resolve
Fix the resolution algorithm for both switch statements and switch expressions. The main obstacle is that the handler of a case expression is a child node of the labeled case rule and the handler of a case statement is the right sibling of the labeled case rule.

The fact that a case handler is the right sibling of a labeled case rule in switch statements complicates the resolving, because the scope of a pattern variable is bound only to the immediate case handler and cannot be accessible from different case handler, which might be invoked when there is no `break` statements between case rules. In order to restrict the scope of a pattern variable in a switch statement the following check is added: check if the analyzed PsiSwitchLabeledStatement is not followed by any other case rules and if so try to resolve an element using its pattern variables.

The scope of pattern variables for PsiSwitchLabeledRuleStatements is restricted only to their case handlers, so the resolve works there only if the lastParent is not null, which, according to the contract, contains the case's handler.

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

GitOrigin-RevId: 084b8b679b4070a67a996c3b50992622025d96ee
2021-06-23 00:33:25 +00:00
Bas Leijdekkers
33bf63892a IG: don't warn about nested conditional expression with parentheses (IDEA-266776)
when "ignore clarifying parentheses" is on

GitOrigin-RevId: 06f3e826a1250793cdff43811f241a00f283b36b
2021-06-21 16:00:00 +00:00
Nikita Eshkeev
e0970fca77 [java][resolve] IDEA-271676 Pattern matching for switch: fix resolve
Fix the resolve algorithm according to [JEP 406](https://openjdk.java.net/jeps/406). It includes:

- The correct resolution of variables in pattern matching guards in both if and switch
- Restricting the maximal scope of resolving by the PsiSwitchLabeledRuleStatement
- Various tests for resolving variable in pattern matching for switch

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

GitOrigin-RevId: 1efb10f50a458a382a71ffeaef5a0f540b4a8893
2021-06-19 21:31:03 +00:00
Roman Ivanov
4c064781c7 [java] minor, rename element -> list
GitOrigin-RevId: 779424da464e5398cfb46d7e277fe8a093bb804f
2021-06-15 17:46:02 +00:00
Roman Ivanov
3904bfee9e [java] make type element and pattern in PsiTypeTestPattern nullable
to ensure that parser will have enough space for development

GitOrigin-RevId: f7831a41332dc9c2b8619f6a30c98366faaf30e9
2021-06-14 17:31:49 +00:00
Nikolay Chashnikov
d28aae9d66 [API] add ScheduledForRemoval annotation to API which was deprecated in 211 (IDEA-262168)
GitOrigin-RevId: 292d0da79ff2e63e10d9c432007ab1bab985c4ec
2021-06-12 11:14:38 +00:00
Nikita Eshkeev
88ff60d32e [java] IDEA-271156 Update "Usages of API which isn't available at the configured language level" inspection for java 17
Move the LanguageLevel#getNextLanguageLevel inside Java15APIUsageInspection as it is used solely there as per the code review

GitOrigin-RevId: 9c8ad97fd88d68a7fac4d3a72ab5b124bac6809f
2021-06-11 20:35:22 +00:00
Nikolay Chashnikov
3d6326eb0b [API] add ScheduledForRemoval annotation to API which was deprecated in 211 (IDEA-262168)
GitOrigin-RevId: 15d423c655055d00a05d55e8951b33ad935247f6
2021-06-11 20:01:10 +00:00
Roman Ivanov
e60c890f45 [java] PsiDefaultElement ->PsiDefaultCaseLabelElement
GitOrigin-RevId: 1ec42a39b2271a829d9dff6891a39f26e12aa4b7
2021-06-11 17:35:39 +00:00
Roman Ivanov
9c1c871b42 [java] return light expression list for compatibility in PsiSwitchLabelStatement
GitOrigin-RevId: be6ec0ee5748fa877060f0c861e7e5031899cab1
2021-06-11 17:35:34 +00:00
Anna Kozlova
5ad85730fb [java language level] too early for java 17 by default
GitOrigin-RevId: 7b65f9a8172d125f5324eead683bc96232cebbcf
2021-06-11 07:49:04 +00:00
Anna Kozlova
5cd6b5c3d2 [java] protected method in final class: make private where possible
GitOrigin-RevId: 3e6f6d1d19c2ffd51020bb8fb6ef76ee0c5eaae5
2021-06-11 07:49:00 +00:00
Anna Kozlova
2593f96146 [code cleanup] remove redundant final modifiers for methods in final classes
GitOrigin-RevId: dc7f18dafcc1b970b1ed4fc7316839ea983f68d7
2021-06-11 07:48:56 +00:00
Nikita Eshkeev
fad2d72f9c [java] IDEA-271156 Update "Usages of API which isn't available at the configured language level" inspection for java 17
Add the support of detecting if new API from JDK17 is used. This patch includes:

- Adding the api17.txt file with the list of all the new API from JDK 17
- Adding LanguageLevel#getNextLanguageLevel to safely get the next language level with the correct handling of the preview levels
- Adding a test for checking the access to the new API from JDK 17

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

GitOrigin-RevId: bab653b5ead9da080da275803253396a119f9fff
2021-06-10 21:11:39 +00:00
Anna Kozlova
1babdadeda language level 17 (IDEA-271016)
GitOrigin-RevId: e2e25300af432efa580e4f082492f522f2d23b8e
2021-06-08 16:52:50 +00:00
Roman Ivanov
31362f1667 java PSI: remove null element (redundant)
GitOrigin-RevId: 42aaae27cc487dbcb0aa8424be0b617a3f6448b4
2021-06-07 22:03:16 +00:00
Roman Ivanov
1ef7d7e9cb java PSI: make getPatternVariable NotNull
reason: now PsiTypeTestPattern is not returned for simple instanceof

GitOrigin-RevId: d7874d96f8f01489034884238ea908b0059e2c3a
2021-06-07 22:03:13 +00:00
Roman Ivanov
f69f404dfa java PSI: rename null and default case label elements
GitOrigin-RevId: 17eb082cacbbb713bd31c83e356c2e9b3f80bfdd
2021-06-07 22:03:09 +00:00
Roman Ivanov
8bf09153a8 Java PSI: add contracts and fix typo
GitOrigin-RevId: 13589b6e1746eda2ca07491af5a70554dc8f1498
2021-06-07 22:03:04 +00:00
Roman Ivanov
feb02ace97 Java: implement PSI for pattern matching in switch : IDEA-270060
GitOrigin-RevId: cd993242d0d5a02fc024be55512da84dd353a0cd
2021-06-07 22:03:03 +00:00
Roman Ivanov
b0769e53fa Java: implement parser for pattern matching in switch : IDEA-270060
GitOrigin-RevId: 586fe6199e79db35098202959c3aeaab2c0ada1f
2021-06-07 22:03:01 +00:00
Anna Kozlova
e287fd7576 [java] [inference]: avoid recursion guards in clients as they may prevent engine code to complete normally (IDEA-268120)
here highlighting got guarded and inference was unable to walk up to the containing call and failed because of that. Guard is needed for the case when the same code may be invoked *during* inference itself, corresponding guard exists already and mentioned in javadoc

GitOrigin-RevId: bdb8ba5056884d1b6869bd0d31c8482f77adb3a7
2021-05-27 23:14:57 +00:00
Anna Kozlova
1705f01347 [java] lambda context: allow conditional with lambda branches in switch cases (IDEA-269928)
extract cast processing to the upper level as it's not allowed in conditions (^Tagir)

GitOrigin-RevId: 3e608c133d2b44d67f9b57721fbf62c04c2c4147
2021-05-26 19:26:22 +00:00
Anna Kozlova
5ab478e48e [java] lambda context: allow conditional with lambda branches in switch cases (IDEA-269928)
GitOrigin-RevId: 5bdcade69a621a83cc88074dd566e401852d0fd0
2021-05-25 06:42:11 +00:00