src/share/classes/com/sun/tools/classfile/Type.java
Print this page
@@ -61,10 +61,11 @@
public interface Visitor<R,P> {
R visitSimpleType(SimpleType type, P p);
R visitArrayType(ArrayType type, P p);
R visitMethodType(MethodType type, P p);
+ R visitFunctionType(FunctionType type, P p);
R visitClassSigType(ClassSigType type, P p);
R visitClassType(ClassType type, P p);
R visitTypeParamType(TypeParamType type, P p);
R visitWildcardType(WildcardType type, P p);
}
@@ -177,10 +178,41 @@
public final Type returnType;
public final List<? extends Type> throwsTypes;
}
/**
+ * Represents a method type signature.
+ *
+ * See;
+ * JVMS ???
+ * FunctionTypeSignature:
+ * {@code #} ReturnType {@code (} TypeSignature* {@code)}
+ */
+ public static class FunctionType extends Type {
+ public FunctionType(Type returnType,
+ List<? extends Type> parameterTypes) {
+ this.returnType = returnType;
+ this.parameterTypes = parameterTypes;
+ }
+
+ public <R, D> R accept(Visitor<R, D> visitor, D data) {
+ return visitor.visitFunctionType(this, data);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append('#').append(returnType);
+ append(sb, "(", parameterTypes, ")");
+ return sb.toString();
+ }
+
+ public final List<? extends Type> parameterTypes;
+ public final Type returnType;
+ }
+
+ /**
* Represents a class signature. These describe the signature of
* a class that has type arguments.
*
* See:
* JVMS 4.3.4