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

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


      TreeLogger cudLogger = logger.branch(TreeLogger.SPAM,
          "Processing types in compilation unit: " + unit.getDisplayLocation());
      Set<CompiledClass> compiledClasses = unit.getCompiledClasses();
      for (CompiledClass compiledClass : compiledClasses) {
        if (unresolvedTypes.remove(compiledClass.getRealClassType())) {
          TypeDeclaration typeDeclaration = compiledClass.getTypeDeclaration();
          if (!resolveTypeDeclaration(cudLogger, typeDeclaration)) {
            logger.log(TreeLogger.WARN,
                "Unexpectedly unable to fully resolve type "
                    + compiledClass.getSourceName());
          }
View Full Code Here


   * TypeParameters (i.e, it is a generic type or method), then the
   * TypeParameters are mapped into JTypeParameters.
   */
  private JRealClassType createType(CompiledClass compiledClass,
      JRealClassType enclosingType) {
    TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
    SourceTypeBinding binding = typeDecl.binding;
    assert (binding.constantPoolName() != null);

    String qname = compiledClass.getSourceName();
    String className = Shared.getShortName(qname);
View Full Code Here

   * TODO: log real errors, replacing GenerateJavaScriptAST?
   */
  private static List<JsniMethod> collectJsniMethods(TreeLogger logger,
      String loc, SourceCache sourceCache, CompiledClass compiledClass,
      JsProgram program) {
    TypeDeclaration typeDecl = compiledClass.getTypeDeclaration();
    int[] lineEnds = typeDecl.compilationResult.getLineSeparatorPositions();
    List<JsniMethod> jsniMethods = new ArrayList<JsniMethod>();
    String enclosingType = InternalName.toBinaryName(compiledClass.getInternalName());
    AbstractMethodDeclaration[] methods = typeDecl.methods;
    if (methods != null) {
View Full Code Here

       * Ensure that every interfaces has exactly zero or one JSO subtype that
       * implements it.
       */
      Map<String, TypeDeclaration> singleImplementations = new HashMap<String, TypeDeclaration>();
      for (Map.Entry<TypeDeclaration, Set<String>> entry : jsoImplsToInterfaces.entrySet()) {
        TypeDeclaration node = entry.getKey();
        for (String intfName : entry.getValue()) {

          if (!singleImplementations.containsKey(intfName)) {
            singleImplementations.put(intfName, node);
          } else {
            /*
             * Emit an error if the previously-defined type is neither a
             * supertype nor subtype of the current type
             */
            TypeDeclaration previous = singleImplementations.get(intfName);
            if (!(hasSupertypeNamed(node, previous.binding.compoundName) || hasSupertypeNamed(
                previous, node.binding.compoundName))) {
              String nodeName = CharOperation.toString(node.binding.compoundName);
              String previousName = CharOperation.toString(previous.binding.compoundName);

View Full Code Here

        }
      }

      // Loop over all TypeDeclarations that we have
      for (Iterator<TypeDeclaration> it = nodesToCuds.keySet().iterator(); it.hasNext();) {
        TypeDeclaration decl = it.next();

        // Remove the TypeDeclaration if it's not in the list of retained types
        if (!retainedTypeNames.contains(CharOperation.toString(decl.binding.compoundName))) {
          it.remove();
View Full Code Here

      ReferenceContext referenceContext = scope.referenceContext();
      if (referenceContext instanceof AbstractMethodDeclaration) {
        // completion is inside a method body
        searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc);
      } else if (referenceContext instanceof TypeDeclaration) {
        TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;
        FieldDeclaration[] fields = typeDeclaration.fields;
        if (fields != null) {
          done : for (int i = 0; i < fields.length; i++) {
            if (fields[i] instanceof Initializer) {
              Initializer initializer = (Initializer) fields[i];
View Full Code Here

    if (referenceContext instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) referenceContext;
      parent = this.getJavaElementOfCompilationUnit(methodDeclaration, methodDeclaration.binding);
    } else if (referenceContext instanceof TypeDeclaration){
      // Local variable is declared inside an initializer
      TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext;

      JavaElement type = this.getJavaElementOfCompilationUnit(typeDeclaration, typeDeclaration.binding);
      parent = Util.getUnresolvedJavaElement(local.sourceStart, local.sourceEnd, type);
    }
    if (parent == null) return null;
View Full Code Here

  if (this.anonymousTypes != null) {
    if(this.fieldDeclaration.initialization == null) {
      for (int i = 0; i < this.anonymousTypeCount; i++){
        RecoveredType recoveredType = this.anonymousTypes[i];
        TypeDeclaration typeDeclaration = recoveredType.typeDeclaration;
        if(typeDeclaration.declarationSourceEnd == 0) {
          typeDeclaration.declarationSourceEnd = this.fieldDeclaration.declarationSourceEnd;
          typeDeclaration.bodyEnd = this.fieldDeclaration.declarationSourceEnd;
        }
        if (recoveredType.preserveContent){
          TypeDeclaration anonymousType = recoveredType.updatedTypeDeclaration(depth + 1, knownTypes);
          if (anonymousType != null) {
            this.fieldDeclaration.initialization = anonymousType.allocation;
            int end = anonymousType.declarationSourceEnd;
            if (end > this.fieldDeclaration.declarationSourceEnd) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=307337
              this.fieldDeclaration.declarationSourceEnd = end;
              this.fieldDeclaration.declarationEnd = end;
            }
          }
        }
      }
      if (this.anonymousTypeCount > 0) this.fieldDeclaration.bits |= ASTNode.HasLocalType;
    } else if(this.fieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {
      // fieldDeclaration is an enum constant
      for (int i = 0; i < this.anonymousTypeCount; i++){
        RecoveredType recoveredType = this.anonymousTypes[i];
        TypeDeclaration typeDeclaration = recoveredType.typeDeclaration;
        if(typeDeclaration.declarationSourceEnd == 0) {
          typeDeclaration.declarationSourceEnd = this.fieldDeclaration.declarationSourceEnd;
          typeDeclaration.bodyEnd = this.fieldDeclaration.declarationSourceEnd;
        }
        // if the enum is recovered then enum constants must be recovered too.
View Full Code Here

      lastMemberEnd = lastMethod.declarationSourceEnd;
    }
  }

  if (this.memberTypeCount > 0) {
    TypeDeclaration lastType = this.memberTypes[this.memberTypeCount - 1].typeDeclaration;
    if (lastMemberEnd < lastType.declarationSourceEnd && lastType.declarationSourceEnd != 0) {
      lastMemberEnd = lastType.declarationSourceEnd;
    }
  }
View Full Code Here

  // ignore closed anonymous type
  if ((this.typeDeclaration.bits & ASTNode.IsAnonymousType) != 0 && !this.preserveContent){
    return null;
  }

  TypeDeclaration updatedType = updatedTypeDeclaration(depth + 1, knownTypes);
  if (updatedType != null && (updatedType.bits & ASTNode.IsAnonymousType) != 0){
    /* in presence of an anonymous type, we want the full allocation expression */
    QualifiedAllocationExpression allocation = updatedType.allocation;

    if (allocation.statementEnd == -1) {
View Full Code Here

TOP

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

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.