Examples of ArrayBinding


Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

        }
        // Reference to the class itself.
        jsniRef.setResolvedClassName(JdtUtil.getSourceName(binding));
        jsniRef.setResolvedMemberWithSignature(jsniRef.memberSignature());
        if (jsniRef.isArray()) {
          ArrayBinding arrayBinding =
              method.scope.createArrayType(binding, jsniRef.getDimensions());
          return arrayBinding;
        } else {
          return binding;
        }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

    }
    JType type = types.get(key);
    if (type == null) {
      assert !(binding instanceof BaseTypeBinding);
      if (binding instanceof ArrayBinding) {
        ArrayBinding arrayBinding = (ArrayBinding) binding;
        type = new JArrayType(get(arrayBinding.elementsType()));
      } else {
        ReferenceBinding refBinding = (ReferenceBinding) binding;
        type = createType(refBinding);
        if (type instanceof JClassType) {
          ReferenceBinding superclass = refBinding.superclass();
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

        case TypeIds.T_undefined:
        default:
          return null;
      }
    } else if (binding instanceof ArrayBinding) {
      ArrayBinding arrayBinding = (ArrayBinding) binding;
      JType elementType = (JType) get(arrayBinding.elementsType(), failOnNull);
      if (elementType == null) {
        return null;
      }
      return program.getTypeArray(elementType);
    } else if (binding instanceof BinaryTypeBinding) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

        if (type.isArrayType()) {
          if (this.scope == null) {
            return null;
          }
          ArrayType arrayType = (ArrayType) type;
          ArrayBinding arrayBinding = (ArrayBinding) typeBinding;
          int dimensions = arrayType.getDimensions();
          boolean isVarargs = typeReference.isVarargs();
          if (dimensions == arrayBinding.dimensions)
            return getTypeBinding(arrayBinding); // reuse.
          return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, dimensions, getTypeAnnotations(dimensions, arrayBinding, isVarargs)));
        }
        if (typeBinding.isArrayType()) {
          // 'typeBinding' can still be an array type because 'node' may be "larger" than 'type' (see comment of newAstToOldAst).
          typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
        }
        int index;
        if (type.isQualifiedType()) {
          index = ((QualifiedType) type).index;
        } else if (type.isParameterizedType()) {
          index = ((ParameterizedType) type).index;
        } else {
          index = 1;
        }
        final int numberOfTypeArgumentsNotNull = getTypeCount(typeReference);
        if (index != numberOfTypeArgumentsNotNull) {
          int  i = numberOfTypeArgumentsNotNull;
          while (i != index) {
            typeBinding = typeBinding.enclosingType();
            i --;
          }
          binding = typeBinding;
        } else {
          binding = typeBinding;
        }
      } else if (node instanceof TypeReference) {
        if (type instanceof SimpleType && node instanceof QualifiedTypeReference) {
          return resolveTypeBindingForName(((SimpleType)type).getName());
        } else if (type instanceof QualifiedType) {
          return resolveTypeBindingForName(((QualifiedType)type).getName());
        } else if (type instanceof NameQualifiedType){
          return resolveTypeBindingForName(((NameQualifiedType)type).getName());
        }
        TypeReference typeReference = (TypeReference) node;
        binding = typeReference.resolvedType;
      } else if (node instanceof SingleNameReference && ((SingleNameReference)node).isTypeReference()) {
        binding = (((SingleNameReference)node).resolvedType);
      } else if (node instanceof QualifiedNameReference && ((QualifiedNameReference)node).isTypeReference()) {
        binding = (((QualifiedNameReference)node).resolvedType);
      } else if (node instanceof ArrayAllocationExpression) {
        binding = ((ArrayAllocationExpression) node).resolvedType;
      }
      if (binding != null) {
        if (type.isArrayType()) {
          ArrayType arrayType = (ArrayType) type;
          if (this.scope == null) {
            return null;
          }
          ArrayBinding arrayBinding = (ArrayBinding) binding;
          int dimensions = arrayType.getDimensions();
          boolean isVarargs = node instanceof TypeReference && ((TypeReference) node).isVarargs();
          if (dimensions == arrayBinding.dimensions)
            return getTypeBinding(arrayBinding); // reuse
          return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, dimensions, getTypeAnnotations(dimensions, arrayBinding, isVarargs)));
        } else if (binding.isArrayType()) {
          // 'binding' can still be an array type because 'node' may be "larger" than 'type' (see comment of newAstToOldAst).
          ArrayBinding arrayBinding = (ArrayBinding) binding;
          return getTypeBinding(arrayBinding.leafComponentType);
        }
        return getTypeBinding(binding);
      }
    } else if (type.isPrimitiveType()) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

   * @see org.eclipse.jdt.core.dom.ITypeBinding#getElementType()
   */
  public ITypeBinding getElementType() {
    if (this.binding != null) {
      if (this.binding.isArrayType()) {
        ArrayBinding arrayBinding = (ArrayBinding) this.binding;
        return new RecoveredTypeBinding(this.resolver, arrayBinding.leafComponentType);
      } else {
        return new RecoveredTypeBinding(this.resolver, this.binding);
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

  }

  private ReferenceBinding getReferenceBinding() {
    if (this.binding != null) {
      if (this.binding.isArrayType()) {
        ArrayBinding arrayBinding = (ArrayBinding) this.binding;
        if (arrayBinding.leafComponentType instanceof ReferenceBinding) {
          return (ReferenceBinding) arrayBinding.leafComponentType;
        }
      } else if (this.binding instanceof ReferenceBinding) {
        return (ReferenceBinding) this.binding;
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

          return program.getTypeNull();
        default:
          return null;
      }
    } else if (binding instanceof ArrayBinding) {
      ArrayBinding arrayBinding = (ArrayBinding) binding;

      // Compute the JType for the leaf type
      JType leafType = (JType) get(arrayBinding.leafComponentType);

      // Don't create a new JArrayType; use TypeMap to get the singleton
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

    }

    // Check for an array.
    //
    if (binding instanceof ArrayBinding) {
      ArrayBinding arrayBinding = (ArrayBinding) binding;

      // Start by resolving the leaf type.
      //
      TypeBinding leafBinding = arrayBinding.leafComponentType;
      JType resolvedType = resolveType(logger, leafBinding);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

      int argumentLength = originalArgumentTypes.length;
      if (binding.isVarargs()) {
        int paramLength = binding.parameters.length;
        if (paramLength == argumentLength) {
          int varargsIndex = paramLength - 1;
          ArrayBinding varargsType = (ArrayBinding) binding.parameters[varargsIndex];
          TypeBinding lastArgType = alternateArgumentTypes[varargsIndex];
          // originalType may be compatible already, but cast mandated
          // to clarify between varargs/non-varargs call
          if (varargsType.dimensions != lastArgType.dimensions()) {
            return;
          }
          if (lastArgType.isCompatibleWith(varargsType.elementsType())
              && lastArgType.isCompatibleWith(varargsType)) {
            return;
          }
        }
      }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

    sourceEnd);
}
public void varargsArgumentNeedCast(MethodBinding method, TypeBinding argumentType, InvocationSite location) {
  int severity = this.options.getSeverity(CompilerOptions.VarargsArgumentNeedCast);
  if (severity == ProblemSeverities.Ignore) return;
  ArrayBinding varargsType = (ArrayBinding)method.parameters[method.parameters.length-1];
  if (method.isConstructor()) {
    this.handle(
      IProblem.ConstructorVarargsArgumentNeedCast,
      new String[] {
          new String(argumentType.readableName()),
          new String(varargsType.readableName()),
          new String(method.declaringClass.readableName()),
          typesAsString(method.isVarargs(), method.parameters, false),
          new String(varargsType.elementsType().readableName()),
      },
      new String[] {
          new String(argumentType.shortReadableName()),
          new String(varargsType.shortReadableName()),
          new String(method.declaringClass.shortReadableName()),
          typesAsString(method.isVarargs(), method.parameters, true),
          new String(varargsType.elementsType().shortReadableName()),
      },
      severity,
      location.sourceStart(),
      location.sourceEnd());
  } else {
    this.handle(
      IProblem.MethodVarargsArgumentNeedCast,
      new String[] {
          new String(argumentType.readableName()),
          new String(varargsType.readableName()),
          new String(method.selector),
          typesAsString(method.isVarargs(), method.parameters, false),
          new String(method.declaringClass.readableName()),
          new String(varargsType.elementsType().readableName()),
      },
      new String[] {
          new String(argumentType.shortReadableName()),
          new String(varargsType.shortReadableName()),
          new String(method.selector), typesAsString(method.isVarargs(), method.parameters, true),
          new String(method.declaringClass.shortReadableName()),
          new String(varargsType.elementsType().shortReadableName()),
      },
      severity,
      location.sourceStart(),
      location.sourceEnd());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.