Examples of JRealClassType


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

    if (typeWild != null) {
      endVisit(typeWild);
      return;
    }

    JRealClassType typeReal = (JRealClassType) type;
    endVisit(typeReal);
  }
View Full Code Here

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

    for (String sourceTypeName : typeSignatures.keySet()) {
      JClassType sourceType = oracle.findType(sourceTypeName);
      if (sourceType == null || !(sourceType instanceof JRealClassType)) {
        return false;
      }
      JRealClassType sourceRealType = (JRealClassType) sourceType;
     
      String signature = sourceRealType.getTypeStrongHash();
      if (!signature.equals(typeSignatures.get(sourceTypeName))) {
        return false;
      }
    }
   
View Full Code Here

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

      }
      Map<String, String> typeSignatures = new HashMap<String, String>();
      for (JClassType type : types) {
        String typeName = type.getQualifiedSourceName();
        if (type instanceof JRealClassType) {
          JRealClassType sourceRealType = (JRealClassType) type;
          String typeSignature = sourceRealType.getTypeStrongHash();
          typeSignatures.put(typeName, typeSignature);
        } else {
          typeSignatures.put(typeName, "");
        }
      }
View Full Code Here

Examples of com.google.gwt.dev.javac.typemodel.JRealClassType

  private JRealClassType createUnresolvedClass(Class<?> clazz,
      JRealClassType enclosingType) {
    String pkgName = clazz.getPackage().getName();
    JPackage pkg = oracle.getOrCreatePackage(pkgName);
    TypeVariable<?>[] typeParams = clazz.getTypeParameters();
    JRealClassType type;
    int n = typeParams.length;
    String enclosingTypeName = null;
    if (enclosingType != null) {
      enclosingTypeName = enclosingType.getName();
    }
View Full Code Here

Examples of com.google.gwt.dev.javac.typemodel.JRealClassType

  @Override
  public void visitClassType(String internalName) {
    assert Name.isInternalName(internalName);
    outerClass = enclosingClass;
    JRealClassType classType = resolver.findByInternalName(internalName);
    if (classType == null) {
      logger.log(TreeLogger.ERROR, "Unable to find class " + internalName);
      // Replace bound with Object if we can't find the class.
      returnTypeRef[0] = resolver.getTypeOracle().getJavaLangObject();
      return;
View Full Code Here

Examples of com.google.gwt.dev.javac.typemodel.JRealClassType

      }
      if (typesByInternalName.containsKey(classData.getInternalName())) {
        // skip classes that have been previously added
        continue;
      }
      JRealClassType type = createType(typeData, unresolvedTypes, context);
      if (type != null) {
        assert Name.isInternalName(typeData.internalName);
        typesByInternalName.put(typeData.internalName, type);
        context.classDataByType.put(type, classData);
      }
    }
    identityEvent.end();

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

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

Examples of com.google.gwt.dev.javac.typemodel.JRealClassType

   */
  private JRealClassType createType(
      TypeData typeData, CollectClassData collectClassData, CollectClassData enclosingClassData) {
    int access = collectClassData.getAccess();
    String simpleName = Shared.getShortName(typeData.sourceName);
    JRealClassType type = null;
    String packageName = typeData.packageName;
    JPackage pkg = typeOracle.getOrCreatePackage(packageName);
    boolean isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
    assert !collectClassData.hasNoExternalName();
    String enclosingSimpleName = null;
    if (enclosingClassData != null) {
      enclosingSimpleName = enclosingClassData.getNestedSourceName();
    }
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
      type = newAnnotationType(pkg, enclosingSimpleName, simpleName);
    } else if ((access & Opcodes.ACC_ENUM) != 0) {
      type = newEnumType(pkg, enclosingSimpleName, simpleName);
    } else {
      JTypeParameter[] typeParams = getTypeParametersForClass(collectClassData);
      if ((typeParams != null && typeParams.length > 0)
          || nonStaticInsideGeneric(collectClassData, enclosingClassData)) {
        type = new JGenericType(
            typeOracle, pkg, enclosingSimpleName, simpleName, isInterface, typeParams);
      } else {
        type = newRealClassType(pkg, enclosingSimpleName, simpleName, isInterface);
      }
    }

    type.addModifierBits(mapBits(ASM_TO_SHARED_MODIFIERS, access));
    if (isInterface) {
      // Always add implicit modifiers on interfaces.
      type.addModifierBits(Shared.MOD_STATIC | Shared.MOD_ABSTRACT);
    }
    type.addLastModifiedTime(typeData.lastModifiedTime);

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