当前位置: 首页>>代码示例>>Java>>正文


Java Method.getAccessFlags方法代码示例

本文整理汇总了Java中org.apache.bcel.classfile.Method.getAccessFlags方法的典型用法代码示例。如果您正苦于以下问题:Java Method.getAccessFlags方法的具体用法?Java Method.getAccessFlags怎么用?Java Method.getAccessFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bcel.classfile.Method的用法示例。


在下文中一共展示了Method.getAccessFlags方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
	super.visit(obj);
	int flags = obj.getAccessFlags();
	publicMethod = (flags & ACC_PUBLIC) != 0;
	protectedMethod = (flags & ACC_PROTECTED) != 0;
	synchronizedMethod = (flags & ACC_SYNCHRONIZED) != 0;
	if (synchronizedMethod)
		state = 1;
	else
		state = 0;
	fieldsWritten.clear();
	fieldsRead.clear();
	inConstructor = getMethodName().equals("<init>")
	        || getMethodName().equals("<clinit>")
	        || getMethodName().equals("readObject")
	        || getMethodName().equals("clone")
	        || getMethodName().equals("close")
	        || getMethodName().equals("finalize");
	/*
    privateMethod = (flags & ACC_PRIVATE) != 0
		    || methodName.startsWith("access$");
	*/

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:LockedFields.java

示例2: visit

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
	check = publicClass && (obj.getAccessFlags() & (ACC_PUBLIC)) != 0;
	if (!check) return;
	dangerousToStoreIntoField = false;
	staticMethod = (obj.getAccessFlags() & (ACC_STATIC)) != 0;
	//variableNames = obj.getLocalVariableTable();
	parameterCount = obj.getArgumentTypes().length;
	/*
	System.out.println(betterMethodName);
	for(int i = 0; i < parameterCount; i++)
		System.out.println("parameter " + i + ": " + obj.getArgumentTypes()[i]);
	*/

	if (!staticMethod) parameterCount++;

	for (int i = 0; i < parameterCount; i++)
		timesRead[i] = 0;
	thisOnTOS = false;
	fieldOnTOS = false;
	super.visit(obj);
	thisOnTOS = false;
	fieldOnTOS = false;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:FindReturnRef.java

示例3: visit

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
	int flags = obj.getAccessFlags();
	if ((flags & doNotConsider) != 0) return;
	String name = obj.getName();
	boolean isSynchronized = (flags & ACC_SYNCHRONIZED) != 0;
	/*
	String sig = obj.getSignature();
	char firstArg = sig.charAt(1);
	char returnValue = sig.charAt(1 + sig.indexOf(')'));
	boolean firstArgIsRef = (firstArg == 'L') || (firstArg == '[');
	boolean returnValueIsRef = (returnValue == 'L') || (returnValue == '[');

	System.out.println(className + "." + name
			+ " " +  firstArgIsRef
			+ " " +  returnValueIsRef
			+ " " + isSynchronized
			+ " " + isNative
			);
	*/
	if (name.startsWith("get")
	        && !isSynchronized
	// && returnValueIsRef
	) {
		getMethods.put(name.substring(3), MethodAnnotation.fromVisitedMethod(this));
	} else if (name.startsWith("set")
	        && isSynchronized
	// && firstArgIsRef
	) {
		setMethods.put(name.substring(3), MethodAnnotation.fromVisitedMethod(this));
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:FindUnsyncGet.java

示例4: visit

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
	if (DEBUG) System.out.println("FFI: visiting " + getFullyQualifiedMethodName());
	if (getMethodName().equals("finalize")
	        && getMethodSig().equals("()V")
	        && (obj.getAccessFlags() & (ACC_PUBLIC)) != 0
	)
		bugReporter.reportBug(new BugInstance(this, "FI_PUBLIC_SHOULD_BE_PROTECTED", NORMAL_PRIORITY).addClassAndMethod(this));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:9,代码来源:FindFinalizeInvocations.java

示例5: findImplementor

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public static JavaClass
        findImplementor(JavaClass[] clazz, String name, String signature) {

	for (int i = 0; i < clazz.length; i++) {
		Method m = findImplementation(clazz[i], name, signature);
		if (m != null) {
			if ((m.getAccessFlags() & ACC_ABSTRACT) != 0)
				return null;
			else
				return clazz[i];
		}
	}
	return null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:Lookup.java

示例6: visit

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
	int flags = obj.getAccessFlags();
	synchronizedMethod = (flags & ACC_SYNCHRONIZED) != 0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:FindNakedNotify.java

示例7: visit

import org.apache.bcel.classfile.Method; //导入方法依赖的package包/类
public void visit(Method obj) {
	int accessFlags = obj.getAccessFlags();
	if ((accessFlags & ACC_STATIC) != 0) return;
	String name = obj.getName();
	String sig = obj.getSignature();
	if ((accessFlags & ACC_ABSTRACT) != 0) {
		if (name.equals("equals")
		        && sig.equals("(L" + getClassName() + ";)Z")) {
			bugReporter.reportBug(new BugInstance(this, "EQ_ABSTRACT_SELF", LOW_PRIORITY).addClass(getDottedClassName()));
			return;
		} else if (name.equals("compareTo")
		        && sig.equals("(L" + getClassName() + ";)I")) {
			bugReporter.reportBug(new BugInstance(this, "CO_ABSTRACT_SELF", LOW_PRIORITY).addClass(getDottedClassName()));
			return;
		}
	}
	boolean sigIsObject = sig.equals("(Ljava/lang/Object;)Z");
	if (name.equals("hashCode")
	        && sig.equals("()I")) {
		hasHashCode = true;
		if (obj.isAbstract()) hashCodeIsAbstract = true;
		// System.out.println("Found hashCode for " + betterClassName);
	} else if (name.equals("equals")) {
		if (sigIsObject) {
			hasEqualsObject = true;
			if (obj.isAbstract())
				equalsObjectIsAbstract = true;
			else {
				Code code = obj.getCode();
				byte[] codeBytes = code.getCode();

				if ((codeBytes.length == 5 &&
				        (codeBytes[1] & 0xff) == INSTANCEOF)
				        || (codeBytes.length == 15 &&
				        (codeBytes[1] & 0xff) == INSTANCEOF &&
				        (codeBytes[11] & 0xff) == INVOKESPECIAL)) {
					equalsMethodIsInstanceOfEquals = true;
				}
			}
		} else if (sig.equals("(L" + getClassName() + ";)Z"))
			hasEqualsSelf = true;
	} else if (name.equals("compareTo")) {
		if (sig.equals("(Ljava/lang/Object;)I"))
			hasCompareToObject = true;
		else if (sig.equals("(L" + getClassName() + ";)I"))
			hasCompareToSelf = true;
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:49,代码来源:FindHEmismatch.java


注:本文中的org.apache.bcel.classfile.Method.getAccessFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。