Commit Graph

1136 Commits

Author SHA1 Message Date
Peter Gromov 1182518e6b JavaFunctionalExpressionIndex: don't throw on invalid code with lambdas outside members
GitOrigin-RevId: b2fac86f104ebf9d7a79dfc8136a69e7343adbb4
2020-06-19 19:49:34 +03:00
Peter Gromov 112cdd0579 java completion: prefer method reference suggestions with exactly matching return type (IDEA-210581)
GitOrigin-RevId: 5522e5c103b72ea9d1a7c9ae860e504b6515b1da
2020-06-17 20:39:35 +03:00
Peter Gromov 1ab76a3b95 Skip some invalid/meaningless .stream().* completion suggestions (IDEA-243790)
GitOrigin-RevId: e02ac9f63fd6384ffe3f27f5c4825ddc3a5af58e
2020-06-17 19:18:12 +03:00
Peter Gromov b9525d143e java completion: sort/filter suggestions after :: by their matching to the expected type (IDEA-166673)
GitOrigin-RevId: adaefc912e115826280976b23adee38483ca1f71
2020-06-17 17:01:52 +03:00
Peter Gromov 847bb51000 IDEA-188654 Stream API methods autocomplete
GitOrigin-RevId: c4e2caba222324726aad91148ab37c0acf4fd86a
2020-06-08 08:20:56 +00:00
Peter Gromov 29ef77afd0 IDEA-242422 ArrayIndexOutOfBoundsException in FunExprOccurrence
GitOrigin-RevId: d0b1b4e881c919d9e855f897452c371dd12f2a59
2020-06-03 15:56:48 +03:00
Anna Kozlova 0314adac6d java: redundant cast: don't check casts against non-denotable types
GitOrigin-RevId: ba1ac48a92057ae13f2694a6667e576ca1328134
2020-05-20 06:38:50 +00:00
Anna Kozlova 4b5272c14a java: redundant cast: check inference problems in cast operand
expected type (available after removing type cast) may add bounds for inference variables which would lead to errors after applying the fix

GitOrigin-RevId: 24a97411b7175cacabd8e81ed5711509195dfd4d
2020-05-15 20:27:18 +00:00
Anna Kozlova 2bc23faf05 java: redundant cast: preserve exact types for functional expressions
otherwise we may loose serialization or miss compilation errors in lambda body

GitOrigin-RevId: 180e0ee713a19c42abecf1228616bbd6754ea3b8
2020-05-15 08:33:44 +00:00
Anna Kozlova c879ed4e4a java redundant cast: preserve multiple type casts around functional interface when if expected type is the same as cast
isAssignable check may fail otherwise

GitOrigin-RevId: d02c9d50645a2bbb0e957f077a4a66813c94afd6
2020-05-11 20:09:58 +00:00
Anna Kozlova 7f02ca14a9 java redundant cast: check conditional expression as call argument inplace
GitOrigin-RevId: ee7fa6ef4cac4e39e9dad97c7d5ace983bc81044
2020-05-11 08:33:17 +00:00
Anna Kozlova e3bc888dc7 java redundant cast: cleanup checks for calls
GitOrigin-RevId: 2d999bc7356856ef7d2fea45f793d69f401f7256
2020-05-11 08:33:17 +00:00
Anna Kozlova 78891be4bb java redundant cast: cleanup: extract conditional
GitOrigin-RevId: ca95c0e70c197e27943596e91df8d526bbfbf1bb
2020-05-11 08:33:17 +00:00
Anna Kozlova efc6106e02 java redundant cast: cleanup: avoid dbl cast registration for expressions with expected type
GitOrigin-RevId: a31b1d892b2e19bfaf556e85724eb244189111b4
2020-05-11 08:33:17 +00:00
Anna Kozlova fdc80d017c java redundant cast: fixed multiple casts in synchronized stmt
GitOrigin-RevId: 49a7d8dbcd26a3aa905c57db97d386bcbd285464
2020-05-11 08:33:17 +00:00
Anna Kozlova 1c35803b4a java redundant cast: cleanup: extract foreach, instanceof, throws statements
GitOrigin-RevId: ac04ea8db453518f4c15d3e37e33d9a25a22ce35
2020-05-11 08:33:17 +00:00
Anna Kozlova 0a41902bda java redundant cast: normalize parenthesis
GitOrigin-RevId: 8069758686e0e76c3aed4d6851914315d29a493e
2020-05-05 21:49:48 +00:00
Anna Kozlova c2ec0c2e78 java redundant cast: forbid changing of substitutor if cast is removed (IDEA-184330)
this way neighbour functional expressions can't be broken

GitOrigin-RevId: c13823eca79157030f3dde53fa6a6d496be9c2b7
2020-05-05 21:49:48 +00:00
Anna Kozlova 349c96eaee java redundant cast: allow warnings in poly conditional when target type remains the same
GitOrigin-RevId: f953fc42882a1eaad0b0a8c65d1e94236f0ec99e
2020-05-05 11:29:06 +00:00
Anna Kozlova 462856d81c java: ensure that lambda parameters are available inside lambdabody.copy() (IDEA-222542)
GitOrigin-RevId: b31c6c8484d8e77e96dfad104b08ce13631ddeaa
2020-05-05 07:04:28 +00:00
Anna Kozlova 02d7164d3b java redundant cast: check erased context (IDEA-205885)
GitOrigin-RevId: 1dd464c7b8feba43181c9e60472170b2bbbaa72e
2020-05-04 20:49:32 +00:00
Tagir Valeev 3643ee6506 Fixes according to review IDEA-CR-61871
GitOrigin-RevId: 206247808adba050a5839ee8ac0be790bb53c8ac
2020-04-24 08:26:53 +00:00
Tagir Valeev ec8510b0a6 PsiPolyExpressionUtil#isBooleanOrNumericType: do not check bounds
JLS 15.25 says: ...has return type boolean or Boolean. or ...is convertible to a numeric type.
JLS 5.1.8 says:
A type is said to be convertible to a numeric type if it is a numeric type (§4.2), or it is a reference type that may be converted to a numeric type by unboxing conversion.

Nothing about bounds
PolyConditionalExpressionWithTargetPrimitive test behavior matches Java 9+ now (with --release=8)

GitOrigin-RevId: fa14e909ad623a3ab6bb8355bbbe396003cd782c
2020-04-23 08:56:21 +00:00
Peter Gromov 0b3f27a0af java: make resolveAllQualifiers go through RecursionManager to take advantage of its memoization (IDEA-236961)
GitOrigin-RevId: 1bfe281cbfaa8c6423a12313daf6f72aae738846
2020-04-17 06:14:17 +00:00
Anna Kozlova 641ac74ad8 java inference: support nested constraints inside code blocks (IDEA-237446)
GitOrigin-RevId: e865db7a88560615b1abca31b3ceefeb1ae76573
2020-04-14 12:01:57 +00:00
Anna Kozlova d439f31f50 failing performance test for IDEA-236961
GitOrigin-RevId: 37ffa237be6c2c6965d8ce72854ef2976c6c837d
2020-04-14 09:20:37 +00:00
Anna Kozlova 0580ad0043 don't prohibit caching if overload resolution is impossible (IDEA-221094)
exactly one candidate is available

GitOrigin-RevId: 4c6d5b4eef79fb60af46d8d9db9f7e49adb2f8c4
2019-12-04 19:31:48 +00:00
Anna.Kozlova 4ad4e7d908 java overload resolution: fix NPE
found by property testing

GitOrigin-RevId: b45cb07402ad58a37886b7f1b5afb62bca2746fe
2019-12-04 09:38:15 +00:00
Anna.Kozlova 21e434894f java inference: stop when argument has no associated formal parameter
GitOrigin-RevId: cbc4e435f6e03bd06eac4dcf21196bdd61dc6c3d
2019-12-03 16:04:11 +00:00
Anna.Kozlova c20dfc0165 java inference: ignore method reference constraints when starting from them
EA-209460 - IAE: ObjectUtils.$$$reportNull$$$

GitOrigin-RevId: 8476b832fcc1c85c10aed6ea56f65645bfd02b03
2019-11-28 10:38:15 +00:00
Anna.Kozlova d4ff582489 assert no type execution under overload lock for diamonds
IDEA-CR-55327

GitOrigin-RevId: e2b1043a41b9548df3c2eb263a27da6d6c22b6be
2019-11-19 09:12:58 +00:00
Tagir Valeev 3fa35e0750 testResolveDiamondBeforeOuterCall simplified (TreeSet ctor overloads don't matter here)
GitOrigin-RevId: 6b303239bed1ffcfd94cbd54f781541e38dc5837
2019-11-15 10:05:32 +00:00
Tagir Valeev 85f72bfc0f testResolveDiamondBeforeOuterCall (fails if new expression type is requested before highlighting)
GitOrigin-RevId: b01abb3fbbebe28e3115aa109005851b62a02e7b
2019-11-15 08:03:12 +00:00
Anna Kozlova eb79bfc3d3 java inference: ease assertion for lambdas in non-generic calls (EA-143883)
GitOrigin-RevId: 0e5ff0aa54375926c8ea5e2140458457250034dc
2019-11-08 21:03:13 +00:00
Anna Kozlova 856ec460c6 overload resolution: detect qualifier of unqualified call by processDeclaration's source where candidate was found
conflict resolution for static methods of the interface found by inheritance and nesting

GitOrigin-RevId: b637b02de4f59010a138c66890d1efcbcd1d588d
2019-11-07 02:40:58 +00:00
Anna Kozlova d6297185ce java resolve: don't stop on found static method of the interface (IDEA-225660)
if the call site' qualifier is incorrect

GitOrigin-RevId: 782629045050df08fed3cf554682b63db8c9e1a8
2019-11-07 02:40:58 +00:00
Anna.Kozlova 589b029a97 java method ref highlighting: don't mirror errors of not applicable methods of return type (IDEA-224306)
GitOrigin-RevId: 40b4293c754640445b9fac741eab24261e8060cc
2019-10-10 10:03:10 +00:00
Anna.Kozlova 87deef960c incompatible types: highlight parent call instead of lambda when the error isn't related to lambda (IDEA-218801)
GitOrigin-RevId: 17a2f1f62f7703930aa25a8cfd6dfd4a918e1fe7
2019-10-10 07:01:11 +00:00
Anna.Kozlova 8db821428d lvti: special highlight for self referencing variables (IDEA-224449)
assume that null as type of the left side of the assignment is not possible

GitOrigin-RevId: c407cdc11e991c8db24ffd683f3b8ea883d41244
2019-10-09 10:32:32 +00:00
Anna Kozlova 1768efa804 incompatible types: highlight only wrong arguments instead of full arg list (IDEA-220107)
GitOrigin-RevId: 38a12e4fa7ea27d156dae1fe6bc7bd6902db6251
2019-09-20 19:31:36 +00:00
Anna Kozlova fb5f755910 java inference: prevent recursive conflict resolution when it isn't prevented by ResolveCache guard
advanceResolve(incomplete=true) prevents guard to work

GitOrigin-RevId: 437ec02af808a89c8339909411bec6d95ff225dc
2019-09-13 07:12:19 +00:00
Anna Kozlova d829a7c8f4 java inference: ensure that applicability check is not re-entered
this fixes assertion
	at com.intellij.util.ObjectUtils.assertNotNull(ObjectUtils.java:84)
	at com.intellij.psi.infos.MethodCandidateInfo.inferTypeArguments(MethodCandidateInfo.java:453)
caused by including expression compatibility constraints for expressions inside lambdas for which parameter types are calculated

GitOrigin-RevId: 0588bff4a719fb73ff49a51bc86635e56cd8d146
2019-09-05 19:19:32 +00:00
Anna Kozlova 55426d88a9 java resolve: ensure cached all qualifiers do not lead to cached types based on ThreadLocalTypes values
fixes failed check for different types returned on different threads (see JavaResolveCache#reportUnstableType)

GitOrigin-RevId: a5efd5e5a9657ad55c74e413185959c517e341e8
2019-09-01 17:03:16 +00:00
Anna Kozlova 1e5631c6ee fixing grammar
IDEA-CR-51559

GitOrigin-RevId: f44d7b539164a8086c022b786c721bf7011608b1
2019-08-22 01:50:10 +03:00
Anna Kozlova fd969c0595 java resolve: cache resolved qualifiers when global cache is prohibited (IDEA-219505) ^peter
when type inference is called, it's not known if the client calls inference on resolved method or enumerates all possible candidates and thus the results cant be cached; current implementation is pessimistic and prohibit all caching during inference. Thus, for long method call chains which depend on some non-trivial calculations, it may be extremely resource consuming. Let's cache all qualifiers locally: this doesn't prevent recalculation globally but works around performance problems per single call

GitOrigin-RevId: b9b42cbc50918259f5de3a81d5f3a38967c153f1
2019-08-20 10:01:31 +03:00
Anna Kozlova 8777687e32 java inference: proceed with nested inference for lambda parameter type detection (IDEA-219330)
GitOrigin-RevId: f0a4862b94f9cff4c88b1f56425663bbd8659d7a
2019-08-07 00:03:21 +03:00
Anna Kozlova 616e3ca030 method references: allow access to protected methods through super (IDEA-217862)
GitOrigin-RevId: f1d86f6127a64146e87998423f3034e38a46409c
2019-08-05 23:03:36 +03:00
peter a04504dddc don't suggest inaccessible qualifiers when chain-completing a java method reference (IDEA-217955)
GitOrigin-RevId: 78fc63c40948e6873279d6fe4c923bf3113a8b2e
2019-07-23 17:44:15 +03:00
Anna Kozlova 67839b3676 java unchecked warning: narrow down highlighting to class/method reference (IDEA-203860)
GitOrigin-RevId: ee686cedeef7aa677445b5054c9e191ce1d15a77
2019-07-15 12:05:58 +03:00
Anna Kozlova bd882f2a97 java inference: stop walkUp in assignment context inside method call chain (IDEA-217928)
GitOrigin-RevId: 79ac2370cd302d7e38d029e065ff4a28ed8709a4
2019-07-11 23:22:40 +03:00