本文整理了Java中org.apache.bcel.classfile.Method.isPrivate()
方法的一些代码示例,展示了Method.isPrivate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Method.isPrivate()
方法的具体详情如下:
包路径:org.apache.bcel.classfile.Method
类名称:Method
方法名:isPrivate
暂无
代码示例来源:origin: spotbugs/spotbugs
/**
* Checks if the method could be a lambda. Notice this is a best-check,
* since once compiled lambda methods are not univocally distinguishable.
*
* @param m The method to check if it's a lambda
* @return True if this could be a lambda, false otherwise
*/
public static boolean couldBeLambda(final Method m) {
return m.isPrivate() && internalIsSynthetic(m);
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visitMethod(Method obj) {
if (!obj.isPrivate() || obj.isSynthetic()) {
return;
}
super.visitMethod(obj);
String methodName = getMethodName();
if (!"writeReplace".equals(methodName) && !"readResolve".equals(methodName)
&& !"readObject".equals(methodName) && !"readObjectNoData".equals(methodName)
&& !"writeObject".equals(methodName)
&& methodName.indexOf("debug") == -1 && methodName.indexOf("Debug") == -1
&& methodName.indexOf("trace") == -1 && methodName.indexOf("Trace") == -1
&& !Const.CONSTRUCTOR_NAME.equals(methodName) && !Const.STATIC_INITIALIZER_NAME.equals(methodName)) {
for(AnnotationEntry a : obj.getAnnotationEntries()) {
String typeName = a.getAnnotationType();
if ("Ljavax/annotation/PostConstruct;".equals(typeName)
|| "Ljavax/annotation/PreDestroy;".equals(typeName)) {
return;
}
}
definedPrivateMethods.add(MethodAnnotation.fromVisitedMethod(this));
}
}
代码示例来源:origin: spotbugs/spotbugs
public static Method findImplementation(JavaClass clazz, String name, String signature) {
Method[] m = clazz.getMethods();
for (Method aM : m) {
if (aM.getName().equals(name) && aM.getSignature().equals(signature) && !aM.isPrivate() && !aM.isStatic()) {
return aM;
}
}
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
return true;
if (obj.isPrivate()) {
return true;
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Code obj) {
if (isDoPrivileged && "run".equals(getMethodName())) {
return;
}
if (getMethod().isPrivate()) {
return;
}
if (DumbMethods.isTestMethod(getMethod())) {
return;
}
super.visit(obj);
bugAccumulator.reportAccumulatedBugs();
}
代码示例来源:origin: spotbugs/spotbugs
public void addAllDefinitions(JavaClass obj) {
String className2 = obj.getClassName();
defined.add(className2);
for (Method m : obj.getMethods()) {
if (!m.isPrivate()) {
String name = getMemberName(obj, className2, m.getNameIndex(), m.getSignatureIndex());
defined.add(name);
}
}
for (Field f : obj.getFields()) {
if (!f.isPrivate()) {
String name = getMemberName(obj, className2, f.getNameIndex(), f.getSignatureIndex());
defined.add(name);
}
}
}
代码示例来源:origin: spotbugs/spotbugs
&& dangerousCallTargetList.get(0).getMethod().isPrivate();
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Code obj) {
if (!directChildOfTestCase && (getMethodName().equals("setUp") || getMethodName().equals("tearDown"))
&& !getMethod().isPrivate() && getMethodSig().equals("()V")) {
sawSuperCall = false;
super.visit(obj);
if (sawSuperCall) {
return;
}
JavaClass we = Lookup.findSuperImplementor(getThisClass(), getMethodName(), "()V", bugReporter);
if (we != null && !we.getClassName().equals("junit.framework.TestCase")) {
// OK, got a bug
int offset = 0;
if (getMethodName().equals("tearDown")) {
offset = obj.getCode().length - 1;
}
Method superMethod = Lookup.findImplementation(we, getMethodName(), "()V");
Code superCode = superMethod.getCode();
if (superCode != null && superCode.getCode().length > 3) {
bugReporter.reportBug(new BugInstance(this, getMethodName().equals("setUp") ? "IJU_SETUP_NO_SUPER"
: "IJU_TEARDOWN_NO_SUPER", NORMAL_PRIORITY).addClassAndMethod(this).addMethod(we, superMethod)
.describe(MethodAnnotation.METHOD_OVERRIDDEN).addSourceLine(this, offset));
}
}
}
}
代码示例来源:origin: spotbugs/spotbugs
if (DEBUG && !obj.isPrivate()) {
System.out.println("Non-private readExternal method in: " + getDottedClassName());
if (DEBUG && !obj.isPrivate()) {
System.out.println("Non-private writeExternal method in: " + getDottedClassName());
} else if (obj.isStatic()) {
bugReporter.reportBug(new BugInstance(this, "SE_READ_RESOLVE_IS_STATIC", HIGH_PRIORITY).addClassAndMethod(this));
} else if (obj.isPrivate()) {
try {
Set<ClassDescriptor> subtypes = AnalysisContext.currentAnalysisContext().getSubtypes2()
&& isSerializable) {
sawReadObject = true;
if (!obj.isPrivate()) {
bugReporter.reportBug(new BugInstance(this, "SE_METHOD_MUST_BE_PRIVATE", isExternalizable ? NORMAL_PRIORITY : HIGH_PRIORITY).addClassAndMethod(this));
if (!obj.isPrivate()) {
bugReporter.reportBug(new BugInstance(this, "SE_METHOD_MUST_BE_PRIVATE", isExternalizable ? NORMAL_PRIORITY : HIGH_PRIORITY).addClassAndMethod(this));
&& isSerializable) {
sawWriteObject = true;
if (!obj.isPrivate()) {
bugReporter.reportBug(new BugInstance(this, "SE_METHOD_MUST_BE_PRIVATE", isExternalizable ? NORMAL_PRIORITY : HIGH_PRIORITY).addClassAndMethod(this));
代码示例来源:origin: spotbugs/spotbugs
return;
if (obj.isPrivate()) {
return;
if (obj.isPrivate() || obj.isStatic() || Const.CONSTRUCTOR_NAME.equals(mName)) {
return;
代码示例来源:origin: spotbugs/spotbugs
&& getSigConstantOperand().equals(getMethodSig())
&& (seen == Const.INVOKESTATIC) == getMethod().isStatic()
&& (seen == Const.INVOKESPECIAL) == (getMethod().isPrivate() && !getMethod().isStatic() || Const.CONSTRUCTOR_NAME.equals(getMethodName()))) {
Type arguments[] = getMethod().getArgumentTypes();
代码示例来源:origin: spotbugs/spotbugs
superClinitCall();
if (!method.isStatic() && !method.isPrivate() && !method.isFinal() && !constructor && subtypes != null) {
for (ClassDescriptor subtype : subtypes) {
try {
代码示例来源:origin: spotbugs/spotbugs
priority--;
if (getThisClass().isPrivate() || getMethod().isPrivate()) {
priority++;
&& (isConstructor || data.calledFromConstructors.contains(getMethodName() + ":" + getMethodSig())
|| "init".equals(getMethodName()) || "initialize".equals(getMethodName())
|| getMethod().isPrivate())) {
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visit(Code code) {
if(!testingEnabled){
return;
}
if (getMethod().isStatic() || getMethod().isPrivate()) {
return;
}
XMethod overrides = Lookup.findSuperImplementorAsXMethod(getThisClass(), getMethodName(), getMethodSig(), bugReporter);
if (overrides == null) {
return;
}
AnnotationValue annotation = overrides.getAnnotation(mustOverrideAnnotation);
if (annotation == null) {
return;
}
sawCallToSuper = false;
super.visit(code);
if (!sawCallToSuper) {
bugReporter.reportBug(new BugInstance(this, "TESTING", NORMAL_PRIORITY).addClassAndMethod(this).addString(
"Method must invoke override method in superclass"));
}
}
代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib
@Nullable
private static JavaClass findInheritedMethod(JavaClass[] classes, String methodName, String signature) {
for (JavaClass cls : classes) {
if (cls != null) {
Method[] methods = cls.getMethods();
for (Method m : methods) {
if (!m.isPrivate() && m.getName().equals(methodName) && m.getSignature().equals(signature)) {
return cls;
}
}
}
}
return null;
}
代码示例来源:origin: mebigfatguy/fb-contrib
@Nullable
private static JavaClass findInheritedMethod(JavaClass[] classes, String methodName, String signature) {
for (JavaClass cls : classes) {
if (cls != null) {
Method[] methods = cls.getMethods();
for (Method m : methods) {
if (!m.isPrivate() && m.getName().equals(methodName) && m.getSignature().equals(signature)) {
return cls;
}
}
}
}
return null;
}
代码示例来源:origin: com.google.code.findbugs/findbugs
@Override
public void visitMethod(Method obj) {
if (!obj.isPrivate() || obj.isSynthetic()) {
return;
}
super.visitMethod(obj);
String methodName = getMethodName();
if (!"writeReplace".equals(methodName) && !"readResolve".equals(methodName)
&& !"readObject".equals(methodName) && !"readObjectNoData".equals(methodName)
&& !"writeObject".equals(methodName)
&& methodName.indexOf("debug") == -1 && methodName.indexOf("Debug") == -1
&& methodName.indexOf("trace") == -1 && methodName.indexOf("Trace") == -1
&& !"<init>".equals(methodName) && !"<clinit>".equals(methodName)) {
for(AnnotationEntry a : obj.getAnnotationEntries()) {
String typeName = a.getAnnotationType();
if ("Ljavax/annotation/PostConstruct;".equals(typeName)
|| "Ljavax/annotation/PreDestroy;".equals(typeName)) {
return;
}
}
definedPrivateMethods.add(MethodAnnotation.fromVisitedMethod(this));
}
}
代码示例来源:origin: com.google.code.findbugs/findbugs
public static Method findImplementation(JavaClass clazz, String name, String signature) {
Method[] m = clazz.getMethods();
for (Method aM : m) {
if (aM.getName().equals(name) && aM.getSignature().equals(signature) && !aM.isPrivate() && !aM.isStatic()) {
return aM;
}
}
return null;
}
}
代码示例来源:origin: com.google.code.findbugs/findbugs
@Override
public void visit(Code obj) {
if (isDoPrivileged && "run".equals(getMethodName())) {
return;
}
if (getMethod().isPrivate()) {
return;
}
if (DumbMethods.isTestMethod(getMethod())) {
return;
}
super.visit(obj);
bugAccumulator.reportAccumulatedBugs();
}
代码示例来源:origin: com.google.code.findbugs/findbugs
public void addAllDefinitions(JavaClass obj) {
String className2 = obj.getClassName();
defined.add(className2);
for (Method m : obj.getMethods()) {
if (!m.isPrivate()) {
String name = getMemberName(obj, className2, m.getNameIndex(), m.getSignatureIndex());
defined.add(name);
}
}
for (Field f : obj.getFields()) {
if (!f.isPrivate()) {
String name = getMemberName(obj, className2, f.getNameIndex(), f.getSignatureIndex());
defined.add(name);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!