Closed kilink closed 8 months ago
See JDK implementation of these methods here: https://github.com/openjdk/jdk/blob/d10f277bd39bb5ac9bd48939c916de607fef8ace/src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/ParameterizedTypeImpl.java
Also note the Javadoc for ParameterizedType, which states:
Instances of classes that implement this interface must implement an equals() method that equates any two instances that share the same generic type declaration and have equal type parameters.
Make ArchaiusType's equals / hashCode / toString match what JDK's ParameterizedTypeImpl does, so that equivalent ParameterizedType instances hash and compare equal with ArchaiusType. Update toString to match what ParameterizedTypeImpl does as well.
Additionally, add do a defensive copy of the returned array in getActualTypeArguments, and add basic unit tests.