Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference


        sourceEnd = retrieveClosingAngleBracketPosition(typeReference.sourceEnd);
      } else {
        sourceEnd = returnType.sourceEnd;
      }
    } else if (returnType instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) returnType;
      sourceEnd = retrieveClosingAngleBracketPosition(typeReference.sourceEnd);
    } else {
      sourceEnd = returnType.sourceEnd;
    }
  }
View Full Code Here


    if (isRecoveredName(ref.tokens)) return;
    if (ref.indexOfFirstFieldBinding >= 1)
      end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
  } else if (location instanceof ParameterizedQualifiedTypeReference) {
    // must be before instanceof ArrayQualifiedTypeReference
    ParameterizedQualifiedTypeReference ref = (ParameterizedQualifiedTypeReference) location;
    if (isRecoveredName(ref.tokens)) return;
    if (type instanceof ReferenceBinding) {
      char[][] name = ((ReferenceBinding) type).compoundName;
      end = (int) ref.sourcePositions[name.length - 1];
    }
View Full Code Here

            return (int) (ref.sourcePositions[i + offset]);
        }
      }
    }
  } else if (node instanceof ParameterizedQualifiedTypeReference) {
    ParameterizedQualifiedTypeReference reference = (ParameterizedQualifiedTypeReference) node;
    if (index < reference.sourcePositions.length) {
      return (int) reference.sourcePositions[index];
    }
  } else if (node instanceof ArrayQualifiedTypeReference) {
    ArrayQualifiedTypeReference reference = (ArrayQualifiedTypeReference) node;
View Full Code Here

          }
        }
      }
    }
  } else if (node instanceof ParameterizedQualifiedTypeReference) {
    ParameterizedQualifiedTypeReference reference = (ParameterizedQualifiedTypeReference) node;
    return (int) (reference.sourcePositions[0]>>>32);
  }
  return node.sourceStart;
}
View Full Code Here

    // retrieve the old ast node
    org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(type);
    org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = null;
    if (node != null) {
      if (node instanceof ParameterizedQualifiedTypeReference) {
         ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) node;
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = typeReference.resolvedType;
        if (type.isArrayType()) {
          if (this.scope == null) {
            return null;
          }
View Full Code Here

        for (int i = 0; i < typeArguments.length; i++) {
          if (hasEmptyName(typeArguments[i], assistNode)) return true;
        }
      }
    } else if (reference instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference parameterizedReference = (ParameterizedQualifiedTypeReference) reference;
      TypeReference[][] typeArguments = parameterizedReference.typeArguments;
      if (typeArguments != null) {
        for (int i = 0; i < typeArguments.length; i++) {
          if (typeArguments[i] != null) {
            for (int j = 0; j < typeArguments[i].length; j++) {
View Full Code Here

      long[] positions = new long[identCount];
      long pos = ((long) start << 32) + end;
      for (int i = 0; i < identCount; i++) {
        positions[i] = pos;
      }
      return new ParameterizedQualifiedTypeReference(tokens, arguments, dim, positions);
    }
  }
View Full Code Here

      long[] positions = new long[identCount];
      long pos = ((long) start << 32) + end;
      for (int i = 0; i < identCount; i++) {
        positions[i] = pos;
      }
      return new ParameterizedQualifiedTypeReference(tokens, arguments, dim, positions);
    }
  }
View Full Code Here

          completeRecord((ArrayType) type, typeReference);
        }
      }
    } else {
      if (typeReference instanceof ParameterizedQualifiedTypeReference) {
        ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = (ParameterizedQualifiedTypeReference) typeReference;
        char[][] tokens = parameterizedQualifiedTypeReference.tokens;
        TypeReference[][] typeArguments = parameterizedQualifiedTypeReference.typeArguments;
        long[] positions = parameterizedQualifiedTypeReference.sourcePositions;
        sourceStart = (int)(positions[0]>>>32);
        switch(this.ast.apiLevel) {
          case AST.JLS2_INTERNAL : {
            char[][] name = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).getTypeName();
            int nameLength = name.length;
            sourceStart = (int)(positions[0]>>>32);
            length = (int)(positions[nameLength - 1] & 0xFFFFFFFF) - sourceStart + 1;
            Name qualifiedName = this.setQualifiedNameNameAndSourceRanges(name, positions, typeReference);
            final SimpleType simpleType = new SimpleType(this.ast);
            simpleType.setName(qualifiedName);
            simpleType.setSourceRange(sourceStart, length);
            type = simpleType;
          }
          break;
          default :
            if (typeArguments != null) {
              int numberOfEnclosingType = 0;
              int startingIndex = 0;
              int endingIndex = 0;
              for (int i = 0, max = typeArguments.length; i < max; i++) {
                if (typeArguments[i] != null) {
                  numberOfEnclosingType++;
                } else if (numberOfEnclosingType == 0) {
                  endingIndex++;
                }
              }
              Name name = null;
              if (endingIndex - startingIndex == 0) {
                final SimpleName simpleName = new SimpleName(this.ast);
                simpleName.internalSetIdentifier(new String(tokens[startingIndex]));
                recordPendingNameScopeResolution(simpleName);
                int start = (int)(positions[startingIndex]>>>32);
                int end = (int) positions[startingIndex];
                simpleName.setSourceRange(start, end - start + 1);
                simpleName.index = 1;
                name = simpleName;
                if (this.resolveBindings) {
                  recordNodes(simpleName, typeReference);
                }
              } else {
                name = this.setQualifiedNameNameAndSourceRanges(tokens, positions, endingIndex, typeReference);
              }
              SimpleType simpleType = new SimpleType(this.ast);
              simpleType.setName(name);
              int start = (int)(positions[startingIndex]>>>32);
              int end = (int) positions[endingIndex];
              simpleType.setSourceRange(start, end - start + 1);
              ParameterizedType parameterizedType = new ParameterizedType(this.ast);
              parameterizedType.setType(simpleType);
              if (this.resolveBindings) {
                recordNodes(simpleType, typeReference);
                recordNodes(parameterizedType, typeReference);
              }
              start = simpleType.getStartPosition();
              end = start + simpleType.getLength() - 1;
              for (int i = 0, max = typeArguments[endingIndex].length; i < max; i++) {
                final Type type2 = convertType(typeArguments[endingIndex][i]);
                parameterizedType.typeArguments().add(type2);
                end = type2.getStartPosition() + type2.getLength() - 1;
              }
              int indexOfEnclosingType = 1;
              parameterizedType.index = indexOfEnclosingType;
              end = retrieveClosingAngleBracketPosition(end + 1);
              length = end + 1;
              parameterizedType.setSourceRange(start, end - start + 1);
              startingIndex = endingIndex + 1;
              Type currentType = parameterizedType;
              while(startingIndex < typeArguments.length) {
                SimpleName simpleName = new SimpleName(this.ast);
                simpleName.internalSetIdentifier(new String(tokens[startingIndex]));
                simpleName.index = startingIndex + 1;
                start = (int)(positions[startingIndex]>>>32);
                end = (int) positions[startingIndex];
                simpleName.setSourceRange(start, end - start + 1);
                recordPendingNameScopeResolution(simpleName);
                QualifiedType qualifiedType = new QualifiedType(this.ast);
                qualifiedType.setQualifier(currentType);
                qualifiedType.setName(simpleName);
                if (this.resolveBindings) {
                  recordNodes(simpleName, typeReference);
                  recordNodes(qualifiedType, typeReference);
                }
                start = currentType.getStartPosition();
                end = simpleName.getStartPosition() + simpleName.getLength() - 1;
                qualifiedType.setSourceRange(start, end - start + 1);
                indexOfEnclosingType++;
                if (typeArguments[startingIndex] != null) {
                  qualifiedType.index = indexOfEnclosingType;
                  ParameterizedType parameterizedType2 = new ParameterizedType(this.ast);
                  parameterizedType2.setType(qualifiedType);
                  parameterizedType2.index = indexOfEnclosingType;
                  if (this.resolveBindings) {
                    recordNodes(parameterizedType2, typeReference);
                  }
                  for (int i = 0, max = typeArguments[startingIndex].length; i < max; i++) {
                    final Type type2 = convertType(typeArguments[startingIndex][i]);
                    parameterizedType2.typeArguments().add(type2);
                    end = type2.getStartPosition() + type2.getLength() - 1;
                  }
                  end = retrieveClosingAngleBracketPosition(end + 1);
                  length = end + 1;
                  parameterizedType2.setSourceRange(start, end - start + 1);
                  currentType = parameterizedType2;
                } else {
                  currentType = qualifiedType;
                  qualifiedType.index = indexOfEnclosingType;
                }
                startingIndex++;
              }
              if (this.resolveBindings) {
                this.recordNodes(currentType, typeReference);
              }
              type = currentType;
              length -= sourceStart;
            }
        }
      } else if (typeReference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) {
        char[][] name = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).getTypeName();
        int nameLength = name.length;
        long[] positions = ((org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference) typeReference).sourcePositions;
        sourceStart = (int)(positions[0]>>>32);
        length = (int)(positions[nameLength - 1] & 0xFFFFFFFF) - sourceStart + 1;
        final Name qualifiedName = this.setQualifiedNameNameAndSourceRanges(name, positions, typeReference);
        final SimpleType simpleType = new SimpleType(this.ast);
        simpleType.setName(qualifiedName);
        type = simpleType;
        type.setSourceRange(sourceStart, length);
      } else {
        TypeReference[] typeReferences = ((org.eclipse.jdt.internal.compiler.ast.UnionTypeReference) typeReference).typeReferences;
        switch(this.ast.apiLevel) {
          case AST.JLS2_INTERNAL :
          case AST.JLS3 :
            // recovery
            type = this.convertType(typeReferences[0]);
            int start = typeReference.sourceStart;
            int endPosition = typeReference.sourceEnd;
            length = endPosition - start + 1;
            type.setSourceRange(start, length);
            type.setFlags(type.getFlags() | ASTNode.MALFORMED);
            break;
          default:
            // union type reference
            final UnionType unionType = new UnionType(this.ast);
            for (int i = 0, max = typeReferences.length; i < max; i++) {
              unionType.types().add(this.convertType(typeReferences[i]));
            }
            type = unionType;
            List types = unionType.types();
            int size = types.size();
            start = ((Type) types.get(0)).getStartPosition();
            Type lastType = (Type) types.get(size - 1);
            endPosition = lastType.getStartPosition() + lastType.getLength();
            length = endPosition - start; /* + 1 - 1 == 0 */
            type.setSourceRange(start, length);
        }
      }

      length = typeReference.sourceEnd - sourceStart + 1;
      if (dimensions != 0) {
        type = this.ast.newArrayType(type, dimensions);
        if (this.resolveBindings) {
          completeRecord((ArrayType) type, typeReference);
        }
        int end = retrieveEndOfDimensionsPosition(sourceStart+length, this.compilationUnitSourceLength);
        if (end != -1) {
          type.setSourceRange(sourceStart, end - sourceStart + 1);
        } else {
          type.setSourceRange(sourceStart, length);
        }
        ArrayType subarrayType = (ArrayType) type;
        int index = dimensions - 1;
        while (index > 0) {
          subarrayType = (ArrayType) subarrayType.getComponentType();
          end = retrieveProperRightBracketPosition(index, sourceStart);
          subarrayType.setSourceRange(sourceStart, end - sourceStart + 1);
          index--;
        }
      }
    }
    if (this.resolveBindings) {
      this.recordNodes(type, typeReference);
    }
    boolean sawDiamond = false;
    if (typeReference instanceof ParameterizedSingleTypeReference) {
      ParameterizedSingleTypeReference pstr = (ParameterizedSingleTypeReference) typeReference;
      if (pstr.typeArguments == TypeReference.NO_TYPE_ARGUMENTS) {
        sawDiamond = true;
      }
    } else if (typeReference instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference pqtr = (ParameterizedQualifiedTypeReference) typeReference;
      for (int i = 0, len = pqtr.typeArguments.length; i < len; i++) {
        if (pqtr.typeArguments[i] == TypeReference.NO_TYPE_ARGUMENTS) {
          sawDiamond = true;
          break;
        }
View Full Code Here

    if (node != null) {
      if (node instanceof Receiver) {
        node = ((Receiver) node).type;
      }
      if (node instanceof ParameterizedQualifiedTypeReference) {
         ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) node;
        org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = typeReference.resolvedType;
        // This unlikely case is possible when for some reason binding resolution has been stopped, like duplicate type declaration (bug 376440)
        if (typeBinding == null) return null;
        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()) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference

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.