logic: updated Java indexer
this fixes a lot of unsolved-symbol issues.
This commit is contained in:
@@ -2,7 +2,8 @@ package io.coati;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
import com.github.javaparser.ast.type.TypeParameter;
|
||||
import com.github.javaparser.ast.NodeList;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.body.ConstructorDeclaration;
|
||||
import com.github.javaparser.ast.body.Parameter;
|
||||
@@ -25,15 +26,15 @@ public class CallableConstructorDecl implements CallableDecl
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return m_decl.getName();
|
||||
return m_decl.getNameAsString();
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters()
|
||||
public NodeList<TypeParameter> getTypeParameters()
|
||||
{
|
||||
return m_decl.getTypeParameters();
|
||||
}
|
||||
|
||||
public List<Parameter> getParameters()
|
||||
public NodeList<Parameter> getParameters()
|
||||
{
|
||||
return m_decl.getParameters();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package io.coati;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
import com.github.javaparser.ast.type.TypeParameter;
|
||||
import com.github.javaparser.ast.NodeList;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.body.Parameter;
|
||||
import com.github.javaparser.ast.type.Type;
|
||||
@@ -11,7 +12,7 @@ public interface CallableDecl
|
||||
{
|
||||
public BodyDeclaration getWrappedNode();
|
||||
public String getName();
|
||||
public List<TypeParameter> getTypeParameters();
|
||||
public List<Parameter> getParameters();
|
||||
public NodeList<TypeParameter> getTypeParameters();
|
||||
public NodeList<Parameter> getParameters();
|
||||
public Type getType();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package io.coati;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
import com.github.javaparser.ast.type.TypeParameter;
|
||||
import com.github.javaparser.ast.NodeList;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.body.MethodDeclaration;
|
||||
import com.github.javaparser.ast.body.Parameter;
|
||||
@@ -24,15 +25,15 @@ public class CallableMethodDecl implements CallableDecl
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return m_decl.getName();
|
||||
return m_decl.getNameAsString();
|
||||
}
|
||||
|
||||
public List<TypeParameter> getTypeParameters()
|
||||
public NodeList<TypeParameter> getTypeParameters()
|
||||
{
|
||||
return m_decl.getTypeParameters();
|
||||
}
|
||||
|
||||
public List<Parameter> getParameters()
|
||||
public NodeList<Parameter> getParameters()
|
||||
{
|
||||
return m_decl.getParameters();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package io.coati;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.github.javaparser.Position;
|
||||
|
||||
public class FileContent
|
||||
{
|
||||
@@ -26,13 +29,18 @@ public class FileContent
|
||||
|
||||
public Location find(String s)
|
||||
{
|
||||
return find(s, 1, 1);
|
||||
return find(s, Position.pos(1, 1));
|
||||
}
|
||||
|
||||
public Location find(String s, int fromLine, int fromColumn)
|
||||
public Location find(String s, Optional<Position> from)
|
||||
{
|
||||
int lineIndex = fromLine - 1;
|
||||
int startColumn = fromColumn - 1;
|
||||
return find(s, from.orElse(Position.pos(1, 1)));
|
||||
}
|
||||
|
||||
public Location find(String s, Position from)
|
||||
{
|
||||
int lineIndex = from.line - 1;
|
||||
int startColumn = from.column - 1;
|
||||
int column = -1;
|
||||
while (lineIndex < m_lines.size())
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.coati;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
||||
@@ -12,37 +13,42 @@ import com.github.javaparser.ast.body.FieldDeclaration;
|
||||
import com.github.javaparser.ast.body.MethodDeclaration;
|
||||
import com.github.javaparser.ast.body.Parameter;
|
||||
import com.github.javaparser.ast.body.VariableDeclarator;
|
||||
import com.github.javaparser.ast.body.VariableDeclaratorId;
|
||||
import com.github.javaparser.ast.comments.BlockComment;
|
||||
import com.github.javaparser.ast.comments.LineComment;
|
||||
import com.github.javaparser.ast.expr.ArrayInitializerExpr;
|
||||
import com.github.javaparser.ast.expr.FieldAccessExpr;
|
||||
import com.github.javaparser.ast.expr.MethodCallExpr;
|
||||
import com.github.javaparser.ast.expr.Name;
|
||||
import com.github.javaparser.ast.expr.NameExpr;
|
||||
import com.github.javaparser.ast.expr.QualifiedNameExpr;
|
||||
import com.github.javaparser.ast.expr.SimpleName;
|
||||
import com.github.javaparser.ast.expr.VariableDeclarationExpr;
|
||||
import com.github.javaparser.ast.stmt.BlockStmt;
|
||||
import com.github.javaparser.ast.stmt.SwitchStmt;
|
||||
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
||||
import com.github.javaparser.ast.type.PrimitiveType;
|
||||
import com.github.javaparser.ast.type.Type;
|
||||
import com.github.javaparser.ast.type.TypeParameter;
|
||||
import com.github.javaparser.ast.type.VoidType;
|
||||
import com.github.javaparser.ast.ImportDeclaration;
|
||||
import com.github.javaparser.ast.imports.*;
|
||||
import com.github.javaparser.Position;
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.ast.Modifier;
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.PackageDeclaration;
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.UnsolvedSymbolException;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserSymbolDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.MethodAmbiguityException;
|
||||
import me.tomassetti.symbolsolver.model.declarations.TypeDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.ValueDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.invokations.MethodUsage;
|
||||
import me.tomassetti.symbolsolver.model.resolution.SymbolReference;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.*;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserFieldDeclaration;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserParameterDeclaration;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserSymbolDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.MethodAmbiguityException;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.ReferenceTypeDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.ValueDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.methods.MethodUsage;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.SymbolReference;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.UnsolvedSymbolException;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.*;
|
||||
import com.github.javaparser.symbolsolver.resolution.MethodResolutionLogic;
|
||||
|
||||
public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
@@ -64,19 +70,19 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
m_context.add(new DeclContext(fileName + "\ts\tp"));
|
||||
}
|
||||
|
||||
|
||||
// --- record declarations ---
|
||||
|
||||
@Override public void visit(final PackageDeclaration n, final Void v)
|
||||
{
|
||||
NameExpr nameExpr = n.getName();
|
||||
Name name = n.getName();
|
||||
|
||||
String packageName = JavaparserDeclNameResolver.getQualifiedName(nameExpr).toSerializedNameHierarchy();
|
||||
String packageName = JavaparserDeclNameResolver.getQualifiedName(name).toSerializedNameHierarchy();
|
||||
Optional<Position> as = name.getBegin();
|
||||
|
||||
JavaIndexer.recordSymbolWithLocationAndScope(
|
||||
m_callbackId, packageName, SymbolType.PACKAGE,
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
name.getRange(),
|
||||
n.getRange(),
|
||||
AccessKind.NONE, false
|
||||
);
|
||||
|
||||
@@ -85,19 +91,22 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final ClassOrInterfaceDeclaration n, final Void v)
|
||||
{
|
||||
NameExpr nameExpr = n.getNameExpr();
|
||||
SimpleName name = n.getName();
|
||||
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(n, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
JavaIndexer.recordSymbolWithLocationAndScope(
|
||||
m_callbackId, qualifiedName, (n.isInterface() ? SymbolType.INTERFACE : SymbolType.CLASS),
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
name.getRange(),
|
||||
n.getRange(),
|
||||
AccessKind.fromAccessSpecifier(Modifier.getAccessSpecifier(n.getModifiers())), false
|
||||
);
|
||||
|
||||
FileContent.Location scopeStartLocation = m_fileContent.find("{", n.getBegin().line, n.getBegin().column);
|
||||
recordScope(scopeStartLocation.line, scopeStartLocation.column, n.getEnd().line, n.getEnd().column);
|
||||
if (n.getRange().isPresent())
|
||||
{
|
||||
FileContent.Location scopeStartLocation = m_fileContent.find("{", n.getBegin());
|
||||
recordScope(Range.range(scopeStartLocation.line, scopeStartLocation.column, n.getRange().get().end.line, n.getRange().get().end.column));
|
||||
}
|
||||
|
||||
List<DeclContext> parentContext = m_context;
|
||||
m_context = new ArrayList<DeclContext>();
|
||||
@@ -121,9 +130,21 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
qualifiedName += "\tn";
|
||||
qualifiedName += n.getName() + "\ts\tp";
|
||||
|
||||
|
||||
Optional<Range> range = Optional.empty();
|
||||
if (n.getBegin().isPresent())
|
||||
{
|
||||
range = Optional.of(Range.range(
|
||||
n.getBegin().get().line,
|
||||
n.getBegin().get().column,
|
||||
n.getBegin().get().line,
|
||||
n.getBegin().get().column + n.getNameAsString().length() - 1
|
||||
));
|
||||
}
|
||||
|
||||
JavaIndexer.recordSymbolWithLocation(
|
||||
m_callbackId, qualifiedName, SymbolType.TYPE_PARAMETER,
|
||||
n.getBegin().line, n.getBegin().column, n.getBegin().line, n.getBegin().column + n.getName().length() - 1,
|
||||
range,
|
||||
AccessKind.TYPE_PARAMETER, false
|
||||
);
|
||||
|
||||
@@ -136,19 +157,22 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final EnumDeclaration n, final Void v)
|
||||
{
|
||||
NameExpr nameExpr = n.getNameExpr();
|
||||
SimpleName name = n.getName();
|
||||
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(n, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
JavaIndexer.recordSymbolWithLocationAndScope(
|
||||
m_callbackId, qualifiedName, SymbolType.ENUM,
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
name.getRange(),
|
||||
n.getRange(),
|
||||
AccessKind.fromAccessSpecifier(Modifier.getAccessSpecifier(n.getModifiers())), false
|
||||
);
|
||||
|
||||
FileContent.Location scopeStartLocation = m_fileContent.find("{", n.getBegin().line, n.getBegin().column);
|
||||
recordScope(scopeStartLocation.line, scopeStartLocation.column, n.getEnd().line, n.getEnd().column);
|
||||
|
||||
if (n.getRange().isPresent())
|
||||
{
|
||||
FileContent.Location scopeStartLocation = m_fileContent.find("{", n.getBegin());
|
||||
recordScope(Range.range(scopeStartLocation.line, scopeStartLocation.column, n.getRange().get().end.line, n.getRange().get().end.column));
|
||||
}
|
||||
|
||||
List<DeclContext> parentContext = m_context;
|
||||
m_context = new ArrayList<DeclContext>();
|
||||
@@ -163,7 +187,7 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
JavaIndexer.recordSymbolWithLocation(
|
||||
m_callbackId, qualifiedName, SymbolType.ENUM_CONSTANT,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
n.getRange(),
|
||||
AccessKind.NONE, false
|
||||
);
|
||||
|
||||
@@ -176,14 +200,14 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final ConstructorDeclaration n, final Void v)
|
||||
{
|
||||
NameExpr nameExpr = n.getNameExpr();
|
||||
SimpleName name = n.getName();
|
||||
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(n, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
JavaIndexer.recordSymbolWithLocationAndScope(
|
||||
m_callbackId, qualifiedName, SymbolType.METHOD,
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
name.getRange(),
|
||||
n.getRange(),
|
||||
AccessKind.fromAccessSpecifier(Modifier.getAccessSpecifier(n.getModifiers())), false
|
||||
);
|
||||
|
||||
@@ -196,27 +220,27 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final MethodDeclaration n, final Void v)
|
||||
{
|
||||
NameExpr nameExpr = n.getNameExpr();
|
||||
SimpleName name = n.getName();
|
||||
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(n, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
JavaIndexer.recordSymbolWithLocationAndScope(
|
||||
m_callbackId, qualifiedName, SymbolType.METHOD,
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
name.getRange(),
|
||||
n.getRange(),
|
||||
AccessKind.fromAccessSpecifier(Modifier.getAccessSpecifier(n.getModifiers())), false
|
||||
);
|
||||
|
||||
|
||||
// test this!
|
||||
me.tomassetti.symbolsolver.model.declarations.MethodDeclaration overridden = getOverridden(n);
|
||||
com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration overridden = getOverridden(n);
|
||||
if (overridden != null && (overridden instanceof JavaParserMethodDeclaration))
|
||||
{
|
||||
String overriddenName = JavaparserDeclNameResolver.getQualifiedDeclName(((JavaParserMethodDeclaration)overridden).getWrappedNode(), m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.OVERRIDE, overriddenName, qualifiedName,
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column
|
||||
name.getRange()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -227,12 +251,12 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
m_context = parentContext;
|
||||
}
|
||||
|
||||
private me.tomassetti.symbolsolver.model.declarations.MethodDeclaration getOverridden(MethodDeclaration overrider)
|
||||
private com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration getOverridden(MethodDeclaration overrider)
|
||||
{
|
||||
com.github.javaparser.ast.body.TypeDeclaration<?> scopeNode = overrider.getParentNodeOfType(com.github.javaparser.ast.body.TypeDeclaration.class);
|
||||
com.github.javaparser.ast.body.TypeDeclaration<?> scopeNode = overrider.getAncestorOfType(com.github.javaparser.ast.body.TypeDeclaration.class);
|
||||
if (scopeNode instanceof ClassOrInterfaceDeclaration)
|
||||
{
|
||||
List<TypeUsage> parameterTypes = new ArrayList<>();
|
||||
List<com.github.javaparser.symbolsolver.model.typesystem.Type> parameterTypes = new ArrayList<>();
|
||||
try
|
||||
{
|
||||
for (Parameter parameter: overrider.getParameters())
|
||||
@@ -241,12 +265,18 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
parameterTypes.add(JavaParserFacade.get(m_typeSolver).convert(parameterType, parameterType));
|
||||
}
|
||||
|
||||
TypeDeclaration scopeDecl = JavaParserFacade.get(m_typeSolver).getTypeDeclaration((ClassOrInterfaceDeclaration)scopeNode);
|
||||
for (ReferenceTypeUsage ancestor: scopeDecl.getAllAncestors())
|
||||
ReferenceTypeDeclaration scopeDecl = JavaParserFacade.get(m_typeSolver).getTypeDeclaration((ClassOrInterfaceDeclaration)scopeNode);
|
||||
for (ReferenceType ancestor: scopeDecl.getAllAncestors())
|
||||
{
|
||||
try
|
||||
{
|
||||
SymbolReference<me.tomassetti.symbolsolver.model.declarations.MethodDeclaration> solvedMethod = ancestor.solveMethod(overrider.getName(), parameterTypes);
|
||||
SymbolReference<com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration> solvedMethod = MethodResolutionLogic.solveMethodInType(
|
||||
ancestor.getTypeDeclaration(),
|
||||
overrider.getNameAsString(),
|
||||
parameterTypes,
|
||||
m_typeSolver
|
||||
);
|
||||
|
||||
if (solvedMethod.isSolved())
|
||||
{
|
||||
return solvedMethod.getCorrespondingDeclaration();
|
||||
@@ -267,6 +297,14 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (ClassCastException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -276,16 +314,14 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
List<DeclContext> parentContext = m_context;
|
||||
m_context = new ArrayList<DeclContext>();
|
||||
|
||||
List<VariableDeclarator> variableDeclarators = n.getVariables();
|
||||
for (int i = 0; i < variableDeclarators.size(); i++)
|
||||
for (VariableDeclarator declarator: n.getVariables())
|
||||
{
|
||||
VariableDeclarator varDecl = variableDeclarators.get(i);
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(varDecl, m_typeSolver).toSerializedNameHierarchy();
|
||||
VariableDeclaratorId varDeclId = varDecl.getId();
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(declarator, m_typeSolver).toSerializedNameHierarchy();
|
||||
SimpleName name = declarator.getName();
|
||||
|
||||
JavaIndexer.recordSymbolWithLocation(
|
||||
m_callbackId, qualifiedName, SymbolType.FIELD,
|
||||
varDeclId.getBegin().line, varDeclId.getBegin().column, varDeclId.getEnd().line, varDeclId.getEnd().column,
|
||||
name.getRange(),
|
||||
AccessKind.fromAccessSpecifier(Modifier.getAccessSpecifier(n.getModifiers())), false
|
||||
);
|
||||
|
||||
@@ -298,16 +334,19 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final VariableDeclarationExpr n, final Void v)
|
||||
{
|
||||
for (VariableDeclarator declarator: n.getVars())
|
||||
for (VariableDeclarator declarator: n.getVariables())
|
||||
{
|
||||
VariableDeclaratorId identifier = declarator.getId();
|
||||
String qualifiedName = m_filePath + "<" + identifier.getBegin().line + ":" + identifier.getBegin().column + ">";
|
||||
|
||||
JavaIndexer.recordLocalSymbol(
|
||||
m_callbackId, qualifiedName,
|
||||
identifier.getBegin().line, identifier.getBegin().column, identifier.getEnd().line, identifier.getEnd().column
|
||||
);
|
||||
|
||||
SimpleName name = declarator.getName();
|
||||
|
||||
if (name.getBegin().isPresent())
|
||||
{
|
||||
String qualifiedName = m_filePath + "<" + name.getBegin().get().line + ":" + name.getBegin().get().column + ">";
|
||||
|
||||
JavaIndexer.recordLocalSymbol(
|
||||
m_callbackId, qualifiedName,
|
||||
name.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// don't change the context here.
|
||||
@@ -316,13 +355,17 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final Parameter n, final Void v)
|
||||
{
|
||||
VariableDeclaratorId identifier = n.getId();
|
||||
String qualifiedName = m_filePath + "<" + identifier.getBegin().line + ":" + identifier.getBegin().column + ">";
|
||||
SimpleName name = n.getName();
|
||||
|
||||
JavaIndexer.recordLocalSymbol(
|
||||
m_callbackId, qualifiedName,
|
||||
identifier.getBegin().line, identifier.getBegin().column, identifier.getEnd().line, identifier.getEnd().column
|
||||
);
|
||||
if (name.getBegin().isPresent())
|
||||
{
|
||||
String qualifiedName = m_filePath + "<" + name.getBegin().get().line + ":" + name.getBegin().get().column + ">";
|
||||
|
||||
JavaIndexer.recordLocalSymbol(
|
||||
m_callbackId, qualifiedName,
|
||||
name.getRange()
|
||||
);
|
||||
}
|
||||
|
||||
// don't change the context here.
|
||||
super.visit(n, v);
|
||||
@@ -332,99 +375,135 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
// --- record references ---
|
||||
|
||||
|
||||
@Override public void visit(final ImportDeclaration n, final Void v)
|
||||
@Override
|
||||
public void visit(SingleStaticImportDeclaration n, Void arg)
|
||||
{
|
||||
if (n.isAsterisk())
|
||||
try
|
||||
{
|
||||
NameExpr nameExpr = n.getName();
|
||||
String importedName = JavaparserDeclNameResolver.getQualifiedName(nameExpr).toSerializedNameHierarchy();
|
||||
ClassOrInterfaceType type = n.getType();
|
||||
List<JavaDeclName> importedDeclNames = new ArrayList<>();
|
||||
|
||||
com.github.javaparser.symbolsolver.model.typesystem.Type solvedType = JavaParserFacade.get(m_typeSolver).convert(type, type);
|
||||
|
||||
if (solvedType instanceof ReferenceType)
|
||||
{
|
||||
ReferenceTypeDeclaration solvedDecl = ((ReferenceType)solvedType).getTypeDeclaration();
|
||||
for (com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration methodDecl: solvedDecl.getDeclaredMethods()) // look for method
|
||||
{
|
||||
if (methodDecl.getName().equals(n.getStaticMember()))
|
||||
{
|
||||
importedDeclNames.add(
|
||||
JavaSymbolSolverDeclNameResolver.getQualifiedDeclName(methodDecl, m_typeSolver
|
||||
));
|
||||
}
|
||||
}
|
||||
if (importedDeclNames.isEmpty() && solvedDecl.hasField(n.getStaticMember())) // look for field
|
||||
{
|
||||
JavaDeclName importedTypeDeclName = JavaSymbolSolverDeclNameResolver.getQualifiedDeclName(solvedDecl, m_typeSolver);
|
||||
if (importedTypeDeclName != null)
|
||||
{
|
||||
JavaDeclName importedDeclName = new JavaDeclName(n.getStaticMember());
|
||||
importedDeclName.setParent(importedTypeDeclName);
|
||||
importedDeclNames.add(importedDeclName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!importedDeclNames.isEmpty())
|
||||
{
|
||||
for (JavaDeclName importedDeclName: importedDeclNames)
|
||||
{
|
||||
String nameHierarchy = importedDeclName.toSerializedNameHierarchy();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.IMPORT,
|
||||
nameHierarchy, context.getName(),
|
||||
n.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JavaIndexer.recordError(
|
||||
m_callbackId, "Import not found.", true, true,
|
||||
n.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
recordException(e, n);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(SingleTypeImportDeclaration n, Void arg)
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassOrInterfaceType type = n.getType();
|
||||
String importedName = JavaparserTypeNameResolver.getQualifiedTypeName(type, m_typeSolver).toSerializedNameHierarchy();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.IMPORT,
|
||||
importedName, context.getName(),
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column
|
||||
type.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
try
|
||||
{
|
||||
NameExpr nameExpr = n.getName();
|
||||
List<JavaDeclName> importedDeclNames = new ArrayList<>();
|
||||
recordException(e, n);
|
||||
}
|
||||
}
|
||||
|
||||
SymbolReference<TypeDeclaration> symbolReference = m_typeSolver.tryToSolveType(
|
||||
JavaparserDeclNameResolver.getQualifiedName(nameExpr).toString()
|
||||
);
|
||||
if (symbolReference.isSolved())
|
||||
{
|
||||
importedDeclNames.add(JavaSymbolSolverDeclNameResolver.getQualifiedDeclName(
|
||||
symbolReference.getCorrespondingDeclaration(), m_typeSolver
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nameExpr instanceof QualifiedNameExpr)
|
||||
{
|
||||
String typeName = ((QualifiedNameExpr)nameExpr).getQualifier().toString();
|
||||
String memberName = nameExpr.getName();
|
||||
|
||||
me.tomassetti.symbolsolver.model.declarations.TypeDeclaration ref = m_typeSolver.solveType(typeName);
|
||||
|
||||
for (me.tomassetti.symbolsolver.model.declarations.MethodDeclaration methodDecl: ref.getDeclaredMethods()) // look for method
|
||||
{
|
||||
if (methodDecl.getName().equals(memberName))
|
||||
{
|
||||
importedDeclNames.add(
|
||||
JavaSymbolSolverDeclNameResolver.getQualifiedDeclName(methodDecl, m_typeSolver
|
||||
));
|
||||
}
|
||||
}
|
||||
if (importedDeclNames.isEmpty() && ref.hasField(memberName)) // look for field
|
||||
{
|
||||
JavaDeclName importedTypeDeclName = JavaSymbolSolverDeclNameResolver.getQualifiedDeclName(ref, m_typeSolver);
|
||||
if (importedTypeDeclName != null)
|
||||
{
|
||||
JavaDeclName importedDeclName = new JavaDeclName(memberName);
|
||||
importedDeclName.setParent(importedTypeDeclName);
|
||||
importedDeclNames.add(importedDeclName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!importedDeclNames.isEmpty())
|
||||
{
|
||||
for (JavaDeclName importedDeclName: importedDeclNames)
|
||||
{
|
||||
String nameHierarchy = importedDeclName.toSerializedNameHierarchy();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.IMPORT,
|
||||
nameHierarchy, context.getName(),
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JavaIndexer.recordError(
|
||||
m_callbackId, "Import not found.", true, true,
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@Override
|
||||
public void visit(StaticImportOnDemandDeclaration n, Void arg)
|
||||
{
|
||||
try
|
||||
{
|
||||
ClassOrInterfaceType type = n.getType();
|
||||
String importedName = JavaparserTypeNameResolver.getQualifiedTypeName(type, m_typeSolver).toSerializedNameHierarchy();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
recordException(e, n);
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.IMPORT,
|
||||
importedName, context.getName(),
|
||||
type.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
super.visit(n, v);
|
||||
catch (Exception e)
|
||||
{
|
||||
recordException(e, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void visit(TypeImportOnDemandDeclaration n, Void arg)
|
||||
{
|
||||
try
|
||||
{
|
||||
Name name = n.getName();
|
||||
String importedName = JavaparserDeclNameResolver.getQualifiedName(name).toSerializedNameHierarchy();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.IMPORT,
|
||||
importedName, context.getName(),
|
||||
name.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
recordException(e, n);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void visit(final ClassOrInterfaceType n, final Void v)
|
||||
{
|
||||
try
|
||||
@@ -433,20 +512,30 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
String referencedName = JavaparserTypeNameResolver.getQualifiedTypeName(n, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
int beginLine = n.getBegin().line;
|
||||
int beginColumn = n.getBegin().column;
|
||||
int endLine = n.getBegin().line;
|
||||
int endColumn = n.getBegin().column + n.getName().length() - 1;
|
||||
Range range = Range.range(0, 0, 0, 0);
|
||||
|
||||
if (n.getScope() != null)
|
||||
if (n.getRange().isPresent())
|
||||
{
|
||||
endLine = n.getScope().getEnd().line;
|
||||
endColumn = n.getScope().getEnd().column + n.getName().length() + 1; // +1 for separator
|
||||
range = Range.range(
|
||||
n.getRange().get().begin.line,
|
||||
n.getRange().get().begin.column,
|
||||
n.getRange().get().begin.line,
|
||||
n.getRange().get().begin.column + n.getNameAsString().length() - 1
|
||||
);
|
||||
}
|
||||
|
||||
Optional<ClassOrInterfaceType> scope = n.getScope();
|
||||
if (scope.isPresent() && scope.get().getEnd().isPresent())
|
||||
{
|
||||
range = range.withEnd(
|
||||
Position.pos(scope.get().getEnd().get().line,
|
||||
scope.get().getEnd().get().column + n.getNameAsString().length() + 1 // +1 for separator
|
||||
));
|
||||
}
|
||||
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, getTypeReferenceKind(), referencedName, context.getName(),
|
||||
beginLine, beginColumn, endLine, endColumn
|
||||
range
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -472,7 +561,7 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, getTypeReferenceKind(), referencedName, context.getName(),
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column
|
||||
n.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -499,7 +588,7 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, getTypeReferenceKind(), referencedName, context.getName(),
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column
|
||||
n.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -511,6 +600,50 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
super.visit(n, v);
|
||||
}
|
||||
|
||||
@Override public void visit(final FieldAccessExpr n, final Void v)
|
||||
{
|
||||
SimpleName fieldName = n.getField();
|
||||
|
||||
try
|
||||
{
|
||||
SymbolReference<? extends ValueDeclaration> ref = JavaParserFacade.get(m_typeSolver).solve(fieldName);
|
||||
if (ref.isSolved())
|
||||
{
|
||||
ValueDeclaration valueDecl = ref.getCorrespondingDeclaration();
|
||||
|
||||
Node wrappedNode = null;
|
||||
if (valueDecl instanceof JavaParserFieldDeclaration)
|
||||
{
|
||||
wrappedNode = ((JavaParserFieldDeclaration)valueDecl).getWrappedNode();
|
||||
}
|
||||
if (wrappedNode != null && wrappedNode instanceof FieldDeclaration)
|
||||
{
|
||||
|
||||
for (VariableDeclarator var: ((FieldDeclaration)wrappedNode).getVariables())
|
||||
{
|
||||
if (var.getName().getIdentifier().equals(fieldName.getIdentifier()))
|
||||
{
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(var, m_typeSolver).toSerializedNameHierarchy();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.USAGE, qualifiedName, context.getName(),
|
||||
fieldName.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
recordException(e, n);
|
||||
}
|
||||
|
||||
super.visit(n, v);
|
||||
}
|
||||
|
||||
@Override public void visit(final NameExpr n, final Void v)
|
||||
{
|
||||
try
|
||||
@@ -531,47 +664,56 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
if (ref.isSolved())
|
||||
{
|
||||
ValueDeclaration valueDecl = ref.getCorrespondingDeclaration();
|
||||
|
||||
Node wrappedNode = null;
|
||||
if (valueDecl instanceof JavaParserSymbolDeclaration)
|
||||
{
|
||||
Node wrappedNode = null;
|
||||
if (valueDecl instanceof JavaParserSymbolDeclaration)
|
||||
wrappedNode = ((JavaParserSymbolDeclaration)valueDecl).getWrappedNode();
|
||||
}
|
||||
else if (valueDecl instanceof JavaParserParameterDeclaration)
|
||||
{
|
||||
wrappedNode = ((JavaParserParameterDeclaration)valueDecl).getWrappedNode();
|
||||
}
|
||||
|
||||
if (wrappedNode != null)
|
||||
{
|
||||
if (wrappedNode instanceof Parameter)
|
||||
{
|
||||
wrappedNode = ((JavaParserSymbolDeclaration)valueDecl).getWrappedNode();
|
||||
}
|
||||
if (wrappedNode != null)
|
||||
{
|
||||
if (wrappedNode instanceof Parameter)
|
||||
SimpleName name = ((Parameter)wrappedNode).getName();
|
||||
if (name.getBegin().isPresent())
|
||||
{
|
||||
VariableDeclaratorId identifier = ((Parameter)wrappedNode).getId();
|
||||
String qualifiedName = m_filePath + "<" + identifier.getBegin().line + ":" + identifier.getBegin().column + ">";
|
||||
String qualifiedName = m_filePath + "<" + name.getBegin().get().line + ":" + name.getBegin().get().column + ">";
|
||||
|
||||
JavaIndexer.recordLocalSymbol(
|
||||
m_callbackId, qualifiedName,
|
||||
e.getBegin().line, e.getBegin().column, e.getEnd().line, e.getEnd().column
|
||||
e.getRange()
|
||||
);
|
||||
}
|
||||
else if (wrappedNode instanceof VariableDeclarator)
|
||||
}
|
||||
else if (wrappedNode instanceof VariableDeclarator)
|
||||
{
|
||||
if (wrappedNode.getAncestorOfType(FieldDeclaration.class) != null)
|
||||
{
|
||||
if (getFieldDeclarationInParentHierarchy(wrappedNode) != null)
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName((VariableDeclarator)wrappedNode, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
String qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName((VariableDeclarator)wrappedNode, m_typeSolver).toSerializedNameHierarchy();
|
||||
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.USAGE, qualifiedName, context.getName(),
|
||||
e.getBegin().line, e.getBegin().column, e.getEnd().line, e.getEnd().column
|
||||
);
|
||||
}
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.USAGE, qualifiedName, context.getName(),
|
||||
e.getRange()
|
||||
);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
SimpleName name = ((VariableDeclarator)wrappedNode).getName();
|
||||
if (name.getBegin().isPresent())
|
||||
{
|
||||
VariableDeclaratorId identifier = ((VariableDeclarator)wrappedNode).getId();
|
||||
String qualifiedName = m_filePath + "<" + identifier.getBegin().line + ":" + identifier.getBegin().column + ">";
|
||||
String qualifiedName = m_filePath + "<" + name.getBegin().get().line + ":" + name.getBegin().get().column + ">";
|
||||
|
||||
JavaIndexer.recordLocalSymbol(
|
||||
m_callbackId, qualifiedName,
|
||||
e.getBegin().line, e.getBegin().column, e.getEnd().line, e.getEnd().column
|
||||
e.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -579,24 +721,6 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static FieldDeclaration getFieldDeclarationInParentHierarchy(Node decl)
|
||||
{
|
||||
FieldDeclaration context = null;
|
||||
{
|
||||
Node parentNode = decl.getParentNode();
|
||||
while (parentNode != null && !(parentNode instanceof FieldDeclaration))
|
||||
{
|
||||
parentNode = parentNode.getParentNode();
|
||||
}
|
||||
|
||||
if (parentNode != null)
|
||||
{
|
||||
context = (FieldDeclaration)parentNode;
|
||||
}
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override public void visit(final MethodCallExpr n, final Void v)
|
||||
{
|
||||
@@ -605,8 +729,15 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
try
|
||||
{
|
||||
MethodUsage solvedMethod = JavaParserFacade.get(m_typeSolver).solveMethodAsUsage(n);
|
||||
qualifiedName = getQualifiedName(solvedMethod);
|
||||
SymbolReference<com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration> solvedMethod = JavaParserFacade.get(m_typeSolver).solve(n);
|
||||
if (solvedMethod.isSolved())
|
||||
{
|
||||
qualifiedName = getQualifiedName(solvedMethod.getCorrespondingDeclaration());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsolvedSymbolException(n.getNameAsString());
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException e)
|
||||
{
|
||||
@@ -628,12 +759,12 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
if (!qualifiedName.isEmpty())
|
||||
{
|
||||
NameExpr nameExpr = n.getNameExpr();
|
||||
SimpleName name = n.getName();
|
||||
for (DeclContext context: m_context)
|
||||
{
|
||||
JavaIndexer.recordReference(
|
||||
m_callbackId, ReferenceKind.CALL, qualifiedName, context.getName(),
|
||||
nameExpr.getBegin().line, nameExpr.getBegin().column, nameExpr.getEnd().line, nameExpr.getEnd().column
|
||||
name.getRange()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -644,20 +775,29 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
private void recordException(Exception e, Node n)
|
||||
{
|
||||
JavaIndexer.logError(m_callbackId, e.getClass() + " at " + m_filePath + "<"+ n.getBegin().line + ", " + n.getBegin().column + ">");
|
||||
JavaIndexer.recordSymbolWithLocation(
|
||||
m_callbackId, "unsolved-symbol\ts\tp", SymbolType.TYPE_MAX,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
AccessKind.DEFAULT, false
|
||||
);
|
||||
recordExceptionOrError(e.getClass().getSimpleName(), n);
|
||||
}
|
||||
|
||||
private void recordError(Error e, Node n)
|
||||
{
|
||||
JavaIndexer.logError(m_callbackId, e.getClass() + " at " + m_filePath + "<"+ n.getBegin().line + ", " + n.getBegin().column + ">");
|
||||
recordExceptionOrError(e.getClass().getSimpleName(), n);
|
||||
}
|
||||
|
||||
private void recordExceptionOrError(String e, Node n)
|
||||
{
|
||||
String beginLine = "?";
|
||||
String beginColumn = "?";
|
||||
|
||||
if (n.getBegin().isPresent())
|
||||
{
|
||||
beginLine = n.getBegin().get().line + "";
|
||||
beginColumn = n.getBegin().get().column + "";
|
||||
}
|
||||
|
||||
JavaIndexer.logError(m_callbackId, e + " at " + m_filePath + "<"+ beginLine + ", " + beginColumn + ">");
|
||||
JavaIndexer.recordSymbolWithLocation(
|
||||
m_callbackId, "unsolved-symbol\ts\tp", SymbolType.TYPE_MAX,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column,
|
||||
n.getRange(),
|
||||
AccessKind.DEFAULT, false
|
||||
);
|
||||
}
|
||||
@@ -740,13 +880,12 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
super.visit(n, v);
|
||||
}
|
||||
*/
|
||||
private String getQualifiedName(MethodUsage solvedMethod)
|
||||
private String getQualifiedName(com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration solvedMethod)
|
||||
{
|
||||
me.tomassetti.symbolsolver.model.declarations.MethodDeclaration methodDecl = solvedMethod.getDeclaration();
|
||||
String qualifiedName = "";
|
||||
if (methodDecl instanceof JavaParserMethodDeclaration)
|
||||
if (solvedMethod instanceof JavaParserMethodDeclaration)
|
||||
{
|
||||
MethodDeclaration wrappedNode = ((JavaParserMethodDeclaration)methodDecl).getWrappedNode();
|
||||
MethodDeclaration wrappedNode = ((JavaParserMethodDeclaration)solvedMethod).getWrappedNode();
|
||||
qualifiedName = JavaparserDeclNameResolver.getQualifiedDeclName(wrappedNode, m_typeSolver).toSerializedNameHierarchy();
|
||||
}
|
||||
else // todo: move this implementation somewhere else
|
||||
@@ -756,18 +895,18 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
qualifiedName += "\ts\tp\tn" + solvedMethod.getName() + "\ts";
|
||||
|
||||
String returnType = solvedMethod.returnType().describe();
|
||||
String returnType = solvedMethod.getReturnType().describe();
|
||||
qualifiedName += returnType;
|
||||
// qualifiedName += returnType.substring(returnType.lastIndexOf(".") + 1);
|
||||
|
||||
qualifiedName += "\tp(";
|
||||
for (int i = 0; i < solvedMethod.getParamTypes().size(); i++)
|
||||
for (int i = 0; i < solvedMethod.getNumberOfParams(); i++)
|
||||
{
|
||||
if(i != 0)
|
||||
{
|
||||
qualifiedName += (", ");
|
||||
}
|
||||
String paramType = solvedMethod.getParamTypes().get(i).describe();
|
||||
String paramType = solvedMethod.getParam(i).describeType();
|
||||
qualifiedName += paramType;
|
||||
// qualifiedName += paramType.substring(paramType.lastIndexOf(".") + 1);
|
||||
}
|
||||
@@ -778,35 +917,46 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
|
||||
@Override public void visit(final BlockStmt n, final Void v)
|
||||
{
|
||||
recordScope(n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column);
|
||||
recordScope(n.getRange());
|
||||
super.visit(n, v);
|
||||
}
|
||||
|
||||
@Override public void visit(final ArrayInitializerExpr n, final Void v)
|
||||
{
|
||||
recordScope(n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column);
|
||||
recordScope(n.getRange());
|
||||
super.visit(n, v);
|
||||
}
|
||||
|
||||
@Override public void visit(final SwitchStmt n, final Void v)
|
||||
{
|
||||
FileContent.Location scopeStartLocation = m_fileContent.find("{", n.getBegin().line, n.getBegin().column);
|
||||
recordScope(scopeStartLocation.line, scopeStartLocation.column, n.getEnd().line, n.getEnd().column);
|
||||
if (n.getRange().isPresent())
|
||||
{
|
||||
FileContent.Location scopeStartLocation = m_fileContent.find("{", n.getBegin());
|
||||
recordScope(Range.range(scopeStartLocation.line, scopeStartLocation.column, n.getRange().get().end.line, n.getRange().get().end.column));
|
||||
}
|
||||
super.visit(n, v);
|
||||
}
|
||||
|
||||
private void recordScope(int beginLine, int beginColumn, int endLine, int endColumn)
|
||||
private void recordScope(Optional<Range> range)
|
||||
{
|
||||
String qualifiedName = m_filePath + "<" + beginLine + ":" + beginColumn + ">";
|
||||
JavaIndexer.recordLocalSymbol(m_callbackId, qualifiedName, beginLine, beginColumn, beginLine, beginColumn);
|
||||
JavaIndexer.recordLocalSymbol(m_callbackId, qualifiedName, endLine, endColumn, endLine, endColumn);
|
||||
if (range.isPresent())
|
||||
{
|
||||
recordScope(range.get());
|
||||
}
|
||||
}
|
||||
|
||||
private void recordScope(Range range)
|
||||
{
|
||||
String qualifiedName = m_filePath + "<" + range.begin.line + ":" + range.begin.column + ">";
|
||||
JavaIndexer.recordLocalSymbol(m_callbackId, qualifiedName, range.begin.line, range.begin.column, range.begin.line, range.begin.column);
|
||||
JavaIndexer.recordLocalSymbol(m_callbackId, qualifiedName, range.end.line, range.end.column, range.end.line, range.end.column);
|
||||
}
|
||||
|
||||
@Override public void visit(final LineComment n, final Void v)
|
||||
{
|
||||
JavaIndexer.recordComment(
|
||||
m_callbackId,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column
|
||||
n.getRange()
|
||||
);
|
||||
super.visit(n, v);
|
||||
}
|
||||
@@ -815,7 +965,7 @@ public class JavaAstVisitor extends JavaAstVisitorAdapter
|
||||
{
|
||||
JavaIndexer.recordComment(
|
||||
m_callbackId,
|
||||
n.getBegin().line, n.getBegin().column, n.getEnd().line, n.getEnd().column
|
||||
n.getRange()
|
||||
);
|
||||
super.visit(n, v);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,19 +4,20 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.lang.String;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.github.javaparser.ast.CompilationUnit;
|
||||
import com.github.javaparser.ast.PackageDeclaration;
|
||||
import com.github.javaparser.JavaParser;
|
||||
import com.github.javaparser.ParseProblemException;
|
||||
import com.github.javaparser.Problem;
|
||||
|
||||
import me.tomassetti.symbolsolver.javaparser.Navigator;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import me.tomassetti.symbolsolver.resolution.typesolvers.CombinedTypeSolver;
|
||||
import me.tomassetti.symbolsolver.resolution.typesolvers.JarTypeSolver;
|
||||
import me.tomassetti.symbolsolver.resolution.typesolvers.JavaParserTypeSolver;
|
||||
import me.tomassetti.symbolsolver.resolution.typesolvers.JreTypeSolver;
|
||||
import com.github.javaparser.Range;
|
||||
import com.github.javaparser.symbolsolver.javaparser.Navigator;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver;
|
||||
import com.github.javaparser.symbolsolver.resolution.typesolvers.JarTypeSolver;
|
||||
import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver;
|
||||
import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver;
|
||||
|
||||
public class JavaIndexer
|
||||
{
|
||||
@@ -28,7 +29,7 @@ public class JavaIndexer
|
||||
{
|
||||
CombinedTypeSolver typeSolver = new CombinedTypeSolver();
|
||||
|
||||
typeSolver.add(new JreTypeSolver());
|
||||
typeSolver.add(new ReflectionTypeSolver());
|
||||
for (String path: classPath.split("\\;"))
|
||||
{
|
||||
if (path.endsWith(".jar"))
|
||||
@@ -49,7 +50,7 @@ public class JavaIndexer
|
||||
typeSolver.add(solver);
|
||||
}
|
||||
}
|
||||
CompilationUnit cu = JavaParser.parse(new StringReader(fileContent), true);
|
||||
CompilationUnit cu = JavaParser.parse(new StringReader(fileContent));
|
||||
|
||||
JavaAstVisitor astVisitor = (
|
||||
verbose == 1 ?
|
||||
@@ -61,33 +62,36 @@ public class JavaIndexer
|
||||
}
|
||||
catch (ParseProblemException e)
|
||||
{
|
||||
for (Problem problem: e.problems)
|
||||
for (Problem problem: e.getProblems())
|
||||
{
|
||||
if (problem.message.startsWith("Encountered unexpected token"))
|
||||
String message = problem.getMessage();
|
||||
if (message.startsWith("Encountered unexpected token"))
|
||||
{
|
||||
int startLine = Integer.parseInt(problem.message.substring(
|
||||
problem.message.indexOf("line ") + ("line ").length(),
|
||||
problem.message.indexOf(",")
|
||||
int startLine = Integer.parseInt(message.substring(
|
||||
message.indexOf("line ") + ("line ").length(),
|
||||
message.indexOf(",")
|
||||
));
|
||||
|
||||
int startColumn = Integer.parseInt(problem.message.substring(
|
||||
problem.message.indexOf("column ") + ("column ").length(),
|
||||
problem.message.indexOf(".")
|
||||
int startColumn = Integer.parseInt(message.substring(
|
||||
message.indexOf("column ") + ("column ").length(),
|
||||
message.indexOf(".")
|
||||
));
|
||||
|
||||
recordError(
|
||||
address, "Encountered unexpected token.", true, true,
|
||||
startLine, startColumn,
|
||||
startLine, startColumn
|
||||
Range.range(startLine, startColumn, startLine, startColumn)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
recordError(
|
||||
address, problem.toString(), true, true,
|
||||
problem.range.begin.line, problem.range.begin.column,
|
||||
problem.range.end.line, problem.range.end.column
|
||||
);
|
||||
{
|
||||
Optional<Range> range = problem.getRange();
|
||||
if (range.isPresent())
|
||||
{
|
||||
recordError(
|
||||
address, problem.toString(), true, true,
|
||||
range.get()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +104,7 @@ public class JavaIndexer
|
||||
String packageName = "";
|
||||
try
|
||||
{
|
||||
CompilationUnit cu = JavaParser.parse(new StringReader(fileContent), true);
|
||||
CompilationUnit cu = JavaParser.parse(new StringReader(fileContent));
|
||||
PackageDeclaration pd = Navigator.findNodeOfGivenClass(cu, PackageDeclaration.class);
|
||||
if (pd != null)
|
||||
{
|
||||
@@ -134,50 +138,139 @@ public class JavaIndexer
|
||||
|
||||
static public void recordSymbolWithLocation(
|
||||
int address, String symbolName, SymbolType symbolType,
|
||||
int beginLine, int beginColumn, int endLine, int endColumn,
|
||||
Optional<Range> range,
|
||||
AccessKind access, boolean isImplicit
|
||||
)
|
||||
{
|
||||
recordSymbolWithLocation(
|
||||
address, symbolName, symbolType,
|
||||
range.orElse(Range.range(0, 0, 0, 0)),
|
||||
access, isImplicit
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordSymbolWithLocation(
|
||||
int address, String symbolName, SymbolType symbolType,
|
||||
Range range,
|
||||
AccessKind access, boolean isImplicit
|
||||
)
|
||||
{
|
||||
recordSymbolWithLocation(
|
||||
address, symbolName, symbolType.getValue(),
|
||||
beginLine, beginColumn, endLine, endColumn,
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column,
|
||||
access.getValue(), (isImplicit ? 1 : 0)
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordSymbolWithLocationAndScope(
|
||||
int address, String symbolName, SymbolType symbolType,
|
||||
int beginLine, int beginColumn, int endLine, int endColumn,
|
||||
int scopeBeginLine, int scopeBeginColumn, int scopeEndLine, int scopeEndColumn,
|
||||
Optional<Range> range,
|
||||
Optional<Range> scopeRange,
|
||||
AccessKind access, boolean isImplicit
|
||||
)
|
||||
{
|
||||
recordSymbolWithLocationAndScope(
|
||||
address, symbolName, symbolType,
|
||||
range.orElse(Range.range(0, 0, 0, 0)),
|
||||
scopeRange.orElse(Range.range(0, 0, 0, 0)),
|
||||
access, isImplicit
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordSymbolWithLocationAndScope(
|
||||
int address, String symbolName, SymbolType symbolType,
|
||||
Range range,
|
||||
Range scopeRange,
|
||||
AccessKind access, boolean isImplicit
|
||||
)
|
||||
{
|
||||
recordSymbolWithLocationAndScope(
|
||||
address, symbolName, symbolType.getValue(),
|
||||
beginLine, beginColumn, endLine, endColumn,
|
||||
scopeBeginLine, scopeBeginColumn, scopeEndLine, scopeEndColumn,
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column,
|
||||
scopeRange.begin.line, scopeRange.begin.column, scopeRange.end.line, scopeRange.end.column,
|
||||
access.getValue(), (isImplicit ? 1 : 0)
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordReference(
|
||||
int address, ReferenceKind referenceKind, String referencedName, String contextName,
|
||||
int beginLine, int beginColumn, int endLine, int endColumn
|
||||
Optional<Range> range
|
||||
)
|
||||
{
|
||||
recordReference(
|
||||
address, referenceKind, referencedName, contextName,
|
||||
range.orElse(Range.range(0, 0, 0, 0))
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordReference(
|
||||
int address, ReferenceKind referenceKind, String referencedName, String contextName,
|
||||
Range range
|
||||
)
|
||||
{
|
||||
recordReference(
|
||||
address, referenceKind.getValue(), referencedName, contextName,
|
||||
beginLine, beginColumn, endLine, endColumn
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordLocalSymbol(
|
||||
int address, String symbolName,
|
||||
Optional<Range> range
|
||||
)
|
||||
{
|
||||
recordLocalSymbol(address, symbolName, range.orElse(Range.range(0, 0, 0, 0)));
|
||||
}
|
||||
|
||||
static public void recordLocalSymbol(
|
||||
int address, String symbolName,
|
||||
Range range
|
||||
)
|
||||
{
|
||||
recordLocalSymbol(
|
||||
address, symbolName,
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordComment(
|
||||
int address,
|
||||
Optional<Range> range
|
||||
)
|
||||
{
|
||||
recordComment(address, range.orElse(Range.range(0, 0, 0, 0)));
|
||||
}
|
||||
|
||||
static public void recordComment(
|
||||
int address,
|
||||
Range range
|
||||
)
|
||||
{
|
||||
recordComment(
|
||||
address,
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordError(
|
||||
int address, String message, boolean fatal, boolean indexed, int beginLine, int beginColumn, int endLine, int endColumn
|
||||
int address, String message, boolean fatal, boolean indexed,
|
||||
Optional<Range> range
|
||||
)
|
||||
{
|
||||
recordError(
|
||||
address, message, fatal, indexed,
|
||||
range.orElse(Range.range(0, 0, 0, 0))
|
||||
);
|
||||
}
|
||||
|
||||
static public void recordError(
|
||||
int address, String message, boolean fatal, boolean indexed,
|
||||
Range range
|
||||
)
|
||||
{
|
||||
recordError(
|
||||
address, message, (fatal ? 1 : 0), (indexed ? 1 : 0),
|
||||
beginLine, beginColumn, endLine, endColumn
|
||||
range.begin.line, range.begin.column, range.end.line, range.end.column
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
|
||||
public abstract class JavaNameResolver
|
||||
{
|
||||
|
||||
@@ -5,17 +5,15 @@ import java.util.List;
|
||||
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
||||
import com.github.javaparser.ast.body.Parameter;
|
||||
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserInterfaceDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.Declaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.MethodDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.ParameterDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.TypeDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeParameter;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserInterfaceDeclaration;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.Declaration;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.MethodDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.TypeDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.TypeParameterDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
|
||||
public class JavaSymbolSolverDeclNameResolver extends JavaNameResolver
|
||||
{
|
||||
@@ -81,7 +79,7 @@ public class JavaSymbolSolverDeclNameResolver extends JavaNameResolver
|
||||
// TODO: what about endless recursion regarding type parameters and return type??
|
||||
|
||||
List<JavaTypeName> parameterNames = new ArrayList<>();
|
||||
for (int i = 0; i < methodDecl.getNoParams(); i++)
|
||||
for (int i = 0; i < methodDecl.getNumberOfParams(); i++)
|
||||
{
|
||||
parameterNames.add(JavaSymbolSolverTypeNameResolver.getQualifiedTypeName(
|
||||
methodDecl.getParam(i).getType(), m_typeSolver, m_ignoredContexts
|
||||
@@ -105,7 +103,7 @@ public class JavaSymbolSolverDeclNameResolver extends JavaNameResolver
|
||||
return declName;
|
||||
}
|
||||
|
||||
private static List<String> getTypeParameterNames(List<TypeParameter> typeParameters)
|
||||
private static List<String> getTypeParameterNames(List<TypeParameterDeclaration> typeParameters)
|
||||
{
|
||||
List<String> typeParameterNames = new ArrayList<>();
|
||||
if (typeParameters != null && typeParameters.size() > 0)
|
||||
|
||||
@@ -1,40 +1,23 @@
|
||||
package io.coati;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
||||
import com.github.javaparser.ast.type.ClassOrInterfaceType;
|
||||
import com.github.javaparser.ast.type.IntersectionType;
|
||||
import com.github.javaparser.ast.type.PrimitiveType;
|
||||
import com.github.javaparser.ast.type.ReferenceType;
|
||||
import com.github.javaparser.ast.type.Type;
|
||||
import com.github.javaparser.ast.type.UnionType;
|
||||
import com.github.javaparser.ast.type.UnknownType;
|
||||
import com.github.javaparser.ast.type.VoidType;
|
||||
import com.github.javaparser.ast.type.WildcardType;
|
||||
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.LambdaArgumentTypeUsagePlaceholder;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserInterfaceDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserTypeParameter;
|
||||
import me.tomassetti.symbolsolver.model.declarations.Declaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.MethodDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.declarations.TypeDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeParameter;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.ArrayTypeUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.NullTypeUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.PrimitiveTypeUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.ReferenceTypeUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.TypeParameterUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.TypeUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.VoidTypeUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.WildcardUsage;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.LambdaArgumentTypePlaceholder;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserTypeParameter;
|
||||
import com.github.javaparser.symbolsolver.logic.InferenceVariableType;
|
||||
import com.github.javaparser.symbolsolver.model.declarations.TypeParameterDeclaration;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.ArrayType;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.NullType;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.PrimitiveType;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.ReferenceType;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.Type;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.TypeVariable;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.VoidType;
|
||||
import com.github.javaparser.symbolsolver.model.typesystem.Wildcard;
|
||||
|
||||
public class JavaSymbolSolverTypeNameResolver extends JavaNameResolver
|
||||
{
|
||||
@@ -43,38 +26,42 @@ public class JavaSymbolSolverTypeNameResolver extends JavaNameResolver
|
||||
super(typeSolver, ignoredContexts);
|
||||
}
|
||||
|
||||
public static JavaTypeName getQualifiedTypeName(TypeUsage typeUsage, TypeSolver typeSolver)
|
||||
public static JavaTypeName getQualifiedTypeName(Type type, TypeSolver typeSolver)
|
||||
{
|
||||
return getQualifiedTypeName(typeUsage, typeSolver, null);
|
||||
return getQualifiedTypeName(type, typeSolver, null);
|
||||
}
|
||||
|
||||
public static JavaTypeName getQualifiedTypeName(TypeUsage typeUsage, TypeSolver typeSolver, ArrayList<BodyDeclaration> ignoredContexts)
|
||||
public static JavaTypeName getQualifiedTypeName(Type type, TypeSolver typeSolver, ArrayList<BodyDeclaration> ignoredContexts)
|
||||
{
|
||||
JavaSymbolSolverTypeNameResolver resolver = new JavaSymbolSolverTypeNameResolver(typeSolver, ignoredContexts);
|
||||
return resolver.getQualifiedTypeName(typeUsage);
|
||||
return resolver.getQualifiedTypeName(type);
|
||||
}
|
||||
|
||||
public JavaTypeName getQualifiedTypeName(TypeUsage typeUsage)
|
||||
{
|
||||
if (typeUsage instanceof ArrayTypeUsage)
|
||||
public JavaTypeName getQualifiedTypeName(Type type)
|
||||
{ // , inferencevariabletype, , , , , typevar,
|
||||
if (type instanceof ArrayType)
|
||||
{
|
||||
return getQualifiedTypeName(((ArrayTypeUsage)typeUsage).getComponentType());
|
||||
return getQualifiedTypeName(((ArrayType)type).getComponentType());
|
||||
}
|
||||
else if (typeUsage instanceof LambdaArgumentTypeUsagePlaceholder)
|
||||
else if (type instanceof LambdaArgumentTypePlaceholder)
|
||||
{
|
||||
|
||||
}
|
||||
else if (typeUsage instanceof NullTypeUsage)
|
||||
else if (type instanceof InferenceVariableType)
|
||||
{
|
||||
return JavaTypeName.fromDotSeparatedString(typeUsage.describe());
|
||||
|
||||
}
|
||||
else if (typeUsage instanceof PrimitiveTypeUsage)
|
||||
else if (type instanceof NullType)
|
||||
{
|
||||
return JavaTypeName.fromDotSeparatedString(typeUsage.describe());
|
||||
return JavaTypeName.fromDotSeparatedString(type.describe());
|
||||
}
|
||||
else if (typeUsage instanceof ReferenceTypeUsage)
|
||||
else if (type instanceof PrimitiveType)
|
||||
{
|
||||
ReferenceTypeUsage refTypeUsage = (ReferenceTypeUsage)typeUsage;
|
||||
return JavaTypeName.fromDotSeparatedString(type.describe());
|
||||
}
|
||||
else if (type instanceof ReferenceType)
|
||||
{
|
||||
ReferenceType refTypeUsage = (ReferenceType)type;
|
||||
|
||||
JavaDeclName declName = JavaSymbolSolverDeclNameResolver.getQualifiedDeclName(
|
||||
refTypeUsage.getTypeDeclaration(),
|
||||
@@ -96,13 +83,13 @@ public class JavaSymbolSolverTypeNameResolver extends JavaNameResolver
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (typeUsage instanceof TypeParameterUsage)
|
||||
else if (type instanceof TypeVariable)
|
||||
{
|
||||
TypeParameter typeParam = ((TypeParameterUsage)typeUsage).asTypeParameter();
|
||||
TypeParameterDeclaration typeParam = ((TypeVariable)type).asTypeParameter();
|
||||
if (typeParam instanceof JavaParserTypeParameter)
|
||||
{
|
||||
com.github.javaparser.ast.TypeParameter jpTypeParameter = ((JavaParserTypeParameter)typeParam).getWrappedNode();
|
||||
Node genericDecl = jpTypeParameter.getParentNode();
|
||||
com.github.javaparser.ast.type.TypeParameter jpTypeParameter = ((JavaParserTypeParameter)typeParam).getWrappedNode();
|
||||
BodyDeclaration<?> genericDecl = jpTypeParameter.getAncestorOfType(BodyDeclaration.class);
|
||||
if (genericDecl instanceof BodyDeclaration)
|
||||
{
|
||||
JavaDeclName genericName = null;
|
||||
@@ -110,7 +97,7 @@ public class JavaSymbolSolverTypeNameResolver extends JavaNameResolver
|
||||
{
|
||||
genericName = JavaparserDeclNameResolver.getQualifiedDeclName((BodyDeclaration)genericDecl, m_typeSolver, m_ignoredContexts);
|
||||
}
|
||||
return new JavaTypeName(jpTypeParameter.getName(), genericName);
|
||||
return new JavaTypeName(jpTypeParameter.getName().getId(), genericName);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -118,16 +105,16 @@ public class JavaSymbolSolverTypeNameResolver extends JavaNameResolver
|
||||
// do we need to handle using type parameters of external code? YES! so: TODO: do this!
|
||||
}
|
||||
}
|
||||
else if (typeUsage instanceof VoidTypeUsage)
|
||||
else if (type instanceof VoidType)
|
||||
{
|
||||
return JavaTypeName.fromDotSeparatedString(typeUsage.describe());
|
||||
return JavaTypeName.fromDotSeparatedString(type.describe());
|
||||
}
|
||||
else if (typeUsage instanceof WildcardUsage)
|
||||
else if (type instanceof Wildcard)
|
||||
{
|
||||
return new JavaTypeName("?", null);
|
||||
}
|
||||
|
||||
System.out.println("Unable to resolve qualified name of " + typeUsage.getClass().toString() + ": " + typeUsage.toString());
|
||||
System.out.println("Unable to resolve qualified name of " + type.getClass().toString() + ": " + type.toString());
|
||||
return new JavaTypeName("unresolved-type", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import com.github.javaparser.ast.*;
|
||||
import com.github.javaparser.ast.body.*;
|
||||
import com.github.javaparser.ast.comments.*;
|
||||
import com.github.javaparser.ast.expr.*;
|
||||
import com.github.javaparser.ast.imports.*;
|
||||
import com.github.javaparser.ast.nodeTypes.NodeWithName;
|
||||
import com.github.javaparser.ast.stmt.*;
|
||||
import com.github.javaparser.ast.type.*;
|
||||
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
|
||||
public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
@@ -44,9 +44,13 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
line += n.getClass().getName();
|
||||
if (n instanceof NodeWithName<?>)
|
||||
{
|
||||
line += " [" + obfuscate(((NodeWithName<?>)n).getName()) + "]";
|
||||
line += " [" + obfuscate(((NodeWithName<?>)n).getNameAsString()) + "]";
|
||||
}
|
||||
|
||||
if (n.getBegin().isPresent())
|
||||
{
|
||||
line += " line: " + n.getBegin().get().line;
|
||||
}
|
||||
line += " line: " + n.getBegin().line;
|
||||
|
||||
JavaIndexer.logInfo(m_callbackId, line);
|
||||
}
|
||||
@@ -57,8 +61,16 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
public void visit(PackageDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(ImportDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
public void visit(BadImportDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(SingleStaticImportDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(SingleTypeImportDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(StaticImportOnDemandDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(TypeImportOnDemandDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(TypeParameter n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(LineComment n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
@@ -71,8 +83,6 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
public void visit(EnumDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(EmptyTypeDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(EnumConstantDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(AnnotationDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
@@ -83,8 +93,6 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
public void visit(VariableDeclarator n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(VariableDeclaratorId n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(ConstructorDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(MethodDeclaration n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
@@ -103,7 +111,9 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
public void visit(PrimitiveType n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(ReferenceType n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
public void visit(ArrayType n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(ArrayCreationLevel n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(IntersectionType n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
@@ -145,10 +155,6 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
public void visit(LongLiteralExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(IntegerLiteralMinValueExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(LongLiteralMinValueExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(CharLiteralExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(DoubleLiteralExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
@@ -163,8 +169,6 @@ public class JavaVerboseAstVisitor extends JavaAstVisitor{
|
||||
|
||||
public void visit(ObjectCreationExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(QualifiedNameExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(ThisExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
public void visit(SuperExpr n, Void v) { dump(n); indent++; super.visit(n, v); indent--; }
|
||||
|
||||
@@ -2,11 +2,12 @@ package io.coati;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.github.javaparser.ast.CompilationUnit;
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.NodeList;
|
||||
import com.github.javaparser.ast.PackageDeclaration;
|
||||
import com.github.javaparser.ast.TypeParameter;
|
||||
import com.github.javaparser.ast.body.AnnotationMemberDeclaration;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
|
||||
@@ -19,12 +20,9 @@ import com.github.javaparser.ast.body.MethodDeclaration;
|
||||
import com.github.javaparser.ast.body.Parameter;
|
||||
import com.github.javaparser.ast.body.TypeDeclaration;
|
||||
import com.github.javaparser.ast.body.VariableDeclarator;
|
||||
import com.github.javaparser.ast.expr.NameExpr;
|
||||
import com.github.javaparser.ast.expr.QualifiedNameExpr;
|
||||
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserInterfaceDeclaration;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import com.github.javaparser.ast.expr.Name;
|
||||
import com.github.javaparser.ast.type.TypeParameter;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
|
||||
public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
{
|
||||
@@ -62,14 +60,14 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
}
|
||||
else
|
||||
{
|
||||
CompilationUnit compilationUnit = getCompilationUnitContext(decl);
|
||||
CompilationUnit compilationUnit = decl.getAncestorOfType(CompilationUnit.class);
|
||||
|
||||
if (compilationUnit != null)
|
||||
{
|
||||
PackageDeclaration packageDecl = compilationUnit.getPackage();
|
||||
if (packageDecl != null)
|
||||
Optional<PackageDeclaration> packageDecl = compilationUnit.getPackageDeclaration();
|
||||
if (packageDecl.isPresent())
|
||||
{
|
||||
declName.setParent(getQualifiedName(packageDecl.getName()));
|
||||
declName.setParent(getQualifiedName(packageDecl.get().getName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -92,7 +90,7 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
return resolver.getQualifiedDeclName(decl);
|
||||
}
|
||||
|
||||
public JavaDeclName getQualifiedDeclName(BodyDeclaration decl)
|
||||
public JavaDeclName getQualifiedDeclName(BodyDeclaration<?> decl)
|
||||
{
|
||||
JavaDeclName declName = null;
|
||||
|
||||
@@ -110,14 +108,14 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
}
|
||||
else
|
||||
{
|
||||
CompilationUnit compilationUnit = getCompilationUnitContext(decl);
|
||||
CompilationUnit compilationUnit = decl.getAncestorOfType(CompilationUnit.class);
|
||||
|
||||
if (compilationUnit != null)
|
||||
{
|
||||
PackageDeclaration packageDecl = compilationUnit.getPackage();
|
||||
if (packageDecl != null)
|
||||
Optional<PackageDeclaration> packageDecl = compilationUnit.getPackageDeclaration();
|
||||
if (packageDecl.isPresent())
|
||||
{
|
||||
declName.setParent(getQualifiedName(packageDecl.getName()));
|
||||
declName.setParent(getQualifiedName(packageDecl.get().getName()));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -131,7 +129,7 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
|
||||
public JavaDeclName getDeclName(VariableDeclarator decl)
|
||||
{
|
||||
return new JavaDeclName(decl.getId().getName());
|
||||
return new JavaDeclName(decl.getNameAsString());
|
||||
}
|
||||
|
||||
public JavaDeclName getDeclName(BodyDeclaration decl)
|
||||
@@ -155,7 +153,7 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
}
|
||||
else if (decl instanceof EnumConstantDeclaration)
|
||||
{
|
||||
declName = new JavaDeclName(((EnumConstantDeclaration)decl).getName());
|
||||
declName = new JavaDeclName(((EnumConstantDeclaration)decl).getNameAsString());
|
||||
}
|
||||
else if (decl instanceof FieldDeclaration)
|
||||
{
|
||||
@@ -172,7 +170,7 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
}
|
||||
else if (decl instanceof TypeDeclaration)
|
||||
{
|
||||
declName = new JavaDeclName(((TypeDeclaration)decl).getName(), getTypeParameterNames((TypeDeclaration)decl));
|
||||
declName = new JavaDeclName(((TypeDeclaration)decl).getNameAsString(), getTypeParameterNames((TypeDeclaration)decl));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,34 +179,34 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
|
||||
private static List<String> getTypeParameterNames(TypeDeclaration decl)
|
||||
{
|
||||
List<TypeParameter> typeParameters = null;
|
||||
NodeList<TypeParameter> typeParameters = null;
|
||||
if (decl instanceof ClassOrInterfaceDeclaration)
|
||||
{
|
||||
typeParameters = ((ClassOrInterfaceDeclaration)decl).getTypeParameters();
|
||||
typeParameters = (NodeList<TypeParameter>) ((ClassOrInterfaceDeclaration)decl).getTypeParameters();
|
||||
}
|
||||
|
||||
return getTypeParameterNames(typeParameters);
|
||||
}
|
||||
|
||||
private static List<String> getTypeParameterNames(List<TypeParameter> typeParameters)
|
||||
private static List<String> getTypeParameterNames(NodeList<TypeParameter> typeParameters)
|
||||
{
|
||||
List<String> typeParameterNames = new ArrayList<>();
|
||||
if (typeParameters != null && typeParameters.size() > 0)
|
||||
{
|
||||
for (int i = 0; i < typeParameters.size(); i++)
|
||||
{
|
||||
typeParameterNames.add(typeParameters.get(i).getName());
|
||||
typeParameterNames.add(typeParameters.get(i).getNameAsString());
|
||||
}
|
||||
}
|
||||
return typeParameterNames;
|
||||
}
|
||||
|
||||
public static JavaDeclName getQualifiedName(NameExpr nameExpr)
|
||||
public static JavaDeclName getQualifiedName(Name name)
|
||||
{
|
||||
JavaDeclName declName = new JavaDeclName(nameExpr.getName());
|
||||
if (nameExpr instanceof QualifiedNameExpr)
|
||||
JavaDeclName declName = new JavaDeclName(name.getId());
|
||||
if (name.getQualifier().isPresent())
|
||||
{
|
||||
declName.setParent(getQualifiedName(((QualifiedNameExpr)nameExpr).getQualifier()));
|
||||
declName.setParent(getQualifiedName(name.getQualifier().get()));
|
||||
}
|
||||
return declName;
|
||||
}
|
||||
@@ -234,41 +232,23 @@ public class JavaparserDeclNameResolver extends JavaNameResolver
|
||||
{
|
||||
BodyDeclaration context = null;
|
||||
|
||||
Node parentNode = decl.getParentNode();
|
||||
Optional<Node> parentNode = decl.getParentNode();
|
||||
while (
|
||||
parentNode != null &&
|
||||
parentNode.isPresent() &&
|
||||
!(
|
||||
parentNode instanceof BodyDeclaration &&
|
||||
(!(parentNode instanceof FieldDeclaration))
|
||||
parentNode.get() instanceof BodyDeclaration &&
|
||||
(!(parentNode.get() instanceof FieldDeclaration))
|
||||
)
|
||||
)
|
||||
{
|
||||
parentNode = parentNode.getParentNode();
|
||||
parentNode = parentNode.get().getParentNode();
|
||||
}
|
||||
|
||||
if (parentNode != null)
|
||||
if (parentNode.isPresent())
|
||||
{
|
||||
context = (BodyDeclaration)parentNode;
|
||||
context = (BodyDeclaration)parentNode.get();
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
private static CompilationUnit getCompilationUnitContext(Node decl)
|
||||
{
|
||||
CompilationUnit context = null;
|
||||
{
|
||||
Node parentNode = decl.getParentNode();
|
||||
while (parentNode != null && !(parentNode instanceof CompilationUnit))
|
||||
{
|
||||
parentNode = parentNode.getParentNode();
|
||||
}
|
||||
|
||||
if (parentNode != null)
|
||||
{
|
||||
context = (CompilationUnit)parentNode;
|
||||
}
|
||||
}
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
package io.coati;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.javaparser.ast.Node;
|
||||
import com.github.javaparser.ast.body.BodyDeclaration;
|
||||
import com.github.javaparser.ast.type.*;
|
||||
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import me.tomassetti.symbolsolver.javaparsermodel.declarations.JavaParserTypeParameter;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeParameter;
|
||||
import me.tomassetti.symbolsolver.model.resolution.TypeSolver;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.TypeParameterUsage;
|
||||
import me.tomassetti.symbolsolver.model.typesystem.TypeUsage;
|
||||
import com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;
|
||||
import com.github.javaparser.symbolsolver.model.resolution.TypeSolver;
|
||||
|
||||
public class JavaparserTypeNameResolver extends JavaNameResolver
|
||||
{
|
||||
@@ -35,20 +29,37 @@ public class JavaparserTypeNameResolver extends JavaNameResolver
|
||||
public JavaTypeName getQualifiedTypeName(Type type)
|
||||
{
|
||||
String fallbackTypeName = type.toString();
|
||||
|
||||
|
||||
if (type instanceof ClassOrInterfaceType)
|
||||
{
|
||||
try
|
||||
{
|
||||
TypeUsage typeUsage = JavaParserFacade.get(m_typeSolver).convert(type, type);
|
||||
|
||||
return JavaSymbolSolverTypeNameResolver.getQualifiedTypeName(typeUsage, m_typeSolver, m_ignoredContexts);
|
||||
return JavaSymbolSolverTypeNameResolver.getQualifiedTypeName(
|
||||
JavaParserFacade.get(m_typeSolver).convert(type, type),
|
||||
m_typeSolver,
|
||||
m_ignoredContexts
|
||||
);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// log...
|
||||
}
|
||||
}
|
||||
else if (type instanceof ArrayType)
|
||||
{
|
||||
ArrayType arrayType = (ArrayType)type;
|
||||
|
||||
// TODO: regard array info!
|
||||
return getQualifiedTypeName(arrayType.getComponentType());
|
||||
}
|
||||
else if (type instanceof TypeParameter)
|
||||
{
|
||||
return JavaSymbolSolverTypeNameResolver.getQualifiedTypeName(
|
||||
JavaParserFacade.get(m_typeSolver).convert(type, type),
|
||||
m_typeSolver,
|
||||
m_ignoredContexts
|
||||
);
|
||||
}
|
||||
else if (type instanceof IntersectionType)
|
||||
{
|
||||
// System.out.println(" IntersectionType: " + fallbackTypeName);
|
||||
@@ -59,13 +70,6 @@ public class JavaparserTypeNameResolver extends JavaNameResolver
|
||||
{
|
||||
return JavaTypeName.fromDotSeparatedString(type.toString());
|
||||
}
|
||||
else if (type instanceof ReferenceType)
|
||||
{
|
||||
ReferenceType referenceType = (ReferenceType)type;
|
||||
|
||||
boolean isArray = (referenceType.getArrayCount() == 0); // TODO: regard array info!
|
||||
return getQualifiedTypeName(referenceType.getType());
|
||||
}
|
||||
else if (type instanceof UnionType)
|
||||
{
|
||||
// System.out.println(" UnionType: " + fallbackTypeName);
|
||||
|
||||
Reference in New Issue
Block a user