logic: index and store Java annotations

* add annotation symbol kind
* add annotation_usage edge kind
* increment storage version
* record java annotation decls
* record java annotation member decls (as fields)
* update expected output of java sample project indexing tests
* add tests for recording annotations
* add annotation icon, annotation colors
* add new annotation node and edge types to legend
This commit is contained in:
mlangkabel
2018-08-14 17:33:00 +02:00
parent abe0248c1e
commit 9813c9873f
116 changed files with 1184 additions and 88 deletions
@@ -200,21 +200,31 @@ public class BindingNameResolver extends NameResolver
}
}
ContextList ignoredContexts = m_ignoredContexts.copy();
ignoredContexts.add(binding);
TypeName returnTypeName = binding.isConstructor() ? null : getQualifiedName(binding.getReturnType(), m_currentFile, m_compilationUnit, ignoredContexts).orElse(TypeName.unsolved());
List<TypeName> parameterTypeNames = new ArrayList<>();
for (ITypeBinding parameterType: binding.getParameterTypes())
DeclName declName = null;
{
parameterTypeNames.add(getQualifiedName(parameterType, m_currentFile, m_compilationUnit, ignoredContexts).orElse(TypeName.unsolved()));
boolean isStatic = Modifier.isStatic(binding.getModifiers());
ContextList ignoredContexts = m_ignoredContexts.copy();
ignoredContexts.add(binding);
TypeName returnTypeName = binding.isConstructor() ? null : getQualifiedName(binding.getReturnType(), m_currentFile, m_compilationUnit, ignoredContexts).orElse(TypeName.unsolved());
if (binding.isAnnotationMember())
{
declName = new VariableDeclName(name, returnTypeName, isStatic);
}
else
{
List<TypeName> parameterTypeNames = new ArrayList<>();
for (ITypeBinding parameterType: binding.getParameterTypes())
{
parameterTypeNames.add(getQualifiedName(parameterType, m_currentFile, m_compilationUnit, ignoredContexts).orElse(TypeName.unsolved()));
}
declName = new FunctionDeclName(name, typeParameterNames, returnTypeName, parameterTypeNames, isStatic);
}
}
boolean isStatic = Modifier.isStatic(binding.getModifiers());
FunctionDeclName declName = new FunctionDeclName(name, typeParameterNames, returnTypeName, parameterTypeNames, isStatic);
DeclName parentDeclName = getQualifiedContextName(binding);
if (parentDeclName != null)
{
@@ -151,7 +151,7 @@ public class DeclNameResolver extends NameResolver
{
if (decl instanceof AnnotationTypeDeclaration)
{
declName = new DeclName("AnnotationTypeDeclaration");
declName = new DeclName(((AnnotationTypeDeclaration) decl).getName().getIdentifier());
}
else if (decl instanceof EnumDeclaration)
{
@@ -174,7 +174,7 @@ public class DeclNameResolver extends NameResolver
}
else if (decl instanceof AnnotationTypeMemberDeclaration)
{
declName = new DeclName("AnnotationTypeMemberDeclaration");
declName = new DeclName(((AnnotationTypeMemberDeclaration) decl).getName().getIdentifier());
}
else if (decl instanceof EnumConstantDeclaration)
{