diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java index 675791ba24..5a493f9e1f 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/ClassTypeResolverTest.java @@ -1325,6 +1325,10 @@ public class ClassTypeResolverTest { assertEquals(int.class, expressions.get(index).getType()); assertEquals(int.class, getChildType(expressions.get(index), 0)); assertEquals(int.class, getChildType(expressions.get(index++), 1)); + // String d = mostSpecific(10, 10, 10); + assertEquals(String.class, expressions.get(index).getType()); + assertEquals(String.class, getChildType(expressions.get(index), 0)); + assertEquals(String.class, getChildType(expressions.get(index++), 1)); // Make sure we got them all assertEquals("All expressions not tested", index, expressions.size()); diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodThirdPhase.java b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodThirdPhase.java index 290ed7cb03..e7740157d1 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodThirdPhase.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/typeresolution/testdata/MethodThirdPhase.java @@ -15,8 +15,16 @@ public class MethodThirdPhase { // component type determined properly int c = vararg(10, "", "", ""); - // TODO: add most specific tests among vararg conversion + // most specific vararg method + String d = mostSpecific(10, 10, 10); + } + Exception mostSpecific(Number... b) { + return null; + } + + String mostSpecific(Integer... b) { + return null; } Exception vararg(int a, Number... b) {