diff --git a/pom.xml b/pom.xml index d8af2a4..9a9fbab 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,6 @@ com.fasterxml.classmate.*;version=${project.version} maven-javadoc-plugin ${version.jdk} - ${version.jdk} UTF-8 https://docs.oracle.com/javase/8/docs/api/ @@ -160,7 +159,15 @@ com.fasterxml.classmate.*;version=${project.version} - + + org.apache.maven.plugins + maven-surefire-plugin + + + **/failing/*.java + + + diff --git a/src/test/java/com/fasterxml/classmate/TestTypeResolver.java b/src/test/java/com/fasterxml/classmate/TestTypeResolver.java index b2c0405..6f4d710 100644 --- a/src/test/java/com/fasterxml/classmate/TestTypeResolver.java +++ b/src/test/java/com/fasterxml/classmate/TestTypeResolver.java @@ -81,14 +81,8 @@ static class HashTree extends HashMap> { } /********************************************************************** */ - protected TypeResolver typeResolver; - - @Override - protected void setUp() - { - // Let's use a single instance for all tests, to increase chance of seeing failures - typeResolver = new TypeResolver(); - } + // Let's use a single instance for all tests, to increase chance of seeing failures + protected final TypeResolver typeResolver = new TypeResolver(); /* /********************************************************************** diff --git a/src/test/java/com/fasterxml/classmate/failing/ArrayTypeResolution51Test.java b/src/test/java/com/fasterxml/classmate/failing/ArrayTypeResolution51Test.java new file mode 100644 index 0000000..ce5cf15 --- /dev/null +++ b/src/test/java/com/fasterxml/classmate/failing/ArrayTypeResolution51Test.java @@ -0,0 +1,18 @@ +package com.fasterxml.classmate.failing; + +import com.fasterxml.classmate.BaseTest; +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeResolver; + +public class ArrayTypeResolution51Test extends BaseTest +{ + protected final TypeResolver RESOLVER = new TypeResolver(); + + // [classmate#51]: parent type for Array classes + public void testResolvingRawType() { + ResolvedType rt = RESOLVER.resolve(Long[].class); + ResolvedType parent = rt.getParentClass(); + assertNotNull(parent); + assertEquals(Long.class, parent.getErasedType()); + } +} diff --git a/src/test/java/com/fasterxml/classmate/failing/TestTypeResolver53.java b/src/test/java/com/fasterxml/classmate/failing/TestTypeResolver53.java new file mode 100644 index 0000000..01eedd1 --- /dev/null +++ b/src/test/java/com/fasterxml/classmate/failing/TestTypeResolver53.java @@ -0,0 +1,26 @@ +package com.fasterxml.classmate.failing; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import com.fasterxml.classmate.BaseTest; +import com.fasterxml.classmate.ResolvedType; +import com.fasterxml.classmate.TypeResolver; + +// for [classmate#53]: Raw Comparator +public class TestTypeResolver53 extends BaseTest +{ + @SuppressWarnings("rawtypes") + static abstract class Comparator53 implements Comparator { } + + protected final TypeResolver RESOLVER = new TypeResolver(); + + // [classmate#53] Problem with Raw types + public void testResolvingRawType() { + ResolvedType rt = RESOLVER.resolve(Comparator53.class); + List params = rt.typeParametersFor(Comparator.class); + assertEquals(Arrays.asList(RESOLVER.resolve(Object.class)), + params); + } +}