public @CheckForNull NullnessAnnotation getDirectAnnotation(Object o) { Profiler profiler = Global.getAnalysisCache().getProfiler(); profiler.start(this.getClass()); try { if (DEBUG) { System.out.println("getDirectAnnotation: o=" + o + "..."); } TypeQualifierAnnotation tqa = null; if (o instanceof XMethodParameter) { XMethodParameter param = (XMethodParameter) o; tqa = TypeQualifierApplications.getDirectTypeQualifierAnnotation(param.getMethod(), param.getParameterNumber(), nonnullTypeQualifierValue); } else if (o instanceof XMethod || o instanceof XField) { tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o, nonnullTypeQualifierValue); } NullnessAnnotation result = toNullnessAnnotation(tqa); if (DEBUG) { if (result == null) { System.out.println(" ===> not found"); } else { System.out.println(" ===> " + tqa + "/" + result.toString() ); } } return result; } finally { profiler.end(this.getClass()); } }
@Override public NullnessAnnotation getResolvedAnnotation(Object o, boolean getMinimal) { Profiler profiler = Global.getAnalysisCache().getProfiler(); profiler.start(this.getClass()); try { if (DEBUG) { System.out.println("getResolvedAnnotation: o=" + o + "..."); } TypeQualifierAnnotation tqa = null; if (o instanceof XMethodParameter) { XMethodParameter param = (XMethodParameter) o; tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(param.getMethod(), param.getParameterNumber(), nonnullTypeQualifierValue); } else if (o instanceof XMethod || o instanceof XField) { tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o, nonnullTypeQualifierValue); } NullnessAnnotation result = toNullnessAnnotation(tqa); if (DEBUG) { if (result == null) { System.out.println(" ===> not found"); } else { System.out.println(" ===> " + tqa + "/" + result.toString() ); } } return result; } finally { profiler.end(this.getClass()); } }
int parameterNumber = mp.getParameterNumber(); if (parameterNumber == 0) { if ("equals".equals(m.getName()) && "(Ljava/lang/Object;)Z".equals(m.getSignature()) && !m.isStatic()) {
private AnnotationEnum lookInOverriddenMethod(final Object originalQuery, String classToLookIn, XMethod originalMethod, boolean getMinimal) { try { AnnotationEnum n; // Look in supermethod XMethod superMethod = XFactory.createXMethod(classToLookIn, originalMethod.getName(), originalMethod.getSignature(), originalMethod.isStatic()); if (!superMethod.isResolved()) { return null; } if (DEBUG) { System.out.println("Looking for overridden method " + superMethod); } Object probe; if (originalQuery instanceof XMethod) { probe = superMethod; } else if (originalQuery instanceof XMethodParameter) { probe = new XMethodParameter(superMethod, ((XMethodParameter) originalQuery).getParameterNumber()); } else { throw new IllegalStateException("impossible"); } n = getResolvedAnnotation(probe, getMinimal); return n; } catch (RuntimeException e) { AnalysisContext.logError("Exception while looking for annotation of " + originalMethod + "in " + classToLookIn, e); return null; } }
if (mp.getParameterNumber() == 0 && TypeQualifierNullnessAnnotationDatabase.assertsFirstParameterIsNonnull(invokedXMethod)) { return; parameterNumber = mp.getParameterNumber(); bugType = "NP_NULL_PARAM_DEREF";
public @CheckForNull NullnessAnnotation getDirectAnnotation(Object o) { Profiler profiler = Global.getAnalysisCache().getProfiler(); profiler.start(this.getClass()); try { if (DEBUG) { System.out.println("getDirectAnnotation: o=" + o + "..."); } TypeQualifierAnnotation tqa = null; if (o instanceof XMethodParameter) { XMethodParameter param = (XMethodParameter) o; tqa = TypeQualifierApplications.getDirectTypeQualifierAnnotation(param.getMethod(), param.getParameterNumber(), nonnullTypeQualifierValue); } else if (o instanceof XMethod || o instanceof XField) { tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o, nonnullTypeQualifierValue); } NullnessAnnotation result = toNullnessAnnotation(tqa); if (DEBUG) { if (result == null) { System.out.println(" ===> not found"); } else { System.out.println(" ===> " + tqa + "/" + result.toString() ); } } return result; } finally { profiler.end(this.getClass()); } }
@Override public NullnessAnnotation getResolvedAnnotation(Object o, boolean getMinimal) { Profiler profiler = Global.getAnalysisCache().getProfiler(); profiler.start(this.getClass()); try { if (DEBUG) { System.out.println("getResolvedAnnotation: o=" + o + "..."); } TypeQualifierAnnotation tqa = null; if (o instanceof XMethodParameter) { XMethodParameter param = (XMethodParameter) o; tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(param.getMethod(), param.getParameterNumber(), nonnullTypeQualifierValue); } else if (o instanceof XMethod || o instanceof XField) { tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o, nonnullTypeQualifierValue); } NullnessAnnotation result = toNullnessAnnotation(tqa); if (DEBUG) { if (result == null) { System.out.println(" ===> not found"); } else { System.out.println(" ===> " + tqa + "/" + result.toString() ); } } return result; } finally { profiler.end(this.getClass()); } }
int parameterNumber = mp.getParameterNumber(); if (parameterNumber == 0) { if ("equals".equals(m.getName()) && "(Ljava/lang/Object;)Z".equals(m.getSignature()) && !m.isStatic()) {
private AnnotationEnum lookInOverriddenMethod(final Object originalQuery, String classToLookIn, XMethod originalMethod, boolean getMinimal) { try { AnnotationEnum n; // Look in supermethod XMethod superMethod = XFactory.createXMethod(classToLookIn, originalMethod.getName(), originalMethod.getSignature(), originalMethod.isStatic()); if (!superMethod.isResolved()) { return null; } if (DEBUG) { System.out.println("Looking for overridden method " + superMethod); } Object probe; if (originalQuery instanceof XMethod) { probe = superMethod; } else if (originalQuery instanceof XMethodParameter) { probe = new XMethodParameter(superMethod, ((XMethodParameter) originalQuery).getParameterNumber()); } else { throw new IllegalStateException("impossible"); } n = getResolvedAnnotation(probe, getMinimal); return n; } catch (RuntimeException e) { AnalysisContext.logError("Exception while looking for annotation of " + originalMethod + "in " + classToLookIn, e); return null; } }
if (mp.getParameterNumber() == 0 && TypeQualifierNullnessAnnotationDatabase.assertsFirstParameterIsNonnull(invokedXMethod)) { return; parameterNumber = mp.getParameterNumber(); bugType = "NP_NULL_PARAM_DEREF";