ArrayTypeUsage implements TypeUsage { @Override public boolean sameType(TypeUsage other) { if (!other.isArray()) { return false; } return this.getComponentType().sameType(other.asArrayTypeUsage().getComponentType()); } ArrayTypeUsage(TypeUsage componentType); TypeUsage getComponentType(); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean isArray(); @Override boolean isReference(); @Override ArrayTypeUsage asArrayTypeUsage(); @Override JvmType jvmType(); @Override boolean hasInstanceField(String fieldName, Symbol instance); @Override Symbol getInstanceField(String fieldName, Symbol instance); @Override Optional<Invokable> getMethod(String method, boolean staticContext); @Override boolean canBeAssignedTo(TypeUsage type); @Override String toString(); @Override TypeUsage replaceTypeVariables(Map<String, T> typeParams); @Override boolean sameType(TypeUsage other); @Override String describe();  }
@Test public void testSameType() { assertEquals(true, arrayOfBoolean.sameType(arrayOfBoolean)); assertEquals(false, arrayOfBoolean.sameType(arrayOfString)); assertEquals(false, arrayOfBoolean.sameType(arrayOfArrayOfString)); assertEquals(false, arrayOfBoolean.sameType(PrimitiveTypeUsage.BOOLEAN)); assertEquals(false, arrayOfBoolean.sameType(string)); assertEquals(false, arrayOfBoolean.sameType(object)); assertEquals(false, arrayOfString.sameType(arrayOfBoolean)); assertEquals(true, arrayOfString.sameType(arrayOfString)); assertEquals(false, arrayOfString.sameType(arrayOfArrayOfString)); assertEquals(false, arrayOfString.sameType(PrimitiveTypeUsage.BOOLEAN)); assertEquals(false, arrayOfString.sameType(string)); assertEquals(false, arrayOfString.sameType(object)); assertEquals(false, arrayOfArrayOfString.sameType(arrayOfBoolean)); assertEquals(false, arrayOfArrayOfString.sameType(arrayOfString)); assertEquals(true, arrayOfArrayOfString.sameType(arrayOfArrayOfString)); assertEquals(false, arrayOfArrayOfString.sameType(PrimitiveTypeUsage.BOOLEAN)); assertEquals(false, arrayOfArrayOfString.sameType(string)); assertEquals(false, arrayOfArrayOfString.sameType(object)); }