org.adoptopenjdk.jitwatch.treevisitor.TreeVisitor 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-2015 Chris Newland.
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
*/
package org.adoptopenjdk.jitwatch.treevisitor;
import java.util.List;
import org.adoptopenjdk.jitwatch.model.IMetaMember;
import org.adoptopenjdk.jitwatch.model.IReadOnlyJITDataModel;
import org.adoptopenjdk.jitwatch.model.MetaClass;
import org.adoptopenjdk.jitwatch.model.MetaPackage;
public final class TreeVisitor
{
private TreeVisitor()
{
}
public static void walkTree(IReadOnlyJITDataModel model, ITreeVisitable visitable)
{
visitable.reset();
List roots = model.getPackageManager().getRootPackages();
for (MetaPackage mp : roots)
{
walkPackage(mp, visitable);
}
}
private static void walkPackage(MetaPackage mp, ITreeVisitable visitable)
{
List childPackages = mp.getChildPackages();
for (MetaPackage childPackage : childPackages)
{
walkPackage(childPackage, visitable);
}
List packageClasses = mp.getPackageClasses();
for (MetaClass mc : packageClasses)
{
for (IMetaMember mm : mc.getMetaMembers())
{
visitable.visit(mm);
}
}
}
}