本文整理汇总了Java中sun.reflect.generics.parser.SignatureParser类的典型用法代码示例。如果您正苦于以下问题:Java SignatureParser类的具体用法?Java SignatureParser怎么用?Java SignatureParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SignatureParser类属于sun.reflect.generics.parser包,在下文中一共展示了SignatureParser类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.reflect.generics.parser.SignatureParser; //导入依赖的package包/类
public static void main(String[] args) {
String[] badSignatures = {
// Missing ":" after first type bound
"<T:Lfoo/tools/nsc/symtab/Names;Lfoo/tools/nsc/symtab/Symbols;",
// Arrays improperly indicated for exception information
"<E:Ljava/lang/Exception;>(TE;[Ljava/lang/RuntimeException;)V^[TE;",
};
for(String badSig : badSignatures) {
try {
SignatureParser.make().parseMethodSig(badSig);
throw new RuntimeException("Expected GenericSignatureFormatError for " +
badSig);
} catch(GenericSignatureFormatError gsfe) {
System.out.println(gsfe.toString()); // Expected
}
}
}
示例2: parseSig
import sun.reflect.generics.parser.SignatureParser; //导入依赖的package包/类
private static Class<?> parseSig(String sig, Class container) {
if (sig.equals("V")) return void.class;
SignatureParser parser = SignatureParser.make();
TypeSignature typeSig = parser.parseTypeSig(sig);
GenericsFactory factory = CoreReflectionFactory.make(container, ClassScope.make(container));
Reifier reify = Reifier.make(factory);
typeSig.accept(reify);
Type result = reify.getResult();
return toClass(result);
}
示例3: parseSig
import sun.reflect.generics.parser.SignatureParser; //导入依赖的package包/类
private static Class<?> parseSig(String sig, Class<?> container) {
if (sig.equals("V")) return void.class;
SignatureParser parser = SignatureParser.make();
TypeSignature typeSig = parser.parseTypeSig(sig);
GenericsFactory factory = CoreReflectionFactory.make(container, ClassScope.make(container));
Reifier reify = Reifier.make(factory);
typeSig.accept(reify);
Type result = reify.getResult();
return toClass(result);
}
示例4: parse
import sun.reflect.generics.parser.SignatureParser; //导入依赖的package包/类
protected MethodTypeSignature parse(String s) {
return SignatureParser.make().parseMethodSig(s);
}
示例5: parse
import sun.reflect.generics.parser.SignatureParser; //导入依赖的package包/类
protected ClassSignature parse(String s) {
return SignatureParser.make().parseClassSig(s);
}
示例6: parse
import sun.reflect.generics.parser.SignatureParser; //导入依赖的package包/类
protected TypeSignature parse(String s) {
return SignatureParser.make().parseTypeSig(s);
}