/** * Convert to an XMethod. */ public XMethod toXMethod() { return XFactory.createXMethod(javaClass, method); }
/** * Convert to an XMethod. * * @return an XMethod specifying the same method as this MethodAnnotation */ public XMethod toXMethod() { return XFactory.createXMethod(className, methodName, methodSig, isStatic); }
/** * Constructor. * * @param jClass * the class containing the method that is unprofitable to * analyze * @param method * the method that is unprofitable to analyze */ public MethodUnprofitableException(JavaClass jClass, Method method) { super("Appears unprofitable to analyze " + method); this.method = XFactory.createXMethod(jClass, method); }
@Override public XMethod resolveAccessMethodForMethod() { MethodDescriptor access = getAccessMethodForMethod(); if (access != null) { return XFactory.createXMethod(access); } return this; } }
@Override public XMethod resolveAccessMethodForMethod() { MethodDescriptor access = getAccessMethodForMethod(); if (access != null) { return XFactory.createXMethod(access); } return this; }
public void addCalledMethod(MethodDescriptor m) { assert m.getClassDescriptor().getClassName().indexOf('.') == -1; calledMethods.add(createXMethod(m)); }
@Override protected void writeKey(Writer writer, MethodDescriptor method) throws IOException { writer.write(method.getClassDescriptor().toDottedClassName()); writer.write(","); writer.write(method.getName()); writer.write(","); writer.write(method.getSignature()); writer.write(","); XMethod xMethod = XFactory.createXMethod(method); writer.write(Integer.toString(xMethod.getAccessFlags() & 0xf)); } }
@Override public void visitSyntheticParameterAnnotation(int p, boolean runtimeVisible) { if (database == null) { return; } XMethod xmethod = XFactory.createXMethod(this); XMethodParameter xparameter = new XMethodParameter(xmethod, p); database.addDirectAnnotation(xparameter, NullnessAnnotation.UNKNOWN_NULLNESS); }
/** * Constructor. * * @param method * the method that is unprofitable to analyze */ public MethodUnprofitableException(JavaClassAndMethod method) { super("Appears unprofitable to analyze " + method); this.method = XFactory.createXMethod(method.getJavaClass(), method.getMethod()); }
/** * Create an XMethod object from the method currently being visited by the * given PreorderVisitor. * * @param visitor * the PreorderVisitor * @return the XMethod representing the method currently being visited */ public static XMethod createXMethod(PreorderVisitor visitor) { JavaClass javaClass = visitor.getThisClass(); Method method = visitor.getMethod(); XMethod m = createXMethod(javaClass, method); return m; }
public static XMethod createXMethod(JavaClassAndMethod classAndMethod) { return createXMethod(classAndMethod.getJavaClass(), classAndMethod.getMethod()); }
public static @CheckForNull XMethod definedIn(JavaClass clazz, XMethod m) { for (Method m2 : clazz.getMethods()) { if (m.getName().equals(m2.getName()) && m.getSignature().equals(m2.getSignature()) && m.isStatic() == m2.isStatic()) { return XFactory.createXMethod(clazz, m2); } } return null; }
public static NullnessAnnotation getMethodNullnessAnnotation(ClassContext classContext, Method method) { if (method.getSignature().indexOf(")L") >= 0 || method.getSignature().indexOf(")[") >= 0) { XMethod m = XFactory.createXMethod(classContext.getJavaClass(), method); return AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase().getResolvedAnnotation(m, false); } return NullnessAnnotation.UNKNOWN_NULLNESS; }
public static XMethod createXMethod(MethodGen methodGen) { String className = methodGen.getClassName(); String methodName = methodGen.getName(); String methodSig = methodGen.getSignature(); int accessFlags = methodGen.getAccessFlags(); return createXMethod(className, methodName, methodSig, accessFlags); }
/** * @param className * @param methodName * @param methodSig * @param isStatic * @return the created XMethod */ public static XMethod createXMethodUsingSlashedClassName(@SlashedClassName String className, String methodName, String methodSig, boolean isStatic) { assertSlashedClassName(className); MethodDescriptor desc = DescriptorFactory.instance().getMethodDescriptor(className, methodName, methodSig, isStatic); return createXMethod(desc); }
@Nonnull public BugInstance lowerPriorityIfDeprecated() { MethodAnnotation m = getPrimaryMethod(); if (m != null && XFactory.createXMethod(m).isDeprecated()) { lowerPriority(); } FieldAnnotation f = getPrimaryField(); if (f != null && XFactory.createXField(f).isDeprecated()) { lowerPriority(); } return this; }
private void addPropertiesForMethodContainingWarning(WarningPropertySet<WarningProperty> propertySet) { XMethod xMethod = XFactory.createXMethod(classContext.getJavaClass(), method); boolean uncallable = !AnalysisContext.currentXFactory().isCalledDirectlyOrIndirectly(xMethod) && xMethod.isPrivate(); if (uncallable) { propertySet.addProperty(GeneralWarningProperty.IN_UNCALLABLE_METHOD); } }
private void addPropertiesForMethodContainingWarning(WarningPropertySet<WarningProperty> propertySet) { XMethod xMethod = XFactory.createXMethod(classContext.getJavaClass(), method); boolean uncallable = !AnalysisContext.currentXFactory().isCalledDirectlyOrIndirectly(xMethod) && xMethod.isPrivate(); if (uncallable) { propertySet.addProperty(GeneralWarningProperty.IN_UNCALLABLE_METHOD); } }
/** * @param className * @param methodName * @param methodSig * @param isStatic * @return the created XMethod */ public static XMethod createXMethod(@DottedClassName String className, String methodName, String methodSig, boolean isStatic) { assertDottedClassName(className); MethodDescriptor desc = DescriptorFactory.instance().getMethodDescriptor(ClassName.toSlashedClassName(className), methodName, methodSig, isStatic); return createXMethod(desc); }
/** * Constructor. * * @param methodDescriptor * the MethodDescriptor indicating the method it is unprofitable * to analyze */ public MethodUnprofitableException(MethodDescriptor methodDescriptor) { super("Appears unprofitable to analyze " + methodDescriptor.toString()); this.method = XFactory.createXMethod(methodDescriptor.getClassDescriptor().toDottedClassName(), methodDescriptor.getName(), methodDescriptor.getSignature(), methodDescriptor.isStatic()); }