@Test public void testFindMarshalersBuiltins() { MarshalerLookup lookup = new MarshalerLookup(config); List<Marshaler> l = lookup.findMarshalers(toSootClass(String.class)); assertFalse(l.isEmpty()); assertSame(toClazz(ArrayMarshalers.ByteArrayMarshaler.class), l.get(0).getClazz()); assertSame(toClazz(ArrayMarshalers.ShortArrayMarshaler.class), l.get(1).getClazz()); }
public Marshaler findMarshalers(MarshalSite marshalSite) { soot.Type type = marshalSite.getType(); SootClass sc = null; if (type instanceof RefType) { sc = ((RefType) type).getSootClass(); } else if (type instanceof ArrayType && ((ArrayType) type).baseType instanceof RefType) { sc = ((RefType) ((ArrayType) type).baseType).getSootClass(); } List<Marshaler> result = new ArrayList<>(); Set<String> visited = new HashSet<>(); Set<String> seen = new HashSet<>(); if (sc != null) { findMarshalers(sc, result, visited, seen, false); } findMarshalers(marshalSite.method.getDeclaringClass(), result, visited, seen, searchBuiltins); for (Marshaler marshaler : result) { if (marshaler.canMarshal(marshalSite)) { return marshaler; } } return null; }
MarshalerLookup { public Marshaler findMarshalers(MarshalSite marshalSite) { soot.Type type = marshalSite.getType(); SootClass sc = null; if (type instanceof RefType) { sc = ((RefType) type).getSootClass(); } else if (type instanceof ArrayType && ((ArrayType) type).baseType instanceof RefType) { sc = ((RefType) ((ArrayType) type).baseType).getSootClass(); } List<Marshaler> result = new ArrayList<>(); Set<String> visited = new HashSet<>(); Set<String> seen = new HashSet<>(); if (sc != null) { findMarshalers(sc, result, visited, seen, false); } findMarshalers(marshalSite.method.getDeclaringClass(), result, visited, seen, searchBuiltins); for (Marshaler marshaler : result) { if (marshaler.canMarshal(marshalSite)) { return marshaler; } } return null; } }
MarshalerLookup { public Marshaler findMarshalers(MarshalSite marshalSite) { soot.Type type = marshalSite.getType(); SootClass sc = null; if (type instanceof RefType) { sc = ((RefType) type).getSootClass(); } else if (type instanceof ArrayType && ((ArrayType) type).baseType instanceof RefType) { sc = ((RefType) ((ArrayType) type).baseType).getSootClass(); } List<Marshaler> result = new ArrayList<>(); Set<String> visited = new HashSet<>(); Set<String> seen = new HashSet<>(); if (sc != null) { findMarshalers(sc, result, visited, seen, false); } findMarshalers(marshalSite.method.getDeclaringClass(), result, visited, seen, searchBuiltins); for (Marshaler marshaler : result) { if (marshaler.canMarshal(marshalSite)) { return marshaler; } } return null; } MarshalerLookup(Config config); }
MarshalerLookup { public Marshaler findMarshalers(MarshalSite marshalSite) { soot.Type type = marshalSite.getType(); SootClass sc = null; if (type instanceof RefType) { sc = ((RefType) type).getSootClass(); } else if (type instanceof ArrayType && ((ArrayType) type).baseType instanceof RefType) { sc = ((RefType) ((ArrayType) type).baseType).getSootClass(); } List<Marshaler> result = new ArrayList<>(); Set<String> visited = new HashSet<>(); Set<String> seen = new HashSet<>(); if (sc != null) { findMarshalers(sc, result, visited, seen, false); } findMarshalers(marshalSite.method.getDeclaringClass(), result, visited, seen, searchBuiltins); for (Marshaler marshaler : result) { if (marshaler.canMarshal(marshalSite)) { return marshaler; } } return null; } MarshalerLookup(Config config); MarshalerLookup searchBuiltins(boolean b); Marshaler findMarshalers(MarshalSite marshalSite); List<Marshaler> findMarshalers(SootClass sc); MarshalerMethod findMarshalerMethod(MarshalSite marshalSite); }
MarshalerLookup { public Marshaler findMarshalers(MarshalSite marshalSite) { soot.Type type = marshalSite.getType(); SootClass sc = null; if (type instanceof RefType) { sc = ((RefType) type).getSootClass(); } else if (type instanceof ArrayType && ((ArrayType) type).baseType instanceof RefType) { sc = ((RefType) ((ArrayType) type).baseType).getSootClass(); } List<Marshaler> result = new ArrayList<>(); Set<String> visited = new HashSet<>(); Set<String> seen = new HashSet<>(); if (sc != null) { findMarshalers(sc, result, visited, seen, false); } findMarshalers(marshalSite.method.getDeclaringClass(), result, visited, seen, searchBuiltins); for (Marshaler marshaler : result) { if (marshaler.canMarshal(marshalSite)) { return marshaler; } } return null; } MarshalerLookup(Config config); MarshalerLookup searchBuiltins(boolean b); Marshaler findMarshalers(MarshalSite marshalSite); List<Marshaler> findMarshalers(SootClass sc); MarshalerMethod findMarshalerMethod(MarshalSite marshalSite);  }