本文整理汇总了Java中java.lang.reflect.Modifier.isNative方法的典型用法代码示例。如果您正苦于以下问题:Java Modifier.isNative方法的具体用法?Java Modifier.isNative怎么用?Java Modifier.isNative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.reflect.Modifier
的用法示例。
在下文中一共展示了Modifier.isNative方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStartMethods
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* 获取前缀相同的方法
*
* 只获取"本类自己"的方法
*
* @param i_Class
* @param i_MethodPrefixName
* @return
*/
public static List<Method> getStartMethods(Class<?> i_Class ,String i_MethodPrefixName)
{
List<Method> v_Ret = new ArrayList<Method>();
Method [] v_Methods = i_Class.getMethods();
for (int i=0; i<v_Methods.length; i++)
{
// 只获取"本类自己"的方法
if ( !Modifier.isNative(v_Methods[i].getModifiers()) )
{
if ( v_Methods[i].getName().startsWith(i_MethodPrefixName) )
{
v_Ret.add(v_Methods[i]);
}
}
}
return v_Ret;
}
示例2: canBeCompiled
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* Helper method for CompileTheWorld to determine if a method should be compiled (Cf.
* CompilationPolicy::can_be_compiled).
*
* @return true if it can be compiled, false otherwise
*/
private static boolean canBeCompiled(HotSpotResolvedJavaMethod javaMethod, int modifiers) {
if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
return false;
}
// This number is from HotSpot:
final int hugeMethodLimit = 8000;
if (javaMethod.getCodeSize() > hugeMethodLimit) {
return false;
}
// Skip @Snippets for now
if (javaMethod.getAnnotation(Snippet.class) != null) {
return false;
}
return true;
}
示例3: checkGetter
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
private static boolean checkGetter(Method method) {
int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers)) {
return true;
}
if (Modifier.isNative(modifiers)) {
return true;
}
if (Modifier.isAbstract(modifiers)) {
return true;
}
if (method.getReturnType().equals(Void.TYPE)) {
return true;
}
if (method.getParameterTypes().length != 0) {
return true;
}
if (method.getReturnType() == ClassLoader.class) {
return true;
}
if (method.getName().equals("getClass")) {
return true;
}
return false;
}
示例4: checkSetter
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
private static boolean checkSetter(Method method, Field field) {
int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers)) {
return true;
}
if (Modifier.isNative(modifiers)) {
return true;
}
if (Modifier.isAbstract(modifiers)) {
return true;
}
if (!method.getReturnType().equals(Void.TYPE)) {
return true;
}
if (method.getParameterTypes().length != 1) {
return true;
}
if (!method.getParameterTypes()[0].equals(field.getType())) {
return true;
}
return false;
}
示例5: testBailoutUsage
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
@SuppressWarnings("try")
private static void testBailoutUsage(Class<?> c) {
RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
Providers providers = rt.getHostBackend().getProviders();
MetaAccessProvider metaAccess = providers.getMetaAccess();
PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
Plugins plugins = new Plugins(new InvocationPlugins());
GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
OptionValues options = getInitialOptions();
DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
for (Method m : c.getDeclaredMethods()) {
if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
graphBuilderSuite.apply(graph, context);
try (DebugCloseable s = debug.disableIntercept()) {
new VerifyBailoutUsage().apply(graph, context);
}
}
}
}
示例6: canBeCompiled
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* Determines if a method should be compiled (Cf. CompilationPolicy::can_be_compiled).
*
* @return true if it can be compiled, false otherwise
*/
private boolean canBeCompiled(HotSpotResolvedJavaMethod javaMethod, int modifiers) {
if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
return false;
}
GraalHotSpotVMConfig c = compiler.getGraalRuntime().getVMConfig();
if (c.dontCompileHugeMethods && javaMethod.getCodeSize() > c.hugeMethodLimit) {
println(verbose || methodFilters != null,
String.format("CompileTheWorld (%d) : Skipping huge method %s (use -XX:-DontCompileHugeMethods or -XX:HugeMethodLimit=%d to include it)", classFileCounter,
javaMethod.format("%H.%n(%p):%r"),
javaMethod.getCodeSize()));
return false;
}
// Allow use of -XX:CompileCommand=dontinline to exclude problematic methods
if (!javaMethod.canBeInlined()) {
return false;
}
// Skip @Snippets for now
for (Annotation annotation : javaMethod.getAnnotations()) {
if (annotation.annotationType().equals(Snippet.class)) {
return false;
}
}
return true;
}
示例7: getJavaSubstitute
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* Gets the reflection API version of the substitution method.
*/
Method getJavaSubstitute() throws GraalError {
Method substituteMethod = lookupSubstitute();
int modifiers = substituteMethod.getModifiers();
if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
throw new GraalError("Substitution method must not be abstract or native: " + substituteMethod);
}
if (!Modifier.isStatic(modifiers)) {
throw new GraalError("Substitution method must be static: " + substituteMethod);
}
return substituteMethod;
}
示例8: runSanityTest
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
private static void runSanityTest(Executable aMethod, int[] bcis) {
HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
String className = aMethod.getDeclaringClass().getName();
String methodName = aMethod.getName().equals(className)
? "<init>"
: aMethod.getName();
String fileName = getFileName(className);
Map<Integer, Integer> bciWithLineNumber = CTVMUtilities
.getBciToLineNumber(aMethod);
boolean isNative = Modifier.isNative(aMethod.getModifiers());
int lineNumber = -1;
for (int bci : bcis) {
StackTraceElement ste = CompilerToVMHelper
.getStackTraceElement(method, bci);
Asserts.assertNotNull(ste, aMethod + " : got null StackTraceElement"
+ " at bci " + bci);
Asserts.assertEQ(className, ste.getClassName(), aMethod
+ " : unexpected class name");
Asserts.assertEQ(fileName, ste.getFileName(), aMethod
+ " : unexpected filename");
Asserts.assertEQ(methodName, ste.getMethodName(), aMethod
+ " : unexpected method name");
Asserts.assertEQ(isNative, ste.isNativeMethod(), aMethod
+ " : unexpected 'isNative' value");
if (bciWithLineNumber.size() > 0) {
if (bciWithLineNumber.containsKey(bci)) {
lineNumber = bciWithLineNumber.get(bci);
}
Asserts.assertEQ(lineNumber, ste.getLineNumber(), aMethod
+ " : unexpected line number");
} else {
// native and abstract function
Asserts.assertGT(0, ste.getLineNumber(),
aMethod + " : unexpected line number for abstract "
+ "or native method");
}
}
}
示例9: isNative
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* @see Modifier#isNative(int)
*/
default boolean isNative() {
return Modifier.isNative(getModifiers());
}
示例10: isNative
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/** Returns true if the element is native. */
public final boolean isNative() {
return Modifier.isNative(getModifiers());
}
示例11: isAllModifiersContainSpecificModifier
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
public static boolean isAllModifiersContainSpecificModifier(int allModifiers, int specificModifier) {
if (Modifier.isAbstract(allModifiers) && Modifier.isAbstract(specificModifier))
return true;
if (Modifier.isFinal(allModifiers) && Modifier.isFinal(specificModifier))
return true;
if (Modifier.isInterface(allModifiers) && Modifier.isInterface(specificModifier))
return true;
if (Modifier.isNative(allModifiers) && Modifier.isNative(specificModifier))
return true;
if (Modifier.isPrivate(allModifiers) && Modifier.isPrivate(specificModifier))
return true;
if (Modifier.isProtected(allModifiers) && Modifier.isProtected(specificModifier))
return true;
if (Modifier.isPublic(allModifiers) && Modifier.isPublic(specificModifier))
return true;
if (Modifier.isStatic(allModifiers) && Modifier.isStatic(specificModifier))
return true;
if (Modifier.isStrict(allModifiers) && Modifier.isStrict(specificModifier))
return true;
if (Modifier.isSynchronized(allModifiers) && Modifier.isSynchronized(specificModifier))
return true;
if (Modifier.isTransient(allModifiers) && Modifier.isTransient(specificModifier))
return true;
if (Modifier.isVolatile(allModifiers) && Modifier.isVolatile(specificModifier))
return true;
if (Modifier.isVolatile(allModifiers) && Modifier.isVolatile(specificModifier))
return true;
return false;
}
示例12: isNative
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/** Utility method to query the modifier flags of this member. */
public boolean isNative() {
return Modifier.isNative(flags);
}
示例13: isNative
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/** Return true if the method includes the {@code native} modifier. */
public boolean isNative () {
return Modifier.isNative(method.getModifiers());
}
示例14: isNative
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* Return true if this method is native
*/
public boolean isNative() {
return Modifier.isNative(getModifiers());
}
示例15: isNative
import java.lang.reflect.Modifier; //导入方法依赖的package包/类
/**
* Return true if the method includes the {@code native} modifier.
*/
public boolean isNative() {
return Modifier.isNative(method.getModifiers());
}