public void outAFullIdentNonvoidType(AFullIdentNonvoidType node) { String typeName = (String) mProductions.removeLast(); Type t = RefType.v(typeName); int dim = node.getArrayBrackets().size(); if (dim > 0) t = ArrayType.v(t, dim); mProductions.addLast(t); }
private Type getSootType(AnnotationElem e) { Type annotationType; switch (e.getKind()) { case '[': // array // Until now we only know it's some kind of array. annotationType = ARRAY_TYPE; AnnotationArrayElem array = (AnnotationArrayElem) e; if (array.getNumValues() > 0) { // Try to determine type of the array AnnotationElem firstElement = array.getValueAt(0); Type type = getSootType(firstElement); if (type == null) return null; if (type.equals(ARRAY_TYPE)) return ARRAY_TYPE; return ArrayType.v(type, 1); } break; case 's': // string annotationType = RefType.v("java.lang.String"); break; case 'c': // class annotationType = RefType.v("java.lang.Class"); break; case 'e': // enum AnnotationEnumElem enumElem = (AnnotationEnumElem) e; annotationType = Util.getType(enumElem.getTypeName()); ; break; case 'L': case 'J': case 'S': case 'D': case 'I': case 'F': case 'B': case 'C': case 'V': case 'Z': annotationType = Util.getType(String.valueOf(e.getKind())); break; default: annotationType = null; break; } return annotationType; }
public void outAMultiNewExpr(AMultiNewExpr node) { LinkedList arrayDesc = node.getArrayDescriptor(); int descCnt = arrayDesc.size(); List sizes = new LinkedList(); Iterator it = arrayDesc.iterator(); while (it.hasNext()) { AArrayDescriptor o = (AArrayDescriptor) it.next(); if (o.getImmediate() != null) sizes.add(0, (Value) mProductions.removeLast()); else break; } Type type = (Type) mProductions.removeLast(); ArrayType arrayType = ArrayType.v(type, descCnt); mProductions.addLast(Jimple.v().newNewMultiArrayExpr(arrayType, sizes)); }
/* nonvoid_type = {base} base_type_no_name array_brackets*; {quoted} quoted_name array_brackets* | {ident} identifier array_brackets* | {full_ident} full_identifier array_brackets*; */ public void outABaseNonvoidType(ABaseNonvoidType node) { Type t = (Type) mProductions.removeLast(); int dim = node.getArrayBrackets().size(); if (dim > 0) t = ArrayType.v(t, dim); mProductions.addLast(t); }