Package org.eclipse.jdt.internal.compiler.lookup

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;

      // 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


    }

    // 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

        if (type.isArrayType()) {
          if (this.scope == null) {
            return null;
          }
          ArrayType arrayType = (ArrayType) type;
          ArrayBinding arrayBinding = (ArrayBinding) typeBinding;
          return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions()));
        }
        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 = getTypeArguments(typeReference);
        if (index != numberOfTypeArgumentsNotNull) {
          int  i = numberOfTypeArgumentsNotNull;
          while (i != index) {
            typeBinding = typeBinding.enclosingType();
            i --;
          }
          binding = typeBinding;
        } else {
          binding = typeBinding;
        }
      } else if (node instanceof TypeReference) {
        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;
          return getTypeBinding(this.scope.createArrayType(arrayBinding.leafComponentType, arrayType.getDimensions()));
        } 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

    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, false),
          new String(varargsType.elementsType().readableName()),
      },
      new String[] {
          new String(argumentType.shortReadableName()),
          new String(varargsType.shortReadableName()),
          new String(method.declaringClass.shortReadableName()),
          typesAsString(method, 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, 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, true),
          new String(method.declaringClass.shortReadableName()),
          new String(varargsType.elementsType().shortReadableName()),
      },
      severity,
      location.sourceStart(),
      location.sourceEnd());
  }
View Full Code Here

      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

    }

    // 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

          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

      return type;
    }
    assert !(binding instanceof BaseTypeBinding);

    if (binding instanceof ArrayBinding) {
      ArrayBinding arrayBinding = (ArrayBinding) binding;
      JArrayType arrayType = new JArrayType(get(arrayBinding.elementsType()));
      if (arrayType.isExternal()) {
        types.put(key, arrayType);
      } else {
        sourceTypes.put(key, arrayType);
      }
View Full Code Here

    }

    // 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

        }
        // 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

TOP

Related Classes of org.eclipse.jdt.internal.compiler.lookup.ArrayBinding

Copyright © 2018 www.massapicom. 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.