Search in sources :

Example 31 with ASTClassOrInterfaceDeclaration

use of net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration in project pmd by pmd.

the class ClassScopeTest method testTwoParamsVararg.

@Test
public final void testTwoParamsVararg() {
    parseCode15(TWO_PARAMS_VARARG);
    ASTClassOrInterfaceDeclaration n = acu.findDescendantsOfType(ASTClassOrInterfaceDeclaration.class).get(0);
    Map<NameDeclaration, List<NameOccurrence>> m = ((ClassScope) n.getScope()).getDeclarations();
    MethodNameDeclaration mnd = (MethodNameDeclaration) m.keySet().iterator().next();
    assertEquals("(String,String...)", mnd.getParameterDisplaySignature());
}
Also used : ASTClassOrInterfaceDeclaration(net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration) List(java.util.List) NameDeclaration(net.sourceforge.pmd.lang.symboltable.NameDeclaration) Test(org.junit.Test) EnumTest(net.sourceforge.pmd.lang.java.symboltable.testdata.InnerClass.TheInnerClass.EnumTest)

Aggregations

ASTClassOrInterfaceDeclaration (net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration)31 Test (org.junit.Test)18 EnumTest (net.sourceforge.pmd.lang.java.symboltable.testdata.InnerClass.TheInnerClass.EnumTest)15 List (java.util.List)14 NameDeclaration (net.sourceforge.pmd.lang.symboltable.NameDeclaration)12 Node (net.sourceforge.pmd.lang.ast.Node)7 Map (java.util.Map)4 ASTAnnotationTypeDeclaration (net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration)3 ASTClassOrInterfaceType (net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceType)3 ASTCompilationUnit (net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit)3 ASTExtendsList (net.sourceforge.pmd.lang.java.ast.ASTExtendsList)3 ASTMethodDeclaration (net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration)3 AbstractJavaTypeNode (net.sourceforge.pmd.lang.java.ast.AbstractJavaTypeNode)3 JavaNode (net.sourceforge.pmd.lang.java.ast.JavaNode)3 NameOccurrence (net.sourceforge.pmd.lang.symboltable.NameOccurrence)3 ArrayList (java.util.ArrayList)2 ASTArguments (net.sourceforge.pmd.lang.java.ast.ASTArguments)2 ASTConstructorDeclaration (net.sourceforge.pmd.lang.java.ast.ASTConstructorDeclaration)2 ASTImplementsList (net.sourceforge.pmd.lang.java.ast.ASTImplementsList)2 ASTTypeDeclaration (net.sourceforge.pmd.lang.java.ast.ASTTypeDeclaration)2