• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download

<lambda>null1 package com.android.tools.metalava.doclava1
2 
3 import com.android.tools.metalava.model.Item
4 import com.android.tools.metalava.model.MethodItem
5 
6 import java.util.function.Predicate
7 
8 // Ported from doclava1
9 
10 /**
11  * Filter that will elide exact duplicate methods that are already included
12  * in another superclass/interfaces.
13  */
14 class ElidingPredicate(private val wrapped: Predicate<Item>) : Predicate<Item> {
15 
16     override fun test(method: Item): Boolean {
17         // This method should be included, but if it's an exact duplicate
18         // override then we can elide it.
19         return if (method is MethodItem && !method.isConstructor()) {
20             val differentSuper = method.findPredicateSuperMethod(Predicate { test ->
21                 // We're looking for included and perfect signature
22                 wrapped.test(test) &&
23                     test is MethodItem &&
24                     MethodItem.sameSignature(method, test, false)
25             })
26             differentSuper == null
27         } else {
28             true
29         }
30     }
31 }
32