本文整理汇总了Java中org.objectweb.asm.signature.SignatureWriter.toString方法的典型用法代码示例。如果您正苦于以下问题:Java SignatureWriter.toString方法的具体用法?Java SignatureWriter.toString怎么用?Java SignatureWriter.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.objectweb.asm.signature.SignatureWriter
的用法示例。
在下文中一共展示了SignatureWriter.toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translateSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String translateSignature(final String signature, boolean type) {
if (signature == null) {
return null;
}
SignatureReader r = new SignatureReader(signature);
SignatureWriter w = new SignatureWriter() {
public void visitClassType(final String name) {
String n = translator.getClassMirrorTranslation(name);
super.visitClassType(n);
}
};
if (type) {
r.acceptType(w);
} else {
r.accept(w);
}
return w.toString();
}
示例2: valueSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
* This method assumes that return type of the method is
* <code>com.google.code.jconts.Computation<T></code>. It extracts the type
* argument <code>T</code> and returns it signature.
*/
private String valueSignature() {
final SignatureWriter sign = new SignatureWriter();
SignatureAdapter adaptor = new SignatureAdapter() {
public SignatureVisitor visitReturnType() {
return new SignatureAdapter() {
@Override
public SignatureVisitor visitTypeArgument(char wildcard) {
return sign;
}
// FIXME: All other are error!
};
};
};
new SignatureReader(signature).accept(adaptor);
return sign.toString();
}
示例3: ContinuationClassGenerator
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
public ContinuationClassGenerator(MethodContext info) {
this.info = info;
this.stateDesc = info.stateType.getDescriptor();
SignatureWriter sign = new SignatureWriter();
// Name<T> implements Continuation<T>
sign.visitFormalTypeParameter("T");
SignatureVisitor v = sign.visitClassBound();
v.visitClassType(OBJECT_NAME);
v.visitEnd();
v = sign.visitSuperclass();
v.visitClassType(OBJECT_NAME);
v.visitEnd();
v = sign.visitInterface();
v.visitClassType(CONTINUATION_NAME);
v.visitTypeArgument('=').visitTypeVariable("T");
v.visitEnd();
this.signature = sign.toString();
}
示例4: mapSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
* @param signature
* signature for mapper
* @param typeSignature
* true if signature is a FieldTypeSignature, such as the
* signature parameter of the ClassVisitor.visitField or
* MethodVisitor.visitLocalVariable methods
* @return signature rewritten as a string
*/
public String mapSignature(String signature, boolean typeSignature) {
if (signature == null) {
return null;
}
SignatureReader r = new SignatureReader(signature);
SignatureWriter w = new SignatureWriter();
SignatureVisitor a = createSignatureRemapper(w);
if (typeSignature) {
r.acceptType(a);
} else {
r.accept(a);
}
return w.toString();
}
示例5: mapSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
public String mapSignature(String signature, boolean isType, int api) {
if (signature != null) {
SignatureReader reader = new SignatureReader(signature);
final SignatureWriter writer = new SignatureWriter();
SignatureVisitor visitor = new BookSignatureVisitor(api, writer, this);
if (isType) {
reader.acceptType(visitor);
} else {
reader.accept(visitor);
}
return writer.toString();
}
return null;
}
示例6: mapSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
*
* @param typeSignature
* true if signature is a FieldTypeSignature, such as the
* signature parameter of the ClassVisitor.visitField or
* MethodVisitor.visitLocalVariable methods
*/
public String mapSignature(String signature, boolean typeSignature) {
if (signature == null) {
return null;
}
SignatureReader r = new SignatureReader(signature);
SignatureWriter w = new SignatureWriter();
SignatureVisitor a = createRemappingSignatureAdapter(w);
if (typeSignature) {
r.acceptType(a);
} else {
r.accept(a);
}
return w.toString();
}
示例7: getGenericSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
@Override
public String getGenericSignature() {
try {
SignatureWriter signatureWriter = new SignatureWriter();
boolean generic = false;
for (TypeDescription.Generic typeVariable : getTypeVariables()) {
signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
boolean classBound = true;
for (TypeDescription.Generic upperBound : typeVariable.getUpperBounds()) {
upperBound.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(classBound
? signatureWriter.visitClassBound()
: signatureWriter.visitInterfaceBound()));
classBound = false;
}
generic = true;
}
for (TypeDescription.Generic parameterType : getParameters().asTypeList()) {
parameterType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitParameterType()));
generic = generic || !parameterType.getSort().isNonGeneric();
}
TypeDescription.Generic returnType = getReturnType();
returnType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitReturnType()));
generic = generic || !returnType.getSort().isNonGeneric();
TypeList.Generic exceptionTypes = getExceptionTypes();
if (!exceptionTypes.filter(not(ofSort(TypeDefinition.Sort.NON_GENERIC))).isEmpty()) {
for (TypeDescription.Generic exceptionType : exceptionTypes) {
exceptionType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitExceptionType()));
generic = generic || !exceptionType.getSort().isNonGeneric();
}
}
return generic
? signatureWriter.toString()
: NON_GENERIC_SIGNATURE;
} catch (GenericSignatureFormatError ignored) {
return NON_GENERIC_SIGNATURE;
}
}
示例8: getGenericSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
@Override
public String getGenericSignature() {
try {
SignatureWriter signatureWriter = new SignatureWriter();
boolean generic = false;
for (Generic typeVariable : getTypeVariables()) {
signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
for (Generic upperBound : typeVariable.getUpperBounds()) {
upperBound.accept(new Generic.Visitor.ForSignatureVisitor(upperBound.asErasure().isInterface()
? signatureWriter.visitInterfaceBound()
: signatureWriter.visitClassBound()));
}
generic = true;
}
Generic superClass = getSuperClass();
// The object type itself is non generic and implicitly returns a non-generic signature
if (superClass == null) {
superClass = TypeDescription.Generic.OBJECT;
}
superClass.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitSuperclass()));
generic = generic || !superClass.getSort().isNonGeneric();
for (Generic interfaceType : getInterfaces()) {
interfaceType.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitInterface()));
generic = generic || !interfaceType.getSort().isNonGeneric();
}
return generic
? signatureWriter.toString()
: NON_GENERIC_SIGNATURE;
} catch (GenericSignatureFormatError ignored) {
return NON_GENERIC_SIGNATURE;
}
}
示例9: fixupSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String fixupSignature(@PropagatesNullable String signature) {
if (signature == null || compatibilityMode.usesDependencies()) {
return signature;
}
SignatureReader reader = new SignatureReader(signature);
SignatureWriter writer = new SignatureWriter();
reader.accept(new SourceAbiCompatibleSignatureVisitor(writer));
return writer.toString();
}
示例10: getSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
* Returns the type signature of the given element. If none is required by the VM spec, returns
* null.
*/
@Nullable
public String getSignature(Element element) {
SignatureWriter writer = new SignatureWriter();
element.accept(elementVisitorAdapter, writer);
String result = writer.toString();
return result.isEmpty() ? null : result;
}
示例11: treatDependencyBoundsAsInterfaces
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
* We can't tell whether an inferred class is a class, interface, annotation, or enum. This is
* problematic for expressing generic type bounds, because the bytecode is different depending on
* whether it is a class or an interface. As it happens, it's safe (from the compiler's
* perspective) to treat everything as an interface. This method is used to rework the "expected"
* signature so that we can use the same test data for testing with and without deps.
*/
private String treatDependencyBoundsAsInterfaces(String signature) {
if (signature == null) {
return null;
}
if (isTestingWithDependencies() || !signature.contains(":Lcom/facebook/foo/Dep")) {
return signature;
}
SignatureWriter writer = new SignatureWriter();
new SignatureReader(signature).accept(new SourceAbiCompatibleSignatureVisitor(writer));
return writer.toString();
}
示例12: mapSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
*
* @param typeSignature true if signature is a FieldTypeSignature, such as
* the signature parameter of the ClassVisitor.visitField or
* MethodVisitor.visitLocalVariable methods
*/
public String mapSignature(String signature, boolean typeSignature) {
if (signature == null) {
return null;
}
SignatureReader r = new SignatureReader(signature);
SignatureWriter w = new SignatureWriter();
SignatureVisitor a = createRemappingSignatureAdapter(w);
if (typeSignature) {
r.acceptType(a);
} else {
r.accept(a);
}
return w.toString();
}
示例13: mapSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String mapSignature(String signature) {
SignatureReader sr = new SignatureReader(signature);
SignatureWriter sw = new SignatureWriter();
sr.accept(new SignatureAdapter(sw));
return sw.toString();
}
示例14: mapTypeSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
private String mapTypeSignature(String signature) {
SignatureReader sr = new SignatureReader(signature);
SignatureWriter sw = new SignatureWriter();
sr.acceptType(new SignatureAdapter(sw));
return sw.toString();
}
示例15: getSignature
import org.objectweb.asm.signature.SignatureWriter; //导入方法依赖的package包/类
/**
* Converts the given Type into a JVM signature.
* @param type the Type to analyze
* @return the resulting signature
*/
public static String getSignature(java.lang.reflect.Type type) {
SignatureWriter sw = new SignatureWriter();
writeSignature(sw, type);
return sw.toString();
}