This commit is contained in:
Dmitry Batkovich
2018-03-12 20:03:29 +03:00
parent cb350d634f
commit 557e06b968
2 changed files with 4 additions and 10 deletions
@@ -171,22 +171,16 @@ class JavaSimplePropertyIndex : FileBasedIndexExtension<Int, PropertyIndexValue>
.singleOrNull { ElementType.JAVA_STATEMENT_BIT_SET.contains(it.tokenType) }
?.takeIf { it.tokenType == JavaElementType.RETURN_STATEMENT}
?.let { LightTreeUtil.firstChildOfType(tree, it, ElementType.EXPRESSION_BIT_SET) }
?.takeIf(this::doNotContainMethodCalls)
?.takeIf(this::doesNotContainMethodCalls)
?.let { LightTreeUtil.toFilteredString(tree, it, null) }
private fun doNotContainMethodCalls(expression: LighterASTNode): Boolean {
private fun doesNotContainMethodCalls(expression: LighterASTNode): Boolean {
if (expression.tokenType == JavaElementType.METHOD_CALL_EXPRESSION) {
return false
}
val qualifier = JavaLightTreeUtil.findExpressionChild(tree, expression)
return qualifier == null || doNotContainMethodCalls(qualifier)
return qualifier == null || doesNotContainMethodCalls(qualifier)
}
private fun isEmptyExpressionList(expressionList: LighterASTNode): Boolean {
val children = tree.getChildren(expressionList)
return children.size == 2 && children[0].tokenType == JavaTokenType.LPARENTH && children[1].tokenType == JavaTokenType.RPARENTH
}
}.visitNode(tree.root)
result
}
@@ -79,7 +79,7 @@ public abstract class RunConfigurationProducer<T extends RunConfiguration> {
return null;
}
}
catch (ClassCastException e) {
catch (Exception e) {
LOG.error(myConfigurationFactory + " produced wrong type", e);
return null;
}