boolean (InsertionContext context, PsiTypeLookupItem delegate) { PsiNewExpression newExpr = PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiNewExpression.class, false); if (newExpr != null) { for (ExpectedTypeInfo info : ExpectedTypesProvider.getExpectedTypes(newExpr, true)) { PsiType expected = info.getDefaultType(); if (expected.isAssignableFrom(delegate.getType())) { if (expected instanceof PsiClassType && ((PsiClassType)expected).isRaw()) { return true; } } } } return false; }