public static String buildReferenceEntityTypeName(ITypeBinding typeBinding) { if (!typeBinding.isArray()) { // arrays cannot be entities return typeBinding.getTypeDeclaration().getQualifiedName(); } return null; }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
/** * Expands the form: for ( [final] Type var: iterable ) { ... } Into something equivalent to: for ( Iterator iter = * iterable.iter(); iter.hasNext(); ) { [final] Type var = (Type) iter.next(); ... } Or, in the case of an array: for ( int idx = * 0; i < iterable.length; i++ ) { [final] Type var = iterable[idx]; ... } Except that the expression "iterable" is only evaluate * once (or is it?) */ private CAstNode visit(EnhancedForStatement n, WalkContext context) { if (n.getExpression().resolveTypeBinding().isArray()) return makeArrayEnhancedForLoop(n, context); else return makeIteratorEnhancedForLoop(n, context); }
@Override public boolean visit(final EnhancedForStatement node) { if (isPassive(node.getExpression()) && node.getExpression().resolveTypeBinding().isArray()) { return maybeRemoveStmtWithEmptyBody(node, node.getBody()); } return VISIT_SUBTREE; }
private static String getQualifiedName(ITypeBinding typeBinding) { if (typeBinding.isAnonymous()) return getQualifiedName(typeBinding.getSuperclass()); if (! typeBinding.isArray()) return typeBinding.getQualifiedName(); else return typeBinding.getElementType().getQualifiedName(); }
private static String getQualifiedName(ITypeBinding typeBinding) { if (typeBinding.isAnonymous()) return getQualifiedName(typeBinding.getSuperclass()); if (! typeBinding.isArray()) return typeBinding.getQualifiedName(); else return typeBinding.getElementType().getQualifiedName(); }
private static String getQualifiedName(ITypeBinding typeBinding) { if (typeBinding.isAnonymous()) return getQualifiedName(typeBinding.getSuperclass()); if (! typeBinding.isArray()) return typeBinding.getQualifiedName(); else return typeBinding.getElementType().getQualifiedName(); }
public static ITypeBinding replaceWildcardsAndCaptures(ITypeBinding type) { while (type.isWildcardType() || type.isCapture() || (type.isArray() && type.getElementType().isCapture())) { ITypeBinding bound = type.getBound(); type = (bound != null) ? bound : type.getErasure(); } return type; }
private ISourceLocation resolveFieldAccess(FieldAccess node) { ITypeBinding tb = node.getExpression().resolveTypeBinding(); if (tb != null && tb.isArray() && "length".equals(node.getName().getIdentifier())) { ISourceLocation arrayType = resolveBinding(tb); return makeBinding("java+arrayLength", arrayType.getAuthority(), arrayType.getPath()); } return resolveBinding(node.resolveFieldBinding()); }
private ISourceLocation resolveQualifiedName(QualifiedName node) { ITypeBinding tb = node.getQualifier().resolveTypeBinding(); if (tb != null && tb.isArray() && "length".equals(node.getName().getIdentifier())) { ISourceLocation arrayType = resolveBinding(tb); return makeBinding("java+arrayLength", arrayType.getAuthority(), arrayType.getPath()); } return resolveBinding(node.getName(), false); }
protected void initialize(ITypeBinding binding, TType elementType) { Assert.isTrue(binding.isArray()); super.initialize(binding); fElementType= elementType; fDimensions= binding.getDimensions(); if (fElementType.isStandardType() || fElementType.isGenericType() || fElementType.isPrimitiveType()) { fErasure= this; } else { fErasure= getEnvironment().create(binding.getErasure()); } }
protected void initialize(ITypeBinding binding, TType elementType) { Assert.isTrue(binding.isArray()); super.initialize(binding); fElementType= elementType; fDimensions= binding.getDimensions(); if (fElementType.isStandardType() || fElementType.isGenericType() || fElementType.isPrimitiveType()) { fErasure= this; } else { fErasure= getEnvironment().create(binding.getErasure()); } }
@Override protected void addMember(Object member, boolean addSeparator) { boolean[] interfaces= implementsInterfaces(getMemberType(member).getErasure(), new String[] { "java.util.Collection", "java.util.Map" }); //$NON-NLS-1$ //$NON-NLS-2$ if (getContext().isLimitItems() && getContext().isSkipNulls() && (interfaces[0] || interfaces[1] || getMemberType(member).isArray())) { addMemberCheckNull(member, addSeparator); } else { super.addMember(member, addSeparator); } }
@Override protected void addMember(Object member, boolean addSeparator) { boolean[] interfaces= implementsInterfaces(getMemberType(member).getErasure(), new String[] { "java.util.Collection", "java.util.Map" }); //$NON-NLS-1$ //$NON-NLS-2$ if (getContext().isLimitItems() && getContext().isSkipNulls() && (interfaces[0] || interfaces[1] || getMemberType(member).isArray())) { addMemberCheckNull(member, addSeparator); } else { super.addMember(member, addSeparator); } }
public static boolean containsTypeVariables(ITypeBinding type) { if (type.isTypeVariable()) return true; if (type.isArray()) return containsTypeVariables(type.getElementType()); if (type.isCapture()) return containsTypeVariables(type.getWildcard()); if (type.isParameterizedType()) return containsTypeVariables(type.getTypeArguments()); if (type.isWildcardType() && type.getBound() != null) return containsTypeVariables(type.getBound()); return false; }
static boolean containsTypeVariables(ITypeBinding type) { if (type.isTypeVariable()) return true; if (type.isArray()) return containsTypeVariables(type.getElementType()); if (type.isCapture()) return containsTypeVariables(type.getWildcard()); if (type.isParameterizedType()) return containsTypeVariables(type.getTypeArguments()); if (type.isWildcardType() && type.getBound() != null) return containsTypeVariables(type.getBound()); return false; }