2015-04-07 16:53 GMT-03:00 'Tor Norbye' via adt-dev <
[email protected]>:
> Use JavaContext.resolve(node) to look up the type-resolved class, and from
> the resulting ResolvedClass you can do hierarchy checks (look at the
> methods on ResolvedClass).
>
Txs, Tor.
It works with just some fix.
public boolean visitClassDeclaration(ClassDeclaration node) {
ResolvedNode rNode = mContext.resolve(node);
ResolvedClass rClass = (ResolvedClass) rNode;
boolean isFragmentActivity =
rClass.isSubclassOf("android.support.v4.app.FragmentActivity", false);
// some code mode...
}
>
> On Mon, Mar 30, 2015 at 8:18 AM, Adorilson Bezerra de Araújo <
> [email protected]> wrote:
>
>> Hi,
>>
>> how can I check if a class is subclasse another in Lint?
>>
>> For a direct extends, I use node.astExtending() in visitClassDeclaration
>> method.
>> But is doesn't works for indirect subclass. Then, I tried
>> LintClient.isSubclassOf[0], but
>> is doesn't works too. It's always returns "null".
>>
>> There a any LintClient subclass that override this method?
>>
>> Someone help me? Thanks.
>>
>> [0]
>> https://android.googlesource.com/platform/tools/base/+/master/lint/libs/lint-api/src/main/java/com/android/tools/lint/client/api/LintClient.java
>>
>>
>> --
>> Adorilson Bezerra
>> Mestrando em Engenharia de Software
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
--
Adorilson Bezerra
Mestrando em Engenharia de Software
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.