private GenericType createGenericType(ITypeBinding binding) { IJavaElement javaElement= binding.getJavaElement(); GenericType result= fGenericTypes.get(javaElement); if (result != null) return result; result= new GenericType(this); fGenericTypes.put(javaElement, result); result.initialize(binding, (IType)javaElement); cacheSubType(result.getSuperclass(), result); cacheSubTypes(result.getInterfaces(), result); return result; }
@Override public boolean doEquals(TType type) { return getJavaElementType().equals(((GenericType)type).getJavaElementType()); }
public ParametricStructure(GenericType base) { if (base == null) throw new NullPointerException(); fBase= base; fParameters= new ParametricStructure[base.getTypeParameters().length]; }
private ParameterizedType findSameDeclaration(GenericType targetDeclaration) { if (fTypeDeclaration.equals(targetDeclaration)) return this; ParameterizedType result= null; TType type= getSuperclass(); if (type != null && type.getKind() == PARAMETERIZED_TYPE) { result= ((ParameterizedType)type).findSameDeclaration(targetDeclaration); if (result != null) return result; } TType[] interfaces= getInterfaces(); for (int i= 0; i < interfaces.length; i++) { type= interfaces[i]; if (type != null && type.getKind() == PARAMETERIZED_TYPE) { result= ((ParameterizedType)type).findSameDeclaration(targetDeclaration); if (result != null) return result; } } return null; }
@Override protected boolean isTypeEquivalentTo(TType other) { int otherElementType= other.getKind(); if (otherElementType == RAW_TYPE || otherElementType == PARAMETERIZED_TYPE) return getErasure().isTypeEquivalentTo(other.getErasure()); return super.isTypeEquivalentTo(other); }
protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isGenericType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); ITypeBinding[] typeParameters= binding.getTypeParameters(); fTypeParameters= new TypeVariable[typeParameters.length]; for (int i= 0; i < typeParameters.length; i++) { fTypeParameters[i]= (TypeVariable) environment.create(typeParameters[i]); } }
private boolean canAssignToRawType(RawType target) { return fTypeDeclaration.isSubType(target.getHierarchyType()); }
private ParameterizedType findSameDeclaration(GenericType targetDeclaration) { if (fTypeDeclaration.equals(targetDeclaration)) return this; ParameterizedType result= null; TType type= getSuperclass(); if (type != null && type.getKind() == PARAMETERIZED_TYPE) { result= ((ParameterizedType)type).findSameDeclaration(targetDeclaration); if (result != null) return result; } TType[] interfaces= getInterfaces(); for (int i= 0; i < interfaces.length; i++) { type= interfaces[i]; if (type != null && type.getKind() == PARAMETERIZED_TYPE) { result= ((ParameterizedType)type).findSameDeclaration(targetDeclaration); if (result != null) return result; } } return null; }
protected boolean isTypeEquivalentTo(TType other) { int otherElementType= other.getKind(); if (otherElementType == RAW_TYPE || otherElementType == PARAMETERIZED_TYPE) return getErasure().isTypeEquivalentTo(other.getErasure()); return super.isTypeEquivalentTo(other); }
@Override protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isGenericType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); ITypeBinding[] typeParameters= binding.getTypeParameters(); fTypeParameters= new TypeVariable[typeParameters.length]; for (int i= 0; i < typeParameters.length; i++) { fTypeParameters[i]= (TypeVariable) environment.create(typeParameters[i]); } }
private boolean canAssignToRawType(RawType target) { return fTypeDeclaration.isSubType(target.getHierarchyType()); }
private GenericType createGenericType(ITypeBinding binding) { IJavaElement javaElement= binding.getJavaElement(); GenericType result= (GenericType)fGenericTypes.get(javaElement); if (result != null) return result; result= new GenericType(this); fGenericTypes.put(javaElement, result); result.initialize(binding, (IType)javaElement); cacheSubType(result.getSuperclass(), result); cacheSubTypes(result.getInterfaces(), result); return result; }
public ParametricStructure(GenericType base) { if (base == null) throw new NullPointerException(); fBase= base; fParameters= new ParametricStructure[base.getTypeParameters().length]; }
private ParameterizedType findSameDeclaration(GenericType targetDeclaration) { if (fTypeDeclaration.equals(targetDeclaration)) return this; ParameterizedType result= null; TType type= getSuperclass(); if (type != null && type.getKind() == PARAMETERIZED_TYPE) { result= ((ParameterizedType)type).findSameDeclaration(targetDeclaration); if (result != null) return result; } TType[] interfaces= getInterfaces(); for (int i= 0; i < interfaces.length; i++) { type= interfaces[i]; if (type != null && type.getKind() == PARAMETERIZED_TYPE) { result= ((ParameterizedType)type).findSameDeclaration(targetDeclaration); if (result != null) return result; } } return null; }
public boolean doEquals(TType type) { return getJavaElementType().equals(((GenericType)type).getJavaElementType()); }
@Override protected boolean isTypeEquivalentTo(TType other) { int otherElementType= other.getKind(); if (otherElementType == RAW_TYPE || otherElementType == PARAMETERIZED_TYPE) return getErasure().isTypeEquivalentTo(other.getErasure()); return super.isTypeEquivalentTo(other); }
@Override protected void initialize(ITypeBinding binding, IType javaElementType) { Assert.isTrue(binding.isGenericType()); super.initialize(binding, javaElementType); TypeEnvironment environment= getEnvironment(); ITypeBinding[] typeParameters= binding.getTypeParameters(); fTypeParameters= new TypeVariable[typeParameters.length]; for (int i= 0; i < typeParameters.length; i++) { fTypeParameters[i]= (TypeVariable) environment.create(typeParameters[i]); } }
private boolean canAssignToRawType(RawType target) { return fTypeDeclaration.isSubType(target.getHierarchyType()); }
private GenericType createGenericType(ITypeBinding binding) { IJavaElement javaElement= binding.getJavaElement(); GenericType result= fGenericTypes.get(javaElement); if (result != null) return result; result= new GenericType(this); fGenericTypes.put(javaElement, result); result.initialize(binding, (IType)javaElement); cacheSubType(result.getSuperclass(), result); cacheSubTypes(result.getInterfaces(), result); return result; }
public ParametricStructure(GenericType base) { if (base == null) throw new NullPointerException(); fBase= base; fParameters= new ParametricStructure[base.getTypeParameters().length]; }