public static XField createXField(FieldAnnotation f) { return createXField(f.getClassName(), f.getFieldName(), f.getFieldSignature(), f.isStatic()); }
@Override public boolean match(BugInstance bugInstance) { FieldAnnotation fieldAnnotation = null; if (role == null || "".equals(role)) { fieldAnnotation = bugInstance.getPrimaryField(); } else { for (BugAnnotation a : bugInstance.getAnnotations()) { if (a instanceof FieldAnnotation && role.equals(a.getDescription())) { fieldAnnotation = (FieldAnnotation) a; break; } } } if (fieldAnnotation == null) { return false; } if (!name.match(fieldAnnotation.getFieldName())) { return false; } if (signature != null && !signature.match(fieldAnnotation.getFieldSignature())) { return false; } return true; }
public FieldDescriptor getFieldDescriptor(FieldAnnotation ma) { return getFieldDescriptor(ClassName.toSlashedClassName(ma.getClassName()), ma.getFieldName(), ma.getFieldSignature(), ma.isStatic()); }
static FieldAnnotation obfuscate(FieldAnnotation m) { FieldAnnotation result = new FieldAnnotation(hashClass(m.getClassName()), hashData(m.getFieldName()), hashSignature(m.getFieldSignature()), m.isStatic()); result.setDescription(m.getDescription()); return result; }
/** * Rewrite a FieldAnnotation to update the class name and field signature, * if needed. * * @param classNameRewriter * a ClassNameRewriter * @param annotation * a FieldAnnotation * @return the possibly-rewritten FieldAnnotation */ public static FieldAnnotation convertFieldAnnotation(ClassNameRewriter classNameRewriter, FieldAnnotation annotation) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { annotation = new FieldAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()), annotation.getFieldName(), rewriteSignature(classNameRewriter, annotation.getFieldSignature()), annotation.isStatic()); } return annotation; }
@Override public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException { XMLAttributeList attributeList = new XMLAttributeList().addAttribute("classname", getClassName()) .addAttribute("name", getFieldName()).addAttribute("signature", getFieldSignature()); if (fieldSourceSig != null) { attributeList.addAttribute("sourceSignature", fieldSourceSig); } attributeList.addAttribute("isStatic", String.valueOf(isStatic())); if (isPrimary) { attributeList.addAttribute("primary", "true"); } String role = getDescription(); if (!DEFAULT_ROLE.equals(role)) { attributeList.addAttribute("role", role); } xmlOutput.openTag(ELEMENT_NAME, attributeList); getSourceLines().writeXML(xmlOutput, addMessages, false); if (addMessages) { xmlOutput.openTag(BugAnnotation.MESSAGE_TAG); xmlOutput.writeText(this.toString()); xmlOutput.closeTag(BugAnnotation.MESSAGE_TAG); } xmlOutput.closeTag(ELEMENT_NAME); } }
public static XField createXField(FieldAnnotation f) { return createXField(f.getClassName(), f.getFieldName(), f.getFieldSignature(), f.isStatic()); }
@Override public boolean match(BugInstance bugInstance) { FieldAnnotation fieldAnnotation = null; if (role == null || "".equals(role)) { fieldAnnotation = bugInstance.getPrimaryField(); } else { for (BugAnnotation a : bugInstance.getAnnotations()) { if (a instanceof FieldAnnotation && role.equals(a.getDescription())) { fieldAnnotation = (FieldAnnotation) a; break; } } } if (fieldAnnotation == null) { return false; } if (!name.match(fieldAnnotation.getFieldName())) { return false; } if (signature != null && !signature.match(fieldAnnotation.getFieldSignature())) { return false; } return true; }
public FieldDescriptor getFieldDescriptor(FieldAnnotation ma) { return getFieldDescriptor(ClassName.toSlashedClassName(ma.getClassName()), ma.getFieldName(), ma.getFieldSignature(), ma.isStatic()); }
/** * Rewrite a FieldAnnotation to update the class name and field signature, * if needed. * * @param classNameRewriter * a ClassNameRewriter * @param annotation * a FieldAnnotation * @return the possibly-rewritten FieldAnnotation */ public static FieldAnnotation convertFieldAnnotation(ClassNameRewriter classNameRewriter, FieldAnnotation annotation) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { annotation = new FieldAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()), annotation.getFieldName(), rewriteSignature(classNameRewriter, annotation.getFieldSignature()), annotation.isStatic()); } return annotation; }
static FieldAnnotation obfuscate(FieldAnnotation m) { FieldAnnotation result = new FieldAnnotation(hashClass(m.getClassName()), hashData(m.getFieldName()), hashSignature(m.getFieldSignature()), m.isStatic()); result.setDescription(m.getDescription()); return result; }
String sig = f.getFieldSignature(); if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { sig = SignatureUtils.trimSignature(sig);
String sig = f.getFieldSignature(); if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) { sig = SignatureUtils.trimSignature(sig);
@Override public void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary) throws IOException { XMLAttributeList attributeList = new XMLAttributeList().addAttribute("classname", getClassName()) .addAttribute("name", getFieldName()).addAttribute("signature", getFieldSignature()); if (fieldSourceSig != null) { attributeList.addAttribute("sourceSignature", fieldSourceSig); } attributeList.addAttribute("isStatic", String.valueOf(isStatic())); if (isPrimary) { attributeList.addAttribute("primary", "true"); } String role = getDescription(); if (!DEFAULT_ROLE.equals(role)) { attributeList.addAttribute("role", role); } xmlOutput.openTag(ELEMENT_NAME, attributeList); getSourceLines().writeXML(xmlOutput, addMessages, false); if (addMessages) { xmlOutput.openTag(BugAnnotation.MESSAGE_TAG); xmlOutput.writeText(this.toString()); xmlOutput.closeTag(BugAnnotation.MESSAGE_TAG); } xmlOutput.closeTag(ELEMENT_NAME); } }