< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Signature.java

Print this page




  67      * Gets the return type of this signature.
  68      *
  69      * @param accessingClass the context of the type lookup. If non-null, its class loader is used
  70      *            for resolving the type. If {@code null}, then the type returned is either
  71      *            unresolved or a resolved type whose resolution is context free (e.g., a primitive
  72      *            type or a type in a java.* package).
  73      * @return the return type
  74      * @throws LinkageError if {@code accessingClass != null} and resolution fails
  75      */
  76     JavaType getReturnType(ResolvedJavaType accessingClass);
  77 
  78     /**
  79      * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}.
  80      * {@link JavaType#getJavaKind getJavaKind}.
  81      */
  82     default JavaKind getReturnKind() {
  83         return getReturnType(null).getJavaKind();
  84     }
  85 
  86     /**
  87      * Gets the <a
  88      * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
  89      * descriptor</a> corresponding to this signature. For example:
  90      *
  91      * <pre>
  92      * (ILjava/lang/String;D)V
  93      * </pre>
  94      *
  95      * @return the signature as a string
  96      */
  97     default String toMethodDescriptor() {
  98         StringBuilder sb = new StringBuilder("(");
  99         for (int i = 0; i < getParameterCount(false); ++i) {
 100             sb.append(getParameterType(i, null).getName());
 101         }
 102         sb.append(')').append(getReturnType(null).getName());
 103         return sb.toString();
 104     }
 105 
 106     default JavaType[] toParameterTypes(JavaType receiverType) {
 107         int args = getParameterCount(false);
 108         JavaType[] result;




  67      * Gets the return type of this signature.
  68      *
  69      * @param accessingClass the context of the type lookup. If non-null, its class loader is used
  70      *            for resolving the type. If {@code null}, then the type returned is either
  71      *            unresolved or a resolved type whose resolution is context free (e.g., a primitive
  72      *            type or a type in a java.* package).
  73      * @return the return type
  74      * @throws LinkageError if {@code accessingClass != null} and resolution fails
  75      */
  76     JavaType getReturnType(ResolvedJavaType accessingClass);
  77 
  78     /**
  79      * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}.
  80      * {@link JavaType#getJavaKind getJavaKind}.
  81      */
  82     default JavaKind getReturnKind() {
  83         return getReturnType(null).getJavaKind();
  84     }
  85 
  86     /**
  87      * Gets the
  88      * <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
  89      * descriptor</a> corresponding to this signature. For example:
  90      *
  91      * <pre>
  92      * (ILjava/lang/String;D)V
  93      * </pre>
  94      *
  95      * @return the signature as a string
  96      */
  97     default String toMethodDescriptor() {
  98         StringBuilder sb = new StringBuilder("(");
  99         for (int i = 0; i < getParameterCount(false); ++i) {
 100             sb.append(getParameterType(i, null).getName());
 101         }
 102         sb.append(')').append(getReturnType(null).getName());
 103         return sb.toString();
 104     }
 105 
 106     default JavaType[] toParameterTypes(JavaType receiverType) {
 107         int args = getParameterCount(false);
 108         JavaType[] result;


< prev index next >