Example #1
0
  private static void setJsInteropPropertiesNew(
      JMember member, Annotation[] annotations, AnnotationBinding memberAnnotation) {
    if (getInteropAnnotation(annotations, "JsIgnore") != null) {
      return;
    }

    boolean isPublicMemberForJsType = member.getEnclosingType().isJsType() && member.isPublic();
    if (!isPublicMemberForJsType && !isNativeConstructor(member) && memberAnnotation == null) {
      return;
    }

    String namespace = JdtUtil.getAnnotationParameterString(memberAnnotation, "namespace");
    String name = JdtUtil.getAnnotationParameterString(memberAnnotation, "name");
    member.setJsMemberInfo(namespace, name == null ? computeName(member) : name, true);
  }
Example #2
0
  private static void setJsInteropProperties(JMember member, Annotation... annotations) {
    String namespace = maybeGetJsNamespace(annotations);
    String exportName = maybeGetJsExportName(annotations, computeName(member));
    member.setJsMemberInfo(namespace, exportName, exportName != null);

    /* Apply class wide JsInterop annotations */

    boolean ignore = JdtUtil.getAnnotation(annotations, JSNOEXPORT_CLASS) != null;
    if (ignore || (!member.isPublic() && !isNativeConstructor(member)) || exportName != null) {
      return;
    }

    JDeclaredType enclosingType = member.getEnclosingType();

    if (enclosingType.isJsType() && member.needsDynamicDispatch()) {
      member.setJsMemberInfo(namespace, computeName(member), true);
    }

    if (enclosingType.isClassWideExport() && !member.needsDynamicDispatch()) {
      member.setJsMemberInfo(namespace, computeName(member), true);
    }
  }