|
|
@ -464,43 +464,8 @@ public class Segment implements ClassVisitor { |
|
|
|
name = ""; |
|
|
|
name = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
nameRU.add(name); |
|
|
|
nameRU.add(name); |
|
|
|
addValueAndTag(value); |
|
|
|
addValueAndTag(value, T, values); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addValueAndTag(Object value) { |
|
|
|
|
|
|
|
if(value instanceof Integer) { |
|
|
|
|
|
|
|
T.add("I"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Double) { |
|
|
|
|
|
|
|
T.add("D"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Float) { |
|
|
|
|
|
|
|
T.add("F"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Long) { |
|
|
|
|
|
|
|
T.add("J"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Byte) { |
|
|
|
|
|
|
|
T.add("B"); |
|
|
|
|
|
|
|
values.add(new Integer(((Byte)value).intValue())); |
|
|
|
|
|
|
|
} else if (value instanceof Character) { |
|
|
|
|
|
|
|
T.add("C"); |
|
|
|
|
|
|
|
values.add(new Integer(((Character)value).charValue())); |
|
|
|
|
|
|
|
} else if (value instanceof Short) { |
|
|
|
|
|
|
|
T.add("S"); |
|
|
|
|
|
|
|
values.add(new Integer(((Short)value).intValue())); |
|
|
|
|
|
|
|
} else if (value instanceof Boolean) { |
|
|
|
|
|
|
|
T.add("Z"); |
|
|
|
|
|
|
|
values.add(new Integer(((Boolean)value).booleanValue() ? 1 : 0)); |
|
|
|
|
|
|
|
} else if (value instanceof String) { |
|
|
|
|
|
|
|
T.add("s"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Type) { |
|
|
|
|
|
|
|
T.add("c"); |
|
|
|
|
|
|
|
values.add(((Type)value).toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AnnotationVisitor visitAnnotation(String name, String desc) { |
|
|
|
public AnnotationVisitor visitAnnotation(String name, String desc) { |
|
|
|
T.add("@"); |
|
|
|
T.add("@"); |
|
|
|
if (name == null) { |
|
|
|
if (name == null) { |
|
|
@ -514,7 +479,7 @@ public class Segment implements ClassVisitor { |
|
|
|
Integer numPairs = (Integer) nestPairN.remove(nestPairN.size() - 1); |
|
|
|
Integer numPairs = (Integer) nestPairN.remove(nestPairN.size() - 1); |
|
|
|
nestPairN.add(new Integer(numPairs.intValue() + 1)); |
|
|
|
nestPairN.add(new Integer(numPairs.intValue() + 1)); |
|
|
|
nestNameRU.add(name); |
|
|
|
nestNameRU.add(name); |
|
|
|
addValueAndTag(value); |
|
|
|
addValueAndTag(value, T, values); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AnnotationVisitor visitAnnotation(String arg0, |
|
|
|
public AnnotationVisitor visitAnnotation(String arg0, |
|
|
@ -549,56 +514,77 @@ public class Segment implements ClassVisitor { |
|
|
|
} |
|
|
|
} |
|
|
|
nameRU.add(name); |
|
|
|
nameRU.add(name); |
|
|
|
caseArrayN.add(new Integer(0)); |
|
|
|
caseArrayN.add(new Integer(0)); |
|
|
|
return new AnnotationVisitor() { |
|
|
|
return new ArrayVisitor(caseArrayN, T, nameRU, values); |
|
|
|
public void visit(String name, Object value) { |
|
|
|
} |
|
|
|
Integer numCases = (Integer) caseArrayN.remove(caseArrayN.size() - 1); |
|
|
|
|
|
|
|
caseArrayN.add(new Integer(numCases.intValue() + 1)); |
|
|
|
public void visitEnd() { |
|
|
|
|
|
|
|
if (desc == null) { |
|
|
|
|
|
|
|
Segment.this.classBands.addAnnotationDefault(nameRU, T, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); |
|
|
|
|
|
|
|
} else if(parameter != -1) { |
|
|
|
|
|
|
|
Segment.this.classBands.addParameterAnnotation(parameter, desc, visible, nameRU, T, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Segment.this.classBands.addAnnotation(context, desc, visible, nameRU, T, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void visitEnum(String name, String desc, String value) { |
|
|
|
|
|
|
|
T.add("e"); |
|
|
|
if (name == null) { |
|
|
|
if (name == null) { |
|
|
|
name = ""; |
|
|
|
name = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
nameRU.add(name); |
|
|
|
nameRU.add(name); |
|
|
|
addValueAndTag(value); |
|
|
|
values.add(desc); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AnnotationVisitor visitAnnotation(String arg0, |
|
|
|
public class ArrayVisitor implements AnnotationVisitor { |
|
|
|
String arg1) { |
|
|
|
|
|
|
|
throw new RuntimeException("Not yet supported"); |
|
|
|
private int indexInCaseArrayN; |
|
|
|
|
|
|
|
private List caseArrayN; |
|
|
|
|
|
|
|
private List values; |
|
|
|
|
|
|
|
private List nameRU; |
|
|
|
|
|
|
|
private List T; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ArrayVisitor(List caseArrayN, List T, List nameRU, List values) { |
|
|
|
|
|
|
|
this.caseArrayN = caseArrayN; |
|
|
|
|
|
|
|
this.T = T; |
|
|
|
|
|
|
|
this.nameRU = nameRU; |
|
|
|
|
|
|
|
this.values = values; |
|
|
|
|
|
|
|
this.indexInCaseArrayN = caseArrayN.size() - 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AnnotationVisitor visitArray(String arg0) { |
|
|
|
public void visit(String name, Object value) { |
|
|
|
throw new RuntimeException("Not yet supported"); |
|
|
|
Integer numCases = (Integer) caseArrayN.remove(indexInCaseArrayN); |
|
|
|
// return null;
|
|
|
|
caseArrayN.add(indexInCaseArrayN, new Integer(numCases.intValue() + 1)); |
|
|
|
|
|
|
|
if (name == null) { |
|
|
|
|
|
|
|
name = ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
addValueAndTag(value, T, values); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void visitEnd() { |
|
|
|
public AnnotationVisitor visitAnnotation(String arg0, |
|
|
|
|
|
|
|
String arg1) { |
|
|
|
|
|
|
|
throw new RuntimeException("Not yet supported"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void visitEnum(String name, String desc, String value) { |
|
|
|
public AnnotationVisitor visitArray(String name) { |
|
|
|
Integer numCases = (Integer) caseArrayN.remove(caseArrayN.size() - 1); |
|
|
|
T.add("["); |
|
|
|
caseArrayN.add(new Integer(numCases.intValue() + 1)); |
|
|
|
if (name == null) { |
|
|
|
T.add("e"); |
|
|
|
name = ""; |
|
|
|
values.add(desc); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
nameRU.add(name); |
|
|
|
|
|
|
|
caseArrayN.add(new Integer(0)); |
|
|
|
|
|
|
|
return new ArrayVisitor(caseArrayN, T, nameRU, values); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void visitEnd() { |
|
|
|
public void visitEnd() { |
|
|
|
if (desc == null) { |
|
|
|
|
|
|
|
Segment.this.classBands.addAnnotationDefault(nameRU, T, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); |
|
|
|
|
|
|
|
} else if(parameter != -1) { |
|
|
|
|
|
|
|
Segment.this.classBands.addParameterAnnotation(parameter, desc, visible, nameRU, T, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Segment.this.classBands.addAnnotation(context, desc, visible, nameRU, T, values, caseArrayN, nestTypeRS, nestNameRU, nestPairN); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void visitEnum(String name, String desc, String value) { |
|
|
|
public void visitEnum(String name, String desc, String value) { |
|
|
|
|
|
|
|
Integer numCases = (Integer) caseArrayN.remove(caseArrayN.size() - 1); |
|
|
|
|
|
|
|
caseArrayN.add(new Integer(numCases.intValue() + 1)); |
|
|
|
T.add("e"); |
|
|
|
T.add("e"); |
|
|
|
if (name == null) { |
|
|
|
|
|
|
|
name = ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
nameRU.add(name); |
|
|
|
|
|
|
|
values.add(desc); |
|
|
|
values.add(desc); |
|
|
|
values.add(value); |
|
|
|
values.add(value); |
|
|
|
} |
|
|
|
} |
|
|
@ -645,6 +631,42 @@ public class Segment implements ClassVisitor { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// helper method for annotation visitors
|
|
|
|
|
|
|
|
private void addValueAndTag(Object value, List T, List values) { |
|
|
|
|
|
|
|
if(value instanceof Integer) { |
|
|
|
|
|
|
|
T.add("I"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Double) { |
|
|
|
|
|
|
|
T.add("D"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Float) { |
|
|
|
|
|
|
|
T.add("F"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Long) { |
|
|
|
|
|
|
|
T.add("J"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Byte) { |
|
|
|
|
|
|
|
T.add("B"); |
|
|
|
|
|
|
|
values.add(new Integer(((Byte)value).intValue())); |
|
|
|
|
|
|
|
} else if (value instanceof Character) { |
|
|
|
|
|
|
|
T.add("C"); |
|
|
|
|
|
|
|
values.add(new Integer(((Character)value).charValue())); |
|
|
|
|
|
|
|
} else if (value instanceof Short) { |
|
|
|
|
|
|
|
T.add("S"); |
|
|
|
|
|
|
|
values.add(new Integer(((Short)value).intValue())); |
|
|
|
|
|
|
|
} else if (value instanceof Boolean) { |
|
|
|
|
|
|
|
T.add("Z"); |
|
|
|
|
|
|
|
values.add(new Integer(((Boolean)value).booleanValue() ? 1 : 0)); |
|
|
|
|
|
|
|
} else if (value instanceof String) { |
|
|
|
|
|
|
|
T.add("s"); |
|
|
|
|
|
|
|
values.add(value); |
|
|
|
|
|
|
|
} else if (value instanceof Type) { |
|
|
|
|
|
|
|
T.add("c"); |
|
|
|
|
|
|
|
values.add(((Type)value).toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean lastConstantHadWideIndex() { |
|
|
|
public boolean lastConstantHadWideIndex() { |
|
|
|
return currentClassReader.lastConstantHadWideIndex(); |
|
|
|
return currentClassReader.lastConstantHadWideIndex(); |
|
|
|
} |
|
|
|
} |
|
|
|