Examples of JPrimitiveType


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

    return Long.toString(crc.getValue());
  }

  public String getSerializedTypeName(JType type) {
    JPrimitiveType primitiveType = type.isPrimitive();
    if (primitiveType != null) {
      return primitiveType.getJNISignature();
    }

    JArrayType arrayType = type.isArray();
    if (arrayType != null) {
      JType component = arrayType.getComponentType();
View Full Code Here

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

    if (arrayType == null) {
      return null;
    }

    JType componentType = arrayType.getComponentType();
    JPrimitiveType primitiveType = componentType.isPrimitive();
    String qualifiedSerializerName = DEFAULT_BUILTIN_CUSTOM_SERIALIZER_PACKAGE_NAME
        + ".";
    if (primitiveType != null) {
      qualifiedSerializerName += primitiveType.getSimpleSourceName();
    } else {
      qualifiedSerializerName += typeOracle.getJavaLangObject().getSimpleSourceName();
    }
    qualifiedSerializerName += "_Array_CustomFieldSerializer";
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

    if (type == exp.getType()) {
      return exp;
    }
    if ((type instanceof JPrimitiveType) && (exp instanceof JValueLiteral)) {
      // Statically evaluate casting literals.
      JPrimitiveType typePrim = (JPrimitiveType) type;
      JValueLiteral expLit = (JValueLiteral) exp;
      JValueLiteral casted = typePrim.coerceLiteral(expLit);
      if (casted != null) {
        return casted;
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

           * this value is not changed.
           */
          // TODO(spoon): use simplifier.cast to shorten this
          if ((x.getType() instanceof JPrimitiveType)
              && (lit instanceof JValueLiteral)) {
            JPrimitiveType xTypePrim = (JPrimitiveType) x.getType();
            lit = xTypePrim.coerceLiteral((JValueLiteral) lit);
          }
          return lit;
        }
      }
      return null;
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

        }
      }
    }

    private JExpression unbox(JExpression toUnbox, JClassType wrapperType) {
      JPrimitiveType primitiveType = getPrimitiveTypeForWrapperType(wrapperType);
      if (primitiveType == null) {
        throw new InternalCompilerException(toUnbox,
            "Attempt to unbox unexpected type '" + wrapperType.getName() + "'",
            null);
      }

      String valueMethodName = primitiveType.getName() + "Value";
      JMethod valueMethod = null;
      for (Object element : wrapperType.getMethods()) {
        JMethod method = (JMethod) element;
        if (method.getName().equals(valueMethodName)) {
          if (method.getParams().isEmpty()) {
            // It's a match!
            valueMethod = method;
            break;
          }
        }
      }

      if (valueMethod == null) {
        throw new InternalCompilerException(toUnbox,
            "Expected to find a method on '" + wrapperType.getName()
                + "' whose signature matches 'public "
                + primitiveType.getName() + " " + valueMethodName + "()'", null);
      }

      JMethodCall unboxCall = new JMethodCall(toUnbox.getSourceInfo(), toUnbox,
          valueMethod);
      return unboxCall;
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

      }
    }
  }

  private JPrimitiveType primitiveTypeForBoxClass(JClassType wrapperType) {
    JPrimitiveType primitiveType = boxClassToPrimitiveMap.get(wrapperType);
    if (primitiveType == null) {
      throw new IllegalArgumentException("Not a box class: " + wrapperType);
    }
    return primitiveType;
  }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

           * this value is not changed.
           */
          // TODO(spoon): use simplifier.cast to shorten this
          if ((x.getType() instanceof JPrimitiveType)
              && (lit instanceof JValueLiteral)) {
            JPrimitiveType xTypePrim = (JPrimitiveType) x.getType();
            lit = xTypePrim.coerceLiteral((JValueLiteral) lit);
          }
          return lit;
        }
      }
      return null;
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

        // Assume a long type.
        JType coerceTo = longType;

        // But double / float takes precedence over long.
        JPrimitiveType floatType = program.getTypePrimitiveFloat();
        JPrimitiveType doubleType = program.getTypePrimitiveDouble();
        // See if the lhs can coerce the rhs
        if ((lhsType == floatType || lhsType == doubleType)) {
          coerceTo = lhsType;
        }
        if (op.isAssignment()) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

    if (type == exp.getType()) {
      return exp;
    }
    if ((type instanceof JPrimitiveType) && (exp instanceof JValueLiteral)) {
      // Statically evaluate casting literals.
      JPrimitiveType typePrim = (JPrimitiveType) type;
      JValueLiteral expLit = (JValueLiteral) exp;
      JValueLiteral casted = typePrim.coerceLiteral(expLit);
      if (casted != null) {
        return casted;
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType

        }
      }
    }

    private JExpression unbox(JExpression toUnbox, JClassType wrapperType) {
      JPrimitiveType primitiveType = getPrimitiveTypeForWrapperType(wrapperType);
      if (primitiveType == null) {
        throw new InternalCompilerException(toUnbox,
            "Attempt to unbox unexpected type '" + wrapperType.getName() + "'",
            null);
      }

      String valueMethodName = primitiveType.getName() + "Value";
      JMethod valueMethod = null;
      for (Object element : wrapperType.getMethods()) {
        JMethod method = (JMethod) element;
        if (method.getName().equals(valueMethodName)) {
          if (method.getParams().isEmpty()) {
            // It's a match!
            valueMethod = method;
            break;
          }
        }
      }

      if (valueMethod == null) {
        throw new InternalCompilerException(toUnbox,
            "Expected to find a method on '" + wrapperType.getName()
                + "' whose signature matches 'public "
                + primitiveType.getName() + " " + valueMethodName + "()'", null);
      }

      JMethodCall unboxCall = new JMethodCall(toUnbox.getSourceInfo(), toUnbox,
          valueMethod);
      return unboxCall;
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.