Examples of JMethod


Examples of com.caucho.bytecode.JMethod

    return;
  }
  else if (! ref.getName().equals("<init>")) {
    // private methods are called with invokespecial, but shouldn't
    // be modified
    JMethod method = findMethod(jClass,
              ref.getName(),
              ref.getType());

    if (method != null && method.isPrivate())
      return;
  }

  String superName;
        if (ref.getName().equals("<init>"))
View Full Code Here

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

   * @param extendsEnumPref a subtype of EnumPreference
   * @return the type of enumeration returned by the preference
   */
  static JEnumType getEnumType(JClassType extendsEnumPref) {
    while (extendsEnumPref != null) {
      JMethod m = extendsEnumPref.findMethod("getValue", new JType[0]);
      if (m == null) {
        extendsEnumPref = extendsEnumPref.getSuperclass();
        continue;
      }
      return m.getReturnType().isEnum();
    }
    return null;
  }
View Full Code Here

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

      logger.log(TreeLogger.ERROR,
          "A Feature interface must define exactly one method", null);
      throw new UnableToCompleteException();
    }

    JMethod m = methods[0];
    JParameter[] params = m.getParameters();

    if (params.length != 1) {
      logger.log(TreeLogger.ERROR, m.getName()
          + " must have exactly one parameter", null);
      throw new UnableToCompleteException();
    }

    JClassType paramType = params[0].getType().isClass();
    JClassType gadgetFeatureType = typeOracle.findType(GadgetFeature.class.getName());
    assert gadgetFeatureType != null;

    if (paramType == null || paramType.isAbstract()) {
      logger.log(TreeLogger.ERROR, "The parameter " + params[0].getName()
          + " must be a concrete class", null);
      throw new UnableToCompleteException();

    } else if (!gadgetFeatureType.isAssignableFrom(paramType)) {
      logger.log(TreeLogger.ERROR, "The parameter " + params[0].getName()
          + " must be assignable to GadgetFeature", null);
      throw new UnableToCompleteException();

    } else {
      try {
        paramType.getConstructor(new JType[0]);
      } catch (NotFoundException e) {
        logger.log(TreeLogger.ERROR,
            "The parameter type must have a zero-arg constructor", e);
        throw new UnableToCompleteException();
      }
    }

    sw.println("this.@" + gadgetType.getQualifiedSourceName() + "::"
        + m.getName() + "(" + paramType.getJNISignature() + ")(@"
        + paramType.getQualifiedSourceName() + "::new()());");
  }
View Full Code Here

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

    } else if (methods.length == 1) {
      return methods[0];
    }

    try {
      JMethod toReturn = null;
      for (JMethod method : methods) {
        if (JSWrapperGenerator.hasTag(logger, method, Exported.class) != null) {
          if (toReturn == null) {
            toReturn = method;
          } else {
View Full Code Here

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

    JClassType asClass = type.isClassOrInterface();
    if (asClass == null) {
      return null;
    }

    JMethod m = asClass.findMethod(JSFlyweightWrapperGenerator.CREATE_PEER,
        new JType[] {oracle.findType(JavaScriptObject.class.getName())});

    if (m == null || !m.isStatic() || !type.equals(m.getReturnType())) {
      return null;
    }

    return m;
  }
View Full Code Here

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

public class StateInitVisitor extends TypeVisitor {
    @Override
    public void visitConnector(TreeLogger logger, JClassType type,
            ConnectorBundle bundle) {
        JMethod getState = ConnectorBundle
                .findInheritedMethod(type, "getState");
        bundle.setNeedsReturnType(type, getState);

        bundle.setNeedsSerialize(getState.getReturnType());

        JType stateType = getState.getReturnType();
        bundle.setNeedsGwtConstructor(stateType.isClass());
    }
View Full Code Here

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

        if (ConnectorBundle.isConnectedComponentConnector(type)) {
            // The class in which createWidget is implemented
            JClassType createWidgetClass = ConnectorBundle.findInheritedMethod(
                    type, "createWidget").getEnclosingType();

            JMethod getWidget = ConnectorBundle.findInheritedMethod(type,
                    "getWidget");
            JClassType widgetType = getWidget.getReturnType().isClass();

            // Needs GWT constructor if createWidget is not overridden
            if (createWidgetClass.getQualifiedSourceName().equals(
                    AbstractComponentConnector.class.getCanonicalName())) {
                bundle.setNeedsGwtConstructor(widgetType);

                // Also needs widget type to find the right GWT constructor
                bundle.setNeedsReturnType(type, getWidget);
            }

            // Check state properties for @DelegateToWidget
            JMethod getState = ConnectorBundle.findInheritedMethod(type,
                    "getState");
            JClassType stateType = getState.getReturnType().isClass();

            Collection<Property> properties = bundle.getProperties(stateType);
            for (Property property : properties) {
                DelegateToWidget delegateToWidget = property
                        .getAnnotation(DelegateToWidget.class);
                if (delegateToWidget != null) {
                    // Generate meta data required for @DelegateToWidget
                    bundle.setNeedsDelegateToWidget(property, stateType);

                    // Find the delegate target method
                    String methodName = DelegateToWidget.Helper
                            .getDelegateTarget(property.getName(),
                                    delegateToWidget.value());
                    JMethod delegatedSetter = ConnectorBundle
                            .findInheritedMethod(widgetType, methodName,
                                    property.getPropertyType());
                    if (delegatedSetter == null) {
                        logger.log(
                                Type.ERROR,
View Full Code Here

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

        // Just test that the method exists
        serializerInterface.getMethod(deserializeMethodName,
                deserializeParamTypes);

        for (JClassType serializer : serializerInterface.getSubtypes()) {
            JMethod deserializeMethod = serializer.findMethod(
                    deserializeMethodName, deserializeParamTypes);
            if (deserializeMethod == null) {
                continue;
            }
            JType returnType = deserializeMethod.getReturnType();

            serializers.put(returnType, serializer);
        }
        return serializers;
    }
View Full Code Here

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

    public static JMethod findInheritedMethod(JClassType type,
            String methodName, JType... params) {

        JClassType currentType = type;
        while (currentType != null) {
            JMethod method = currentType.findMethod(methodName, params);
            if (method != null) {
                return method;
            }
            currentType = currentType.getSuperclass();
        }

        JClassType[] interfaces = type.getImplementedInterfaces();
        for (JClassType iface : interfaces) {
            JMethod method = iface.findMethod(methodName, params);
            if (method != null) {
                return method;
            }
        }
View Full Code Here

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

        logger.error("Cannot resolve member " + pathElement
            + " on non-reference type " + type.getQualifiedSourceName());
        return null;
      }

      JMethod m = findMethod(referenceType, pathElement);
      if (m == null) {
        logger.error("Could not find no-arg method named " + pathElement
            + " in type " + type.getQualifiedSourceName());
        return null;
      }

      type = m.getReturnType();
    }
    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.