package org.simpleframework.xml.convert; import java.lang.annotation.Annotation; import org.simpleframework.xml.util.ConcurrentCache; /* loaded from: classes6.dex */ class ScannerBuilder extends ConcurrentCache { public Scanner build(Class cls) { Scanner scanner = get(cls); if (scanner != null) { return scanner; } Entry entry = new Entry(cls); put(cls, entry); return entry; } /* loaded from: classes6.dex */ static class Entry extends ConcurrentCache implements Scanner { private final Class root; public Entry(Class cls) { this.root = cls; } @Override // org.simpleframework.xml.convert.Scanner public T scan(Class cls) { if (!contains(cls)) { Annotation find = find(cls); if (cls != null && find != null) { put(cls, find); } } return (T) get(cls); } private T find(Class cls) { for (Class cls2 = this.root; cls2 != null; cls2 = cls2.getSuperclass()) { T t = (T) cls2.getAnnotation(cls); if (t != null) { return t; } } return null; } } }