org.adoptopenjdk.jitwatch.model.MetaConstructor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jitwatch-jarscan-maven-plugin Show documentation
Show all versions of jitwatch-jarscan-maven-plugin Show documentation
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 .
The newest version!
/*
* Copyright (c) 2013-2016 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.Constructor;
import java.util.Arrays;
import org.adoptopenjdk.jitwatch.core.JITWatchConstants;
import org.adoptopenjdk.jitwatch.util.StringUtil;
public class MetaConstructor extends AbstractMetaMember
{
private String constructorToString;
public MetaConstructor(Constructor> constructor, MetaClass methodClass)
{
super(StringUtil.getUnqualifiedMemberName(constructor.getName()));
this.constructorToString = constructor.toString();
this.metaClass = methodClass;
returnType = Void.TYPE;
paramTypes = Arrays.asList(constructor.getParameterTypes());
modifier = constructor.getModifiers();
if (DEBUG_MEMBER_CREATION)
{
logger.debug("Created MetaConstructor: {}", toString());
}
}
@Override
public String toString()
{
String methodSigWithoutThrows = constructorToString;
int closingParentheses = methodSigWithoutThrows.indexOf(JITWatchConstants.S_CLOSE_PARENTHESES);
if (closingParentheses != methodSigWithoutThrows.length() - 1)
{
methodSigWithoutThrows = methodSigWithoutThrows.substring(0, closingParentheses + 1);
}
return methodSigWithoutThrows;
}
}