All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.adoptopenjdk.jitwatch.model.MetaMethod Maven / Gradle / Ivy

Go to download

A Maven plugin that scans the project artifact and its dependencies for methods that cannot be inlined by the JIT compiler. It uses the JarScan utility from the JITWatch project to do that. See https://github.com/AdoptOpenJDK/jitwatch .

There is a newer version: 1.1
Show newest version
/*
 * Copyright (c) 2013, 2014 Chris Newland.
 * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
 * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
 */
package org.adoptopenjdk.jitwatch.model;

import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.DEBUG_MEMBER_CREATION;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;

public class MetaMethod extends AbstractMetaMember
{
    private String methodToString;

    public MetaMethod(Method method, MetaClass methodClass)
    {
        this.methodToString = method.toString();
        this.metaClass = methodClass;

        memberName = method.getName();
        returnType = method.getReturnType();
        paramTypes = Arrays.asList(method.getParameterTypes());

        // Can include non-method modifiers such as volatile so AND with
        // acceptable values
        modifier = method.getModifiers() & Modifier.methodModifiers();

        isVarArgs = method.isVarArgs();

        checkPolymorphicSignature(method);

        if (DEBUG_MEMBER_CREATION)
        {
        	logger.debug("Created MetaMethod: {}", toString());
        }
    }

    @Override
    public String toString()
    {
        String methodSigWithoutThrows = methodToString;

        int closingParentheses = methodSigWithoutThrows.indexOf(')');

        if (closingParentheses != methodSigWithoutThrows.length() - 1)
        {
            methodSigWithoutThrows = methodSigWithoutThrows.substring(0, closingParentheses + 1);
        }

        return methodSigWithoutThrows;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy