Пример #1
0
 protected final String jniType(Type t) {
   String elmT = t.typeName();
   if (t.dimension().indexOf("[]") != -1) {
     if (elmT.equals("boolean")) return "jbooleanArray";
     else if (elmT.equals("byte")) return "jbyteArray";
     else if (elmT.equals("char")) return "jcharArray";
     else if (elmT.equals("short")) return "jshortArray";
     else if (elmT.equals("int")) return "jintArray";
     else if (elmT.equals("long")) return "jlongArray";
     else if (elmT.equals("float")) return "jfloatArray";
     else if (elmT.equals("double")) return "jdoubleArray";
     else if ((t.dimension().indexOf("[][]") != -1) || (t.asClassDoc() != null))
       return "jobjectArray";
   } else {
     if (elmT.equals("void")) return "void";
     else if (elmT.equals("boolean")) return "jboolean";
     else if (elmT.equals("byte")) return "jbyte";
     else if (elmT.equals("char")) return "jchar";
     else if (elmT.equals("short")) return "jshort";
     else if (elmT.equals("int")) return "jint";
     else if (elmT.equals("long")) return "jlong";
     else if (elmT.equals("float")) return "jfloat";
     else if (elmT.equals("double")) return "jdouble";
     else if (t.asClassDoc() != null) {
       if (elmT.equals("String")) return "jstring";
       else if (t.asClassDoc().subclassOf(root.classNamed("java.lang.Class"))) return "jclass";
       else return "jobject";
     }
   }
   Util.bug("jni.unknown.type");
   return null; /* dead code. */
 }
Пример #2
0
 protected String llniType(Type t, boolean handleize, boolean longDoubleOK) {
   String res = null;
   String elmt = t.typeName();
   if (t.dimension().indexOf("[]") != -1) {
     if ((t.dimension().indexOf("[][]") != -1) || (t.asClassDoc() != null)) res = "IArrayOfRef";
     else if (elmt.equals("boolean")) res = "IArrayOfBoolean";
     else if (elmt.equals("byte")) res = "IArrayOfByte";
     else if (elmt.equals("char")) res = "IArrayOfChar";
     else if (elmt.equals("int")) res = "IArrayOfInt";
     else if (elmt.equals("long")) res = "IArrayOfLong";
     else if (elmt.equals("float")) res = "IArrayOfFloat";
     else if (elmt.equals("double")) res = "IArrayOfDouble";
     if (!handleize) res = "DEREFERENCED_" + res;
   } else {
     if (elmt.equals("void")) res = "void";
     else if ((elmt.equals("boolean"))
         || (elmt.equals("byte"))
         || (elmt.equals("char"))
         || (elmt.equals("short"))
         || (elmt.equals("int"))) res = "java_int";
     else if (elmt.equals("long")) res = longDoubleOK ? "java_long" : "val32 /* java_long */";
     else if (elmt.equals("float")) res = "java_float";
     else if (elmt.equals("double"))
       res = res = longDoubleOK ? "java_double" : "val32 /* java_double */";
     else if (t.asClassDoc() != null) {
       res = "I" + mangleClassName(t.asClassDoc().qualifiedName());
       if (!handleize) res = "DEREFERENCED_" + res;
     }
   }
   return res;
 }
Пример #3
0
  /** {@inheritDoc} */
  public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) {
    Type returnType = ((MethodDoc) holder).returnType();
    Tag[] tags = holder.tags(name);

    // Make sure we are not using @return tag on method with void return type.
    if (returnType.isPrimitive() && returnType.typeName().equals("void")) {
      if (tags.length > 0) {
        writer.getMsgRetriever().warning(holder.position(), "doclet.Return_tag_on_void_method");
      }
      return null;
    }
    // Inherit @return tag if necessary.
    if (tags.length == 0) {
      DocFinder.Output inheritedDoc =
          DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
      tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
    }
    return tags.length > 0 ? writer.returnTagOutput(tags[0]) : null;
  }
Пример #4
0
  protected final String jniMethodName(MethodDoc method, String cname, boolean longName) {
    String res = "Java_" + cname + "_" + method.name();

    if (longName) {
      Type mType = method.returnType();
      Parameter[] params = method.parameters();
      Type argTypes[] = new Type[params.length];
      for (int p = 0; p < params.length; p++) {
        argTypes[p] = params[p].type();
      }

      res = res + "__";
      for (int i = 0; i < argTypes.length; i++) {
        Type t = argTypes[i];
        String tname = t.typeName();
        TypeSignature newTypeSig = new TypeSignature(root);
        String sig = newTypeSig.getTypeSignature(tname);
        res = res + nameToIdentifier(sig);
      }
    }
    return res;
  }
Пример #5
0
 protected final boolean isLongOrDouble(Type t) {
   String tc = t.typeName();
   return (tc.equals("long") || tc.equals("double"));
 }