Commit bd4fdc75 authored by ebruneton's avatar ebruneton
Browse files

implemented TODO in visitInnerClassType

[[Split portion of a mixed commit.]]
parent 1df1f2ec
...@@ -32,6 +32,13 @@ package org.objectweb.asm.util; ...@@ -32,6 +32,13 @@ package org.objectweb.asm.util;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import org.objectweb.asm.signature.SignatureVisitor; import org.objectweb.asm.signature.SignatureVisitor;
/**
* A {@link SignatureVisitor} that prints a disassembled view of the signature
* it visits.
*
* @author Eugene Kuleshov
* @author Eric Bruneton
*/
public class TraceSignatureVisitor implements SignatureVisitor { public class TraceSignatureVisitor implements SignatureVisitor {
private StringBuffer declaration; private StringBuffer declaration;
...@@ -171,12 +178,10 @@ public class TraceSignatureVisitor implements SignatureVisitor { ...@@ -171,12 +178,10 @@ public class TraceSignatureVisitor implements SignatureVisitor {
case 'F': case 'F':
declaration.append("float"); declaration.append("float");
break; break;
case 'D': // case 'D':
default:
declaration.append("double"); declaration.append("double");
break; break;
default:
throw new IllegalArgumentException("Invalid descriptor "
+ descriptor);
} }
endType(); endType();
} }
...@@ -211,7 +216,11 @@ public class TraceSignatureVisitor implements SignatureVisitor { ...@@ -211,7 +216,11 @@ public class TraceSignatureVisitor implements SignatureVisitor {
} }
public void visitInnerClassType(String name) { public void visitInnerClassType(String name) {
// TODO tests if (argumentStack % 2 == 1) {
declaration.append('>');
}
argumentStack /= 2;
declaration.append('.');
declaration.append(separator).append(name.replace('/', '.')); declaration.append(separator).append(name.replace('/', '.'));
separator = ""; separator = "";
argumentStack *= 2; argumentStack *= 2;
...@@ -220,17 +229,17 @@ public class TraceSignatureVisitor implements SignatureVisitor { ...@@ -220,17 +229,17 @@ public class TraceSignatureVisitor implements SignatureVisitor {
public void visitTypeArgument() { public void visitTypeArgument() {
if (argumentStack % 2 == 0) { if (argumentStack % 2 == 0) {
++argumentStack; ++argumentStack;
declaration.append("<"); declaration.append('<');
} else { } else {
declaration.append(", "); declaration.append(", ");
} }
declaration.append("?"); declaration.append('?');
} }
public SignatureVisitor visitTypeArgument(char tag) { public SignatureVisitor visitTypeArgument(char tag) {
if (argumentStack % 2 == 0) { if (argumentStack % 2 == 0) {
++argumentStack; ++argumentStack;
declaration.append("<"); declaration.append('<');
} else { } else {
declaration.append(", "); declaration.append(", ");
} }
...@@ -247,7 +256,7 @@ public class TraceSignatureVisitor implements SignatureVisitor { ...@@ -247,7 +256,7 @@ public class TraceSignatureVisitor implements SignatureVisitor {
public void visitEnd() { public void visitEnd() {
if (argumentStack % 2 == 1) { if (argumentStack % 2 == 1) {
declaration.append(">"); declaration.append('>');
} }
argumentStack /= 2; argumentStack /= 2;
endType(); endType();
...@@ -269,7 +278,7 @@ public class TraceSignatureVisitor implements SignatureVisitor { ...@@ -269,7 +278,7 @@ public class TraceSignatureVisitor implements SignatureVisitor {
private void endFormals() { private void endFormals() {
if (seenFormalParameter) { if (seenFormalParameter) {
declaration.append(">"); declaration.append('>');
seenFormalParameter = false; seenFormalParameter = false;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment