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

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


  private void generateAnnotation(Annotation annotation, int currentOffset) {
    int startingContentsOffset = currentOffset;
    if (this.contentsOffset + 4 >= this.contents.length) {
      resizeContents(4);
    }
    TypeBinding annotationTypeBinding = annotation.resolvedType;
    if (annotationTypeBinding == null) {
      this.contentsOffset = startingContentsOffset;
      return;
    }
    final int typeIndex = this.constantPool.literalIndex(annotationTypeBinding.signature());
    this.contents[this.contentsOffset++] = (byte) (typeIndex >> 8);
    this.contents[this.contentsOffset++] = (byte) typeIndex;
    if (annotation instanceof NormalAnnotation) {
      NormalAnnotation normalAnnotation = (NormalAnnotation) annotation;
      MemberValuePair[] memberValuePairs = normalAnnotation.memberValuePairs;
View Full Code Here


  private void generateElementValue(
      Expression defaultValue,
      TypeBinding memberValuePairReturnType,
      int attributeOffset) {
    Constant constant = defaultValue.constant;
    TypeBinding defaultValueBinding = defaultValue.resolvedType;
    if (defaultValueBinding == null) {
      this.contentsOffset = attributeOffset;
    } else {
      if (memberValuePairReturnType.isArrayType() && !defaultValueBinding.isArrayType()) {
        // automatic wrapping
        if (this.contentsOffset + 3 >= this.contents.length) {
          resizeContents(3);
        }
        this.contents[this.contentsOffset++] = (byte) '[';
View Full Code Here

    for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) {
      LocalVariableBinding localVariable = this.codeStream.locals[i];
      int initializationCount = localVariable.initializationCount;
      if (initializationCount == 0) continue;
      if (localVariable.declaration == null) continue;
      final TypeBinding localVariableTypeBinding = localVariable.type;
      boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable();
      if (isParameterizedType) {
        if (genericLocalVariables == null) {
          // we cannot have more than max locals
          genericLocalVariables = new LocalVariableBinding[max];
        }
        genericLocalVariables[genericLocalVariablesCounter++] = localVariable;
      }
      for (int j = 0; j < initializationCount; j++) {
        int startPC = localVariable.initializationPCs[j << 1];
        int endPC = localVariable.initializationPCs[(j << 1) + 1];
        if (startPC != endPC) { // only entries for non zero length
          if (endPC == -1) {
            localVariable.declaringScope.problemReporter().abortDueToInternalError(
                Messages.bind(Messages.abort_invalidAttribute, new String(localVariable.name)),
                (ASTNode) localVariable.declaringScope.methodScope().referenceContext);
          }
          if (isParameterizedType) {
            numberOfGenericEntries++;
          }
          // now we can safely add the local entry
          numberOfEntries++;
          this.contents[localContentsOffset++] = (byte) (startPC >> 8);
          this.contents[localContentsOffset++] = (byte) startPC;
          int length = endPC - startPC;
          this.contents[localContentsOffset++] = (byte) (length >> 8);
          this.contents[localContentsOffset++] = (byte) length;
          nameIndex = this.constantPool.literalIndex(localVariable.name);
          this.contents[localContentsOffset++] = (byte) (nameIndex >> 8);
          this.contents[localContentsOffset++] = (byte) nameIndex;
          descriptorIndex = this.constantPool.literalIndex(localVariableTypeBinding.signature());
          this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8);
          this.contents[localContentsOffset++] = (byte) descriptorIndex;
          int resolvedPosition = localVariable.resolvedPosition;
          this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8);
          this.contents[localContentsOffset++] = (byte) resolvedPosition;
View Full Code Here

    int[] missingTypesIndexes = new int[initialSize];
    int numberOfMissingTypes = 0;
    if (initialSize > 1) {
      Collections.sort(this.missingTypes, new Comparator() {
        public int compare(Object o1, Object o2) {
          TypeBinding typeBinding1 = (TypeBinding) o1;
          TypeBinding typeBinding2 = (TypeBinding) o2;
          return CharOperation.compareTo(typeBinding1.constantPoolName(), typeBinding2.constantPoolName());
        }
      });
    }
    int previousIndex = 0;
    next: for (int i = 0; i < initialSize; i++) {
View Full Code Here

          }

          TypeBinding[] arguments;
          if ((arguments = methodBinding.parameters) != null) {
            for (int i = 0, max = arguments.length; i < max; i++) {
              final TypeBinding typeBinding = arguments[i];
              frame.putLocal(resolvedPosition,
                  new VerificationTypeInfo(typeBinding));
              switch (typeBinding.id) {
                case TypeIds.T_double:
                case TypeIds.T_long:
                  resolvedPosition += 2;
                  break;
                default:
                  resolvedPosition++;
              }
            }
          }

          SyntheticArgumentBinding syntheticArguments[];
          if ((syntheticArguments = methodBinding.declaringClass.syntheticOuterLocalVariables()) != null) {
            for (int i = 0, max = syntheticArguments.length; i < max; i++) {
              final TypeBinding typeBinding = syntheticArguments[i].type;
              LocalVariableBinding localVariableBinding = new LocalVariableBinding((" synthetic" + i).toCharArray(), typeBinding, 0, false); //$NON-NLS-1$
              localVariableBinding.resolvedPosition = resolvedPosition;
              this.codeStream.record(localVariableBinding);
              localVariableBinding.recordInitializationStartPC(0);
              localVariableBinding.recordInitializationEndPC(codeLength);

              frame.putLocal(resolvedPosition,
                  new VerificationTypeInfo(typeBinding));
              switch (typeBinding.id) {
                case TypeIds.T_double:
                case TypeIds.T_long:
                  resolvedPosition += 2;
                  break;
                default:
                  resolvedPosition++;
              }
            }
          }
        } else {
          TypeBinding[] arguments;
          if ((arguments = methodBinding.parameters) != null) {
            for (int i = 0, max = arguments.length; i < max; i++) {
              final TypeBinding typeBinding = arguments[i];
              frame.putLocal(resolvedPosition,
                  new VerificationTypeInfo(typeBinding));
              switch (typeBinding.id) {
                case TypeIds.T_double:
                case TypeIds.T_long:
                  resolvedPosition += 2;
                  break;
                default:
                  resolvedPosition++;
              }
            }
          }
        }
      } else {
        TypeBinding[] arguments;
        if ((arguments = methodBinding.parameters) != null) {
          for (int i = 0, max = arguments.length; i < max; i++) {
            final TypeBinding typeBinding = arguments[i];
            frame.putLocal(resolvedPosition,
                new VerificationTypeInfo(typeBinding));
            switch (typeBinding.id) {
              case TypeIds.T_double:
              case TypeIds.T_long:
View Full Code Here

    i = 0;
    locals: for (int max = this.codeStream.allLocalsCounter; i < max; i++) {
      LocalVariableBinding localVariable = this.codeStream.locals[i];
      if (localVariable == null) continue;
      int resolvedPosition = localVariable.resolvedPosition;
      final TypeBinding localVariableTypeBinding = localVariable.type;
      inits: for (int j = 0; j < localVariable.initializationCount; j++) {
        int startPC = localVariable.initializationPCs[j << 1];
        int endPC = localVariable.initializationPCs[(j << 1) + 1];
        if (currentPC < startPC) {
          continue inits;
View Full Code Here

        } else {
          hasStackMarkers = false;
        }
      }
      if (hasStackDepthMarkers && stackDepthMarker.pc == currentPC) {
        TypeBinding typeBinding = stackDepthMarker.typeBinding;
        if (typeBinding != null) {
          if (stackDepthMarker.delta > 0) {
            frame.addStackItem(new VerificationTypeInfo(typeBinding));
          } else {
            frame.stackItems[frame.numberOfStackItems - 1] = new VerificationTypeInfo(typeBinding);
View Full Code Here

      this.currentOffset += utf8encodingLength;
    }
    return index;
  }
  public int literalIndex(TypeBinding binding) {
    TypeBinding typeBinding = binding.leafComponentType();
    if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
      Util.recordNestedType(this.classFile, typeBinding);
    }
    return literalIndex(binding.signature());
  }
View Full Code Here

   * This method returns the index into the constantPool corresponding to the type descriptor
   * corresponding to a type constant pool name
   * binding must not be an array type.
   */
  public int literalIndexForType(final TypeBinding binding) {
    TypeBinding typeBinding = binding.leafComponentType();
    if ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
      Util.recordNestedType(this.classFile, typeBinding);
    }
    return this.literalIndexForType(binding.constantPoolName());
  }
View Full Code Here

    return;
  if ((this.bits & Binding.FIELD) != 0 && this.binding != null && this.binding.isValidBinding()) {
    // set the generic cast after the fact, once the type expectation is fully known (no need for strict cast)
    FieldBinding field = (FieldBinding) this.binding;
    FieldBinding originalBinding = field.original();
    TypeBinding originalType = originalBinding.type;
    // extra cast needed if field type is type variable
    if (originalType.leafComponentType().isTypeVariable()) {
        TypeBinding targetType = (!compileTimeType.isBaseType() && runtimeTimeType.isBaseType())
          ? compileTimeType  // unboxing: checkcast before conversion
          : runtimeTimeType;
          this.genericCast = originalType.genericCast(scope.boxing(targetType));
          if (this.genericCast instanceof ReferenceBinding) {
        ReferenceBinding referenceCast = (ReferenceBinding) this.genericCast;
View Full Code Here

TOP

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

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.