src: refactor java indexer

* renamed java name classes
* rearranged methods in ContextAwareAstVisitor to match the order in AstVisitor
This commit is contained in:
mlangkabel
2017-09-11 09:48:03 +02:00
parent a24282c0de
commit 99f54eedbc
10 changed files with 212 additions and 214 deletions
@@ -118,34 +118,10 @@ public class ContextAwareAstVisitor extends AstVisitor
}
@Override
public boolean visit(ClassInstanceCreation node)
public boolean visit(final ImportDeclaration node)
{
boolean visitChildren = super.visit(node);
if (visitChildren)
{
acceptChild(node.getExpression());
{
m_typeRefKind.push(ReferenceKind.TYPE_ARGUMENT);
acceptChildren(node.typeArguments());
m_typeRefKind.pop();
}
if (node.getAnonymousClassDeclaration() != null)
{
m_typeRefKind.push(ReferenceKind.INHERITANCE);
acceptChild(node.getType());
m_typeRefKind.pop();
}
else
{
acceptChild(node.getType());
}
acceptChildren(node.arguments());
acceptChild(node.getAnonymousClassDeclaration());
}
// We don't want to visit the name of the ImportDeclaration because this could cause a self reference.
super.visit(node);
return false;
}
@@ -197,18 +173,6 @@ public class ContextAwareAstVisitor extends AstVisitor
return false;
}
@Override
public boolean visit(final ImportDeclaration node)
{
// We don't want to visit the name of the ImportDeclaration because this could cause a self reference.
super.visit(node);
return false;
}
@Override
public boolean visit(MethodInvocation node)
{
@@ -286,9 +250,6 @@ public class ContextAwareAstVisitor extends AstVisitor
return false;
}
@Override
public boolean visit(CreationReference node)
{
@@ -345,6 +306,38 @@ public class ContextAwareAstVisitor extends AstVisitor
return false;
}
@Override
public boolean visit(ClassInstanceCreation node)
{
boolean visitChildren = super.visit(node);
if (visitChildren)
{
acceptChild(node.getExpression());
{
m_typeRefKind.push(ReferenceKind.TYPE_ARGUMENT);
acceptChildren(node.typeArguments());
m_typeRefKind.pop();
}
if (node.getAnonymousClassDeclaration() != null)
{
m_typeRefKind.push(ReferenceKind.INHERITANCE);
acceptChild(node.getType());
m_typeRefKind.pop();
}
else
{
acceptChild(node.getType());
}
acceptChildren(node.arguments());
acceptChild(node.getAnonymousClassDeclaration());
}
return false;
}
@Override
public boolean visit(Javadoc node)
{