merge from trunk: Fixed ClassCastException in symbol table code

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6468 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch 2008-09-10 19:54:21 +00:00
parent c07f274b4e
commit 7cd887ba8c
4 changed files with 19 additions and 0 deletions

View File

@ -3,6 +3,7 @@
Fixed bug 1481051 - false + UnusedNullCheckInEquals (and other false positives too)
Fixed bug 1943204 - Ant task: <ruleset> path should be relative to Ant basedir
Fixed ClassCastException on generic method in BeanMembersShouldSerialize
Fixed ClassCastException in symbol table code
August 31, 2008 - 4.2.3:

View File

@ -32,6 +32,10 @@ public class MethodScopeTest extends STBBaseTst {
MethodScope ms = (MethodScope) meth.getScope();
assertEquals(ms.getName(), "foo");
}
@Test
public void testGenerics() {
parseCode15(TEST_GENERICS);
}
public static final String TEST1 =
"public class Foo {" + PMD.EOL +
@ -40,6 +44,13 @@ public class MethodScopeTest extends STBBaseTst {
" }" + PMD.EOL +
"}";
private static final String TEST_GENERICS =
"public class Tree {" + PMD.EOL +
" private List<Object> subForest;" + PMD.EOL +
" public <B> Tree<B> fmap(final F<B> f) { return Tree.<B>foo(); }" + PMD.EOL +
" public List<Object> subForest() { return null; }" + PMD.EOL +
"}" + PMD.EOL;
public static junit.framework.Test suite() {
return new junit.framework.JUnit4TestAdapter(MethodScopeTest.class);
}

View File

@ -55,6 +55,10 @@ public class MethodNameDeclaration extends AbstractNameDeclaration {
}
public boolean equals(Object o) {
if (!(o instanceof MethodNameDeclaration)) {
return false;
}
MethodNameDeclaration other = (MethodNameDeclaration) o;
// compare name

View File

@ -67,6 +67,9 @@ public class VariableNameDeclaration extends AbstractNameDeclaration {
}
public boolean equals(Object o) {
if (!(o instanceof VariableNameDeclaration)) {
return false;
}
VariableNameDeclaration n = (VariableNameDeclaration) o;
return n.node.getImage().equals(node.getImage());
}