6565/**
6666 * @author rwondratschek
6767 */
68- @ SuppressWarnings ("unused" )
6968@ AutoService (Processor .class )
7069public class StateProcessor extends AbstractProcessor {
7170
@@ -116,9 +115,6 @@ public int compare(Element o1, Element o2) {
116115 private static final String OBJECT_CLASS_NAME = Object .class .getName ();
117116 private static final String PARCELABLE_CLASS_NAME = Parcelable .class .getName ();
118117 private static final String SERIALIZABLE_CLASS_NAME = Serializable .class .getName ();
119- private static final String ARRAY_LIST_CLASS_NAME = ArrayList .class .getName ();
120- private static final String SPARSE_ARRAY_CLASS_NAME = SparseArray .class .getName ();
121- private static final String ENUM_CLASS_NAME = Enum .class .getName ();
122118
123119 private static final Set <String > IGNORED_TYPE_DECLARATIONS = Collections .unmodifiableSet (new HashSet <String >() {{
124120 add (Bundle .class .getName ());
@@ -731,7 +727,7 @@ private TypeMirror getInsertedType(TypeMirror fieldType, boolean checkIgnoredTyp
731727 }
732728
733729 TypeElement classElement = mElementUtils .getTypeElement (fieldType .toString ());
734- if (classElement == null ) {
730+ if (classElement == null || OBJECT_CLASS_NAME . equals ( classElement . toString ()) ) {
735731 return null ;
736732 }
737733
@@ -749,11 +745,10 @@ private TypeMirror getInsertedType(TypeMirror fieldType, boolean checkIgnoredTyp
749745 if (SERIALIZABLE_CLASS_NAME .equals (superTypeString )) {
750746 return fieldType ;
751747 }
752- if (superTypeString .startsWith (ENUM_CLASS_NAME )) {
753- // Necessary for Kotlin enums, otherwise this ends in an endless loop, e.g. java.lang.Enum<com.world.MyEnum>
754- return fieldType ;
755- }
756- TypeMirror result = getInsertedType (superType , checkIgnoredTypes );
748+ }
749+
750+ for (TypeMirror superType : typeMirrors ) {
751+ TypeMirror result = getInsertedType (eraseGenericIfNecessary (superType ), checkIgnoredTypes );
757752 if (result != null ) {
758753 // always return the passed in type and not any super type
759754 return fieldType ;
0 commit comments