/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* Family of classes used to represent the parsed form of a {@link Descriptor}
* or {@link Signature}.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
public abstract class Type {
protected Type() { }
public boolean isObject() {
return false;
}
protected static void append(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
sep = ", ";
}
}
protected static void appendIfNotEmpty(StringBuilder sb, String prefix, List<? extends Type> types, String suffix) {
}
public interface Visitor<R,P> {
}
/**
* Represents a type signature with a simple name. The name may be that of a
* primitive type, such "{@code int}, {@code float}, etc
* or that of a type argument, such as {@code T}, {@code K}, {@code V}, etc.
*
* See:
* JVMS 4.3.2
* BaseType:
* {@code B}, {@code C}, {@code D}, {@code F}, {@code I},
* {@code J}, {@code S}, {@code Z};
* VoidDescriptor:
* {@code V};
* JVMS 4.3.4
* TypeVariableSignature:
* {@code T} Identifier {@code ;}
*/
}
}
public boolean isPrimitiveType() {
}
// where
"boolean", "byte", "char", "double", "float", "int", "long", "short", "void"));
return name;
}
}
/**
* Represents an array type signature.
*
* See:
* JVMS 4.3.4
* ArrayTypeSignature:
* {@code [} TypeSignature {@code ]}
*/
}
}
return elemType + "[]";
}
}
/**
* Represents a method type signature.
*
* See;
* JVMS 4.3.4
* MethodTypeSignature:
* FormalTypeParameters_opt {@code (} TypeSignature* {@code)} ReturnType
* ThrowsSignature*
*/
}
this.typeParamTypes = typeParamTypes;
this.paramTypes = paramTypes;
this.returnType = returnType;
this.throwsTypes = throwsTypes;
}
}
}
}
/**
* Represents a class signature. These describe the signature of
* a class that has type arguments.
*
* See:
* JVMS 4.3.4
* ClassSignature:
* FormalTypeParameters_opt SuperclassSignature SuperinterfaceSignature*
*/
this.typeParamTypes = typeParamTypes;
this.superclassType = superclassType;
}
}
if (superclassType != null) {
}
}
}
/**
* Represents a class type signature. This is used to represent a
* reference to a class, such as in a field, parameter, return type, etc.
*
* See:
* JVMS 4.3.4
* ClassTypeSignature:
* {@code L} PackageSpecifier_opt SimpleClassTypeSignature
* ClassTypeSignatureSuffix* {@code ;}
* PackageSpecifier:
* Identifier {@code /} PackageSpecifier*
* SimpleClassTypeSignature:
* Identifier TypeArguments_opt }
* ClassTypeSignatureSuffix:
* {@code .} SimpleClassTypeSignature
*/
}
}
return name;
else
}
}
}
public boolean isObject() {
}
}
/**
* Represents a FormalTypeParameter. These are used to declare the type
* parameters for generic classes and methods.
*
* See:
* JVMS 4.3.4
* FormalTypeParameters:
* {@code <} FormalTypeParameter+ {@code >}
* FormalTypeParameter:
* Identifier ClassBound InterfaceBound*
* ClassBound:
* {@code :} FieldTypeSignature_opt
* InterfaceBound:
* {@code :} FieldTypeSignature
*/
this.classBound = classBound;
this.interfaceBounds = interfaceBounds;
}
}
if (classBound != null) {
sep = " & ";
}
if (interfaceBounds != null) {
sep = " & ";
}
}
}
}
/**
* Represents a wildcard type argument. A type argument that is not a
* wildcard type argument will be represented by a ClassType, ArrayType, etc.
*
* See:
* JVMS 4.3.4
* TypeArgument:
* WildcardIndicator_opt FieldTypeSignature
* {@code *}
* WildcardIndicator:
* {@code +}
* {@code -}
*/
public WildcardType() {
}
}
}
switch (kind) {
case UNBOUNDED:
return "?";
case EXTENDS:
return "? extends " + boundType;
case SUPER:
return "? super " + boundType;
default:
throw new AssertionError();
}
}
}
}