Bug 946083: Prevent the annotation processor from choking on stale classfiles in the objdir. r=rnewman

This commit is contained in:
Chris Kitching 2013-12-18 02:30:57 +00:00
Родитель 5b486f5042
Коммит caf7e42559
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -31,7 +31,19 @@ public class JarClassIterator implements Iterator<ClassWithOptions> {
String className = mTargetClassListIterator.next();
try {
Class<?> ret = mTarget.loadClass(className);
if (ret.getCanonicalName() == null || "null".equals(ret.getCanonicalName())) {
final String canonicalName;
// Incremental builds can leave stale classfiles in the jar. Such classfiles will cause
// an exception at this point. We can safely ignore these classes - they cannot possibly
// ever be loaded as they conflict with their parent class and will be killed by Proguard
// later on anyway.
try {
canonicalName = ret.getCanonicalName();
} catch (IncompatibleClassChangeError e) {
return next();
}
if (canonicalName == null || "null".equals(canonicalName)) {
// Anonymous inner class - unsupported.
return next();
} else {