Examples of JRealClassType


Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

    }

    if (binding instanceof BinaryTypeBinding) {
      // Try a binary lookup.
      String binaryName = String.valueOf(binding.constantPoolName());
      JRealClassType realClassType = binaryMapper.get(binaryName);
      if (realClassType != null) {
        return realClassType;
      }
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

    if (isPackageInfoTypeName(qname)) {
      return resolvePackage(logger, clazz);
    }

    // Just resolve the type.
    JRealClassType jtype = (JRealClassType) resolveType(logger, binding);
    if (jtype == null) {
      // Failed to resolve.
      //
      return false;
    }

    /*
     * Modifiers were added during processType since getParameterizedType
     * depends on them being set.
     */

    // Try to resolve annotations, ignore any that fail.
    Map<Class<? extends java.lang.annotation.Annotation>, java.lang.annotation.Annotation> declaredAnnotations = newAnnotationMap();
    resolveAnnotations(logger, clazz.annotations, declaredAnnotations);
    jtype.addAnnotations(declaredAnnotations);

    // Resolve bounds for type parameters on generic types. Note that this
    // step does not apply to type parameters on generic methods; that
    // occurs during the method resolution stage.
    JGenericType jGenericType = jtype.isGenericType();
    if (jGenericType != null
        && !resolveBoundsForTypeParameters(logger, jtype.isGenericType(),
            clazz.typeParameters)) {
      // Failed to resolve
      return false;
    }

    // Resolve superclass (for classes only).
    //
    if (jtype.isInterface() == null) {
      ReferenceBinding superclassRef = binding.superclass;
      assert superclassRef != null
          || "java.lang.Object".equals(jtype.getQualifiedSourceName());
      if (superclassRef != null) {
        JClassType jsuperClass = (JClassType) resolveType(logger, superclassRef);
        assert jsuperClass != null;
        jtype.setSuperclass(jsuperClass);
      }
    }

    // Resolve superinterfaces.
    //
    ReferenceBinding[] superintfRefs = binding.superInterfaces;
    for (int i = 0; i < superintfRefs.length; i++) {
      ReferenceBinding superintfRef = superintfRefs[i];
      JClassType jinterface = (JClassType) resolveType(logger, superintfRef);
      if (jinterface == null) {
        // Failed to resolve.
        //
        return false;
      }
      jtype.addImplementedInterface(jinterface);
    }

    // Resolve fields.
    //
    FieldDeclaration[] fields = clazz.fields;
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

      if (!unit.isCompiled()) {
        continue;
      }
      Set<CompiledClass> compiledClasses = unit.getCompiledClasses();
      for (CompiledClass compiledClass : compiledClasses) {
        JRealClassType type = compiledClass.getRealClassType();
        if (type == null) {
          type = createType(compiledClass);
        }
        binaryMapper.put(compiledClass.getBinaryName(), type);
      }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

    return AnnotationProxyFactory.create(clazz, identifierToValue);
  }

  private JRealClassType createType(CompiledClass compiledClass) {
    JRealClassType realClassType = compiledClass.getRealClassType();
    if (realClassType == null) {
      JRealClassType enclosingType = null;
      CompiledClass enclosingClass = compiledClass.getEnclosingClass();
      if (enclosingClass != null) {
        enclosingType = enclosingClass.getRealClassType();
        if (enclosingType == null) {
          enclosingType = createType(enclosingClass);
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

    JPackage pkg = typeOracle.getOrCreatePackage(jpkgName);
    boolean isLocalType = binding instanceof LocalTypeBinding;
    boolean isIntf = TypeDeclaration.kind(typeDecl.modifiers) == TypeDeclaration.INTERFACE_DECL;
    boolean isAnnotation = TypeDeclaration.kind(typeDecl.modifiers) == TypeDeclaration.ANNOTATION_TYPE_DECL;

    JRealClassType resultType;
    if (isAnnotation) {
      resultType = new JAnnotationType(typeOracle, pkg, enclosingType,
          isLocalType, className, isIntf);
    } else if (maybeGeneric(typeDecl, enclosingType)) {
      // Go through and create declarations for each of the type parameters on
      // the generic class or method
      JTypeParameter[] jtypeParameters = declareTypeParameters(typeDecl.typeParameters);

      JGenericType jgenericType = new JGenericType(typeOracle, pkg,
          enclosingType, isLocalType, className, isIntf, jtypeParameters);

      resultType = jgenericType;
    } else if (binding.isEnum()) {
      resultType = new JEnumType(typeOracle, pkg, enclosingType, isLocalType,
          className, isIntf);
    } else {
      resultType = new JRealClassType(typeOracle, pkg, enclosingType,
          isLocalType, className, isIntf);
    }

    /*
     * Declare type parameters for all methods; we must do this during the first
     * pass.
     */
    if (typeDecl.methods != null) {
      for (AbstractMethodDeclaration method : typeDecl.methods) {
        declareTypeParameters(method.typeParameters());
      }
    }

    /*
     * Add modifiers since these are needed for
     * TypeOracle.getParameterizedType's error checking code.
     */
    resultType.addModifierBits(Shared.bindingToModifierBits(binding));
    return resultType;
  }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

    }

    if (binding instanceof BinaryTypeBinding) {
      // Try a binary lookup.
      String binaryName = String.valueOf(binding.constantPoolName());
      JRealClassType realClassType = binaryMapper.get(binaryName);
      if (realClassType != null) {
        return realClassType;
      }
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

    if (isPackageInfoTypeName(qname)) {
      return resolvePackage(logger, clazz);
    }

    // Just resolve the type.
    JRealClassType jtype = (JRealClassType) resolveType(logger, binding);
    if (jtype == null) {
      // Failed to resolve.
      //
      return false;
    }

    /*
     * Modifiers were added during processType since getParameterizedType
     * depends on them being set.
     */

    // Try to resolve annotations, ignore any that fail.
    Map<Class<? extends java.lang.annotation.Annotation>, java.lang.annotation.Annotation> declaredAnnotations = newAnnotationMap();
    resolveAnnotations(logger, clazz.annotations, declaredAnnotations);
    jtype.addAnnotations(declaredAnnotations);

    // Resolve bounds for type parameters on generic types. Note that this
    // step does not apply to type parameters on generic methods; that
    // occurs during the method resolution stage.
    JGenericType jGenericType = jtype.isGenericType();
    if (jGenericType != null
        && !resolveBoundsForTypeParameters(logger, jtype.isGenericType(),
            clazz.typeParameters)) {
      // Failed to resolve
      return false;
    }

    // Resolve superclass (for classes only).
    //
    if (jtype.isInterface() == null) {
      ReferenceBinding superclassRef = binding.superclass;
      assert superclassRef != null
          || "java.lang.Object".equals(jtype.getQualifiedSourceName());
      if (superclassRef != null) {
        JClassType jsuperClass = (JClassType) resolveType(logger, superclassRef);
        assert jsuperClass != null;
        jtype.setSuperclass(jsuperClass);
      }
    }

    // Resolve superinterfaces.
    //
    ReferenceBinding[] superintfRefs = binding.superInterfaces;
    for (int i = 0; i < superintfRefs.length; i++) {
      ReferenceBinding superintfRef = superintfRefs[i];
      JClassType jinterface = (JClassType) resolveType(logger, superintfRef);
      if (jinterface == null) {
        // Failed to resolve.
        //
        return false;
      }
      jtype.addImplementedInterface(jinterface);
    }

    // Resolve fields.
    //
    FieldDeclaration[] fields = clazz.fields;
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

  @Override
  public void visitClassType(String internalName) {
    assert Name.isInternalName(internalName);
    outerClass = enclosingClass;
    JRealClassType classType = binaryMapper.get(internalName);
    // TODO(jat): failures here are likely binary-only annotations or local
    // classes that have been elided from TypeOracle -- what should we do in
    // those cases?  Currently we log an error and replace them with Object,
    // but we may can do something better.
    boolean resolveSuccess = classType == null ? false
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

        CollectClassData cv = classMap.get(internalName);
        if (cv == null) {
          // ignore classes that were skipped earlier
          continue;
        }
        JRealClassType type = createType(compiledClass, unresolvedTypes);
        if (type != null) {
          allMethodArgs.mergeFrom(unit.getMethodArgs());
          binaryMapper.put(internalName, type);
          classMapType.put(type, cv);
        }
      }
    }
    identityEvent.end();

    Event resolveEnclosingEvent = SpeedTracerLogger.start(CompilerEventType.TYPE_ORACLE_MEDIATOR, "phase", "Resolve Enclosing Classes");
    // Hook up enclosing types
    TreeLogger branch = logger.branch(TreeLogger.SPAM,
        "Resolving enclosing classes");
    for (Iterator<JRealClassType> it = unresolvedTypes.iterator(); it.hasNext();) {
      JRealClassType type = it.next();
      if (!resolveEnclosingClass(branch, type)) {
        // already logged why it failed, don't try and use it further
        it.remove();
      }
    }
    resolveEnclosingEvent.end();

    Event resolveUnresolvedEvent = SpeedTracerLogger.start(CompilerEventType.TYPE_ORACLE_MEDIATOR, "phase", "Resolve Unresolved Types");
    // Resolve unresolved types.
    for (JRealClassType type : unresolvedTypes) {
      branch = logger.branch(TreeLogger.SPAM, "Resolving "
          + type.getQualifiedSourceName());
      if (!resolveClass(branch, type)) {
        // already logged why it failed
        // TODO: should we do anything else here?
      }
    }
View Full Code Here

Examples of com.google.gwt.core.ext.typeinfo.JRealClassType

  private JRealClassType createType(CompiledClass compiledClass,
      CollectClassData classData, CollectClassData enclosingClassData) {
    int access = classData.getAccess();
    String qname = compiledClass.getSourceName();
    String className = Shared.getShortName(qname);
    JRealClassType resultType = null;
    String jpkgName = compiledClass.getPackageName();
    JPackage pkg = typeOracle.getOrCreatePackage(jpkgName);
    boolean isIntf = (access & Opcodes.ACC_INTERFACE) != 0;
    assert !classData.hasNoExternalName();
    String enclosingTypeName = null;
    if (enclosingClassData != null) {
      enclosingTypeName = InternalName.toSourceName(InternalName.getClassName(enclosingClassData.getName()));
    }
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
      resultType = newAnnotationType(pkg, enclosingTypeName, className);
    } else if ((access & Opcodes.ACC_ENUM) != 0) {
      resultType = newEnumType(pkg, enclosingTypeName, className);
    } else {
      JTypeParameter[] typeParams = getTypeParametersForClass(classData);
      if ((typeParams != null && typeParams.length > 0)
          || nonStaticInsideGeneric(classData, enclosingClassData)) {
        resultType = new JGenericType(typeOracle, pkg, enclosingTypeName,
            className, isIntf, typeParams);
      } else {
        resultType = newRealClassType(pkg, enclosingTypeName, className,
            isIntf);
      }
    }

    /*
     * Declare type parameters for all methods; we must do this during the first
     * pass.
     */
    // if (typeDecl.methods != null) {
    // for (AbstractMethodDeclaration method : typeDecl.methods) {
    // declareTypeParameters(method.typeParameters());
    // }
    // }
    /*
     * Add modifiers since these are needed for
     * TypeOracle.getParameterizedType's error checking code.
     */
    resultType.addModifierBits(mapBits(ASM_TO_SHARED_MODIFIERS, access));
    if (isIntf) {
      // Always add implicit modifiers on interfaces.
      resultType.addModifierBits(Shared.MOD_STATIC | Shared.MOD_ABSTRACT);
    }

    return resultType;
  }
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.