Java Code Examples for org.jboss.jandex.MethodInfo#flags()

The following examples show how to use org.jboss.jandex.MethodInfo#flags() . 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: Methods.java    From quarkus with Apache License 2.0 4 votes vote down vote up
static boolean isSynthetic(MethodInfo method) {
    return (method.flags() & SYNTHETIC) != 0;
}
 
Example 2
Source File: ValueResolverGenerator.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public static boolean isVarArgs(MethodInfo method) {
    return (method.flags() & 0x00000080) != 0;
}
 
Example 3
Source File: TypeUtil.java    From serianalyzer with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param methodReference
 * @param impl
 * @return
 */
static boolean implementsMethod ( MethodReference methodReference, ClassInfo impl ) {
    byte[] mnameb = methodReference.getMethod().getBytes(StandardCharsets.UTF_8);

    for ( MethodInfo i : impl.methods() ) {
        if ( ( i.flags() & Modifier.ABSTRACT ) != 0 ) {
            continue;
        }
        // this decodes the name every time
        byte[] inameb;
        try {
            inameb = (byte[]) NAME_BYTES.invoke(METHOD_INTERNAL.get(i));
        }
        catch ( Throwable e ) {
            e.printStackTrace();
            return false;
        }
        if ( Arrays.equals(mnameb, inameb) ) {
            // ACC_VARARGS
            if ( ( i.flags() & 0x80 ) != 0 ) {
                return true;
            }
            String sig2;
            try {
                sig2 = makeSignature(i, false);
                if ( sig2.equals(methodReference.getSignature()) ) {
                    return true;
                }

                if ( log.isTraceEnabled() ) {
                    log.trace("Signature mismatch " + methodReference.getSignature() + " vs " + sig2); //$NON-NLS-1$ //$NON-NLS-2$
                }

                if ( "<init>".equals(methodReference.getMethod()) ) { //$NON-NLS-1$
                    sig2 = makeSignature(i, true);
                    if ( sig2.equals(methodReference.getSignature()) ) {
                        return true;
                    }
                }
            }
            catch ( SerianalyzerException e1 ) {
                log.warn("Failed to generate signature", e1); //$NON-NLS-1$
            }

            return true;
        }
    }
    if ( log.isTraceEnabled() ) {
        log.trace("Not found in " + impl.name() + ": " + methodReference); //$NON-NLS-1$//$NON-NLS-2$
    }
    return false;
}