@Test public void testHasInstanceField() { Symbol instance = EasyMock.createMock(Symbol.class); EasyMock.replay(instance); assertEquals(true, arrayOfBoolean.hasInstanceField("length", instance)); assertEquals(true, arrayOfString.hasInstanceField("length", instance)); assertEquals(true, arrayOfArrayOfString.hasInstanceField("length", instance)); assertEquals(false, arrayOfBoolean.hasInstanceField("foo", instance)); assertEquals(false, arrayOfString.hasInstanceField("foo", instance)); assertEquals(false, arrayOfArrayOfString.hasInstanceField("foo", instance)); EasyMock.verify(instance); }
@Override public boolean hasInstanceField(String fieldName, Symbol instance) { return fieldName.equals(LENGTH_FIELD_NAME); }
ArrayTypeUsage implements TypeUsage { @Override public boolean hasInstanceField(String fieldName, Symbol instance) { return fieldName.equals(LENGTH_FIELD_NAME); } }
ArrayTypeUsage implements TypeUsage { @Override public boolean hasInstanceField(String fieldName, Symbol instance) { return fieldName.equals(LENGTH_FIELD_NAME); } ArrayTypeUsage(TypeUsage componentType); }
ArrayTypeUsage implements TypeUsage { @Override public boolean hasInstanceField(String fieldName, Symbol instance) { return fieldName.equals(LENGTH_FIELD_NAME); } 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(); }
ArrayTypeUsage implements TypeUsage { @Override public boolean hasInstanceField(String fieldName, Symbol instance) { return fieldName.equals(LENGTH_FIELD_NAME); } 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();  }