Exemple #1
0
  public static boolean isClinit(JMethod method) {
    JDeclaredType enclosingType = method.getEnclosingType();

    boolean isClinit = enclosingType != null && method == enclosingType.getClinitMethod();
    assert !isClinit || method.getName().equals(GwtAstBuilder.CLINIT_NAME);
    return isClinit;
  }
 private <T extends Annotation> T findAnnotationOnMethodOrEnclosingType(
     final JMethod method, final Class<T> annotationType) {
   T annotation = method.getAnnotation(annotationType);
   if (annotation == null) {
     annotation = method.getEnclosingType().getAnnotation(annotationType);
   }
   return annotation;
 }
Exemple #3
0
 /** Adds a method to this type. */
 public final void addMethod(JMethod method) {
   assert method.getEnclosingType() == this;
   assert !method.getName().equals("$clinit") || getMethods().size() == 0
       : "Attempted adding " + "$clinit method with index != 0";
   assert !method.getName().equals("$init") || getMethods().size() == 1
       : "Attempted adding $init " + "method with index != 1";
   methods = Lists.add(methods, method);
 }
Exemple #4
0
 public static boolean isClinit(JMethod method) {
   JDeclaredType enclosingType = method.getEnclosingType();
   if ((enclosingType != null) && (method == enclosingType.getClinitMethod())) {
     assert (method.getName().equals("$clinit"));
     return true;
   } else {
     return false;
   }
 }
Exemple #5
0
  public static boolean isInit(JMethod method) {
    JDeclaredType enclosingType = method.getEnclosingType();

    if (method.isStatic()) {
      // Hack, check the name.
      return method.getName().equals(GwtAstBuilder.STATIC_INIT_NAME);
    }

    boolean isInit = enclosingType != null && method == enclosingType.getInitMethod();
    assert !isInit || method.getName().equals(GwtAstBuilder.INIT_NAME);
    return isInit;
  }
Exemple #6
0
 public static String getFullName(JMethod method) {
   return method.getEnclosingType().getName() + "." + method.getJsniSignature(false, true);
 }
Exemple #7
0
 public JMethod getStaticImpl(JMethod method) {
   JMethod staticImpl = instanceToStaticMap.get(method);
   assert staticImpl == null || staticImpl.getEnclosingType().getMethods().contains(staticImpl);
   return staticImpl;
 }
Exemple #8
0
 public static String getFullName(JMethod method) {
   return method.getEnclosingType().getName() + "." + getJsniSig(method);
 }