edu.umd.cs.findbugs.ba.generic

Class GenericUtilities

public class GenericUtilities extends Object

Utilities for adding support for generics. Most of these methods can be applied to generic and non generic type information.

Author: Nat Ayewah

Nested Class Summary
abstract static classGenericUtilities.TypeCategory
Method Summary
static StringgetString(Type type)
Get String representation of a Type including Generic information
static TypegetType(String signature)
This method is analogous to Type.getType(String), except that it also accepts signatures with generic information. e.g.
static GenericUtilities.TypeCategorygetTypeCategory(Type type)
Get the TypeCategory that represents this Object
static List<ReferenceType>getTypes(String signature)
Parse a bytecode signature that has 1 or more (possibly generic) types and return a list of the Types.
static booleanisPlainObject(Type type)
static intlastMatchedLeftAngleBracket(String s)
static ObjectTypemerge(GenericObjectType t1, ObjectType t2)
static intnextUnmatchedRightAngleBracket(String s, int startingAt)
static StringremoveMatchedAngleBrackets(String s)

Method Detail

getString

public static final String getString(Type type)
Get String representation of a Type including Generic information

getType

public static final Type getType(String signature)
This method is analogous to Type.getType(String), except that it also accepts signatures with generic information. e.g. Ljava/util/ArrayList<TT;>;

The signature should only contain one type. Use GenericSignatureParser to break up a signature with many types or call createTypes(String) to return a list of types

getTypeCategory

public static final GenericUtilities.TypeCategory getTypeCategory(Type type)
Get the TypeCategory that represents this Object

See Also: TypeCategory

getTypes

public static final List<ReferenceType> getTypes(String signature)
Parse a bytecode signature that has 1 or more (possibly generic) types and return a list of the Types.

Parameters: signature bytecode signature e.g. e.g. Ljava/util/ArrayList<Ljava/lang/String;>;Ljava/util/ArrayList<TT;>;Ljava/util/ArrayList<*>;

isPlainObject

public static final boolean isPlainObject(Type type)

lastMatchedLeftAngleBracket

public static int lastMatchedLeftAngleBracket(String s)

merge

public static ObjectType merge(GenericObjectType t1, ObjectType t2)

nextUnmatchedRightAngleBracket

public static int nextUnmatchedRightAngleBracket(String s, int startingAt)

removeMatchedAngleBrackets

public static String removeMatchedAngleBrackets(String s)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.