Java Code Examples for com.sun.tools.javac.code.Symbol.MethodSymbol#isMemberOf()

The following examples show how to use com.sun.tools.javac.code.Symbol.MethodSymbol#isMemberOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavacElements.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@DefinedBy(Api.LANGUAGE_MODEL)
public boolean overrides(ExecutableElement riderEl,
                         ExecutableElement rideeEl, TypeElement typeEl) {
    MethodSymbol rider = cast(MethodSymbol.class, riderEl);
    MethodSymbol ridee = cast(MethodSymbol.class, rideeEl);
    ClassSymbol origin = cast(ClassSymbol.class, typeEl);

    return rider.name == ridee.name &&

           // not reflexive as per JLS
           rider != ridee &&

           // we don't care if ridee is static, though that wouldn't
           // compile
           !rider.isStatic() &&

           // Symbol.overrides assumes the following
           ridee.isMemberOf(origin, types) &&

           // check access and signatures; don't check return types
           rider.overrides(ridee, origin, types, false);
}
 
Example 2
Source File: WorkArounds.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public boolean overrides(ExecutableElement e1, ExecutableElement e2, TypeElement cls) {
    MethodSymbol rider = (MethodSymbol)e1;
    MethodSymbol ridee = (MethodSymbol)e2;
    ClassSymbol origin = (ClassSymbol)cls;

    return rider.name == ridee.name &&

           // not reflexive as per JLS
           rider != ridee &&

           // we don't care if ridee is static, though that wouldn't
           // compile
           !rider.isStatic() &&

           // Symbol.overrides assumes the following
           ridee.isMemberOf(origin, toolEnv.getTypes()) &&

           // check access, signatures and check return types
           rider.overrides(ridee, origin, toolEnv.getTypes(), true);
}