Canonical type of arguments in method Qname\n That doesn't work for now because of Typeres. Be sure to edit the tests
This commit is contained in:
@ -55,7 +55,8 @@ public class ASTConstructorDeclaration extends AbstractJavaAccessNode implements
|
||||
String[] types = new String[numParams];
|
||||
|
||||
for (int i = 0; i < numParams; i++) {
|
||||
types[i] = params.jjtGetChild(i).getFirstDescendantOfType(ASTType.class).getTypeImage();
|
||||
// Needs typeres ! TODO
|
||||
types[i] = params.jjtGetChild(i).getFirstDescendantOfType(ASTType.class).getCanonicalTypeName();
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,10 +125,9 @@ public class ASTMethodDeclaration extends AbstractJavaAccessNode implements DFAG
|
||||
String[] types = new String[numParams];
|
||||
|
||||
for (int i = 0; i < numParams; i++) {
|
||||
types[i] = params.jjtGetChild(i).getFirstDescendantOfType(ASTType.class).getTypeImage();
|
||||
types[i] = params.jjtGetChild(i).getFirstDescendantOfType(ASTType.class).getCanonicalTypeName();
|
||||
}
|
||||
|
||||
|
||||
qualifiedName = QualifiedName.makeOperationOf(parent, getMethodName(), types);
|
||||
return qualifiedName;
|
||||
}
|
||||
|
@ -31,4 +31,9 @@ public abstract class AbstractJavaTypeNode extends AbstractJavaNode implements T
|
||||
public void setType(Class<?> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getCanonicalTypeName() {
|
||||
return type.getCanonicalName();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -133,15 +133,15 @@ public class QualifiedNameTest extends ParserTst {
|
||||
public void testConstructorWithParams() {
|
||||
final String TEST = "package bar; class Bzaz{ public Bzaz(int j, String k){}}";
|
||||
|
||||
|
||||
Set<ASTConstructorDeclaration> nodes = getNodes(ASTConstructorDeclaration.class,
|
||||
TEST);
|
||||
|
||||
for (ASTConstructorDeclaration declaration : nodes) {
|
||||
QualifiableNode.QualifiedName qname = declaration.getQualifiedName();
|
||||
assertEquals("bar.Bzaz#Bzaz(int,String)", qname.toString());
|
||||
// TODO fails due to typeres
|
||||
assertEquals("bar.Bzaz#Bzaz(int,java.lang.String)", qname.toString());
|
||||
assertNotNull(qname.getOperation());
|
||||
assertEquals("Bzaz(int,String)", qname.getOperation());
|
||||
assertEquals("Bzaz(int,java.lang.String)", qname.getOperation());
|
||||
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ public class QualifiedNameTest extends ParserTst {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructorOverload() {
|
||||
public void testConstructorOverload() { // TODO fails due to typeres
|
||||
final String TEST = "package bar; class Bzaz{ public Bzaz(int j) {} public Bzaz(int j, String k){}}";
|
||||
|
||||
Set<ASTConstructorDeclaration> nodes = getNodes(ASTConstructorDeclaration.class,
|
||||
@ -171,7 +171,7 @@ public class QualifiedNameTest extends ParserTst {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMethodOverload() {
|
||||
public void testMethodOverload() { // TODO fails due to typeres
|
||||
final String TEST = "package bar; class Bzaz{ public void foo(String j) {} " +
|
||||
"public void foo(int j){} public void foo(double k){}}";
|
||||
|
||||
|
Reference in New Issue
Block a user