use of org.objectweb.asm.signature.SignatureReader in project CodenameOne by codenameone.
the class NameTranslatorClassVisitor method translateSignature.
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();
}
use of org.objectweb.asm.signature.SignatureReader in project evosuite by EvoSuite.
the class CastClassAnalyzer method handleClassSignature.
private void handleClassSignature(ClassNode cn) {
CollectParameterTypesVisitor visitor = new CollectParameterTypesVisitor(cn.name);
if (cn.signature != null) {
new SignatureReader(cn.signature).accept(visitor);
for (Type castType : visitor.getClasses()) {
if (!castClassMap.containsKey(castType)) {
logger.debug("Adding new cast class from signature visitor: " + castType);
castClassMap.put(castType, 1);
}
}
}
}
use of org.objectweb.asm.signature.SignatureReader in project maple-ir by LLVM-but-worse.
the class Textifier method visitLocalVariable.
@Override
public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) {
buf.setLength(0);
buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' ');
appendDescriptor(FIELD_DESCRIPTOR, desc);
buf.append(' ');
appendLabel(start);
buf.append(' ');
appendLabel(end);
buf.append(' ').append(index).append('\n');
if (signature != null) {
buf.append(tab2);
appendDescriptor(FIELD_SIGNATURE, signature);
TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
SignatureReader r = new SignatureReader(signature);
r.acceptType(sv);
buf.append(tab2).append("// declaration: ").append(sv.getDeclaration()).append('\n');
}
text.add(buf.toString());
}
use of org.objectweb.asm.signature.SignatureReader in project maple-ir by LLVM-but-worse.
the class Textifier method visitField.
@Override
public Textifier visitField(final int access, final String name, final String desc, final String signature, final Object value) {
buf.setLength(0);
buf.append('\n');
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
buf.append(tab).append("// DEPRECATED\n");
}
buf.append(tab).append("// access flags 0x").append(Integer.toHexString(access).toUpperCase()).append('\n');
if (signature != null) {
buf.append(tab);
appendDescriptor(FIELD_SIGNATURE, signature);
TraceSignatureVisitor sv = new TraceSignatureVisitor(0);
SignatureReader r = new SignatureReader(signature);
r.acceptType(sv);
buf.append(tab).append("// declaration: ").append(sv.getDeclaration()).append('\n');
}
buf.append(tab);
appendAccess(access);
appendDescriptor(FIELD_DESCRIPTOR, desc);
buf.append(' ').append(name);
if (value != null) {
buf.append(" = ");
if (value instanceof String) {
buf.append('\"').append(value).append('\"');
} else {
buf.append(value);
}
}
buf.append('\n');
text.add(buf.toString());
Textifier t = createTextifier();
text.add(t.getText());
return t;
}
use of org.objectweb.asm.signature.SignatureReader in project maple-ir by LLVM-but-worse.
the class Textifier method visitMethod.
@Override
public Textifier visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
buf.setLength(0);
buf.append('\n');
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
buf.append(tab).append("// DEPRECATED\n");
}
buf.append(tab).append("// access flags 0x").append(Integer.toHexString(access).toUpperCase()).append('\n');
if (signature != null) {
buf.append(tab);
appendDescriptor(METHOD_SIGNATURE, signature);
TraceSignatureVisitor v = new TraceSignatureVisitor(0);
SignatureReader r = new SignatureReader(signature);
r.accept(v);
String genericDecl = v.getDeclaration();
String genericReturn = v.getReturnType();
String genericExceptions = v.getExceptions();
buf.append(tab).append("// declaration: ").append(genericReturn).append(' ').append(name).append(genericDecl);
if (genericExceptions != null) {
buf.append(" throws ").append(genericExceptions);
}
buf.append('\n');
}
buf.append(tab);
appendAccess(access);
if ((access & Opcodes.ACC_NATIVE) != 0) {
buf.append("native ");
}
if ((access & Opcodes.ACC_VARARGS) != 0) {
buf.append("varargs ");
}
if ((access & Opcodes.ACC_BRIDGE) != 0) {
buf.append("bridge ");
}
if ((this.access & Opcodes.ACC_INTERFACE) != 0 && (access & Opcodes.ACC_ABSTRACT) == 0 && (access & Opcodes.ACC_STATIC) == 0) {
buf.append("default ");
}
buf.append(name);
appendDescriptor(METHOD_DESCRIPTOR, desc);
if (exceptions != null && exceptions.length > 0) {
buf.append(" throws ");
for (int i = 0; i < exceptions.length; ++i) {
appendDescriptor(INTERNAL_NAME, exceptions[i]);
buf.append(' ');
}
}
buf.append('\n');
text.add(buf.toString());
Textifier t = createTextifier();
text.add(t.getText());
return t;
}
Aggregations