Parcelable, Lint: Do not report "CREATOR field missing" warnings on our '@Parselize' Parcelables
This commit is contained in:
@@ -14,5 +14,6 @@
|
||||
<orderEntry type="library" name="guava" level="project" />
|
||||
<orderEntry type="library" name="intellij-core" level="project" />
|
||||
<orderEntry type="library" name="kotlin-runtime" level="project" />
|
||||
<orderEntry type="module" module-name="android-extensions-runtime" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -33,6 +33,7 @@ import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import kotlinx.android.parcel.Parcelize;
|
||||
import org.jetbrains.uast.UAnonymousClass;
|
||||
import org.jetbrains.uast.UClass;
|
||||
|
||||
@@ -94,6 +95,11 @@ public class ParcelDetector extends Detector implements Detector.UastScanner {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not report errors on our Android Extensions-improved Parcelables
|
||||
if (declaration.findAnnotation(Parcelize.class.getName()) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
PsiField field = declaration.findFieldByName("CREATOR", false);
|
||||
if (field == null) {
|
||||
Location location = context.getUastNameLocation(declaration);
|
||||
|
||||
Reference in New Issue
Block a user