@Override public void addMethodParameterAnnotation(@DottedClassName String cName, String mName, String sig, boolean isStatic, int param, NullnessAnnotation annotation) { if (DEBUG) { System.out.println("addMethodParameterAnnotation: annotate " + cName + "." + mName + " param " + param + " with " + annotation); } XMethod xmethod = getXMethod(cName, mName, sig, isStatic); if (xmethod == null) { return; } // Get JSR-305 nullness annotation type ClassDescriptor nullnessAnnotationType = getNullnessAnnotationClassDescriptor(annotation); // Create an AnnotationValue AnnotationValue annotationValue = new AnnotationValue(nullnessAnnotationType); if (!xmethod.getClassName().equals(cName)) { if (SystemProperties.ASSERTIONS_ENABLED) { AnalysisContext.logError("Could not fully resolve method " + cName + "." + mName + sig + " to apply annotation " + annotation); } return; } if (SystemProperties.ASSERTIONS_ENABLED) { SignatureParser parser = new SignatureParser(sig); int numParams = parser.getNumParameters(); assert param < numParams; } // Destructively add the annotation to the MethodInfo object xmethod.addParameterAnnotation(param, annotationValue); }
@Override public void addMethodParameterAnnotation(@DottedClassName String cName, String mName, String sig, boolean isStatic, int param, NullnessAnnotation annotation) { if (DEBUG) { System.out.println("addMethodParameterAnnotation: annotate " + cName + "." + mName + " param " + param + " with " + annotation); } XMethod xmethod = getXMethod(cName, mName, sig, isStatic); if (xmethod == null) { return; } // Get JSR-305 nullness annotation type ClassDescriptor nullnessAnnotationType = getNullnessAnnotationClassDescriptor(annotation); // Create an AnnotationValue AnnotationValue annotationValue = new AnnotationValue(nullnessAnnotationType); if (!xmethod.getClassName().equals(cName)) { if (SystemProperties.ASSERTIONS_ENABLED) { AnalysisContext.logError("Could not fully resolve method " + cName + "." + mName + sig + " to apply annotation " + annotation); } return; } if (SystemProperties.ASSERTIONS_ENABLED) { SignatureParser parser = new SignatureParser(sig); int numParams = parser.getNumParameters(); assert param < numParams; } // Destructively add the annotation to the MethodInfo object xmethod.addParameterAnnotation(param, annotationValue); }