use of org.apache.bcel.classfile.ElementValue in project fb-contrib by mebigfatguy.
the class UnsynchronizedSingletonFieldWrites method isSingleton.
private boolean isSingleton(JavaClass cls) {
if (cls.isEnum()) {
return true;
}
AnnotationEntry[] annotations = cls.getAnnotationEntries();
if (CollectionUtils.isEmpty(annotations)) {
return false;
}
boolean isSpringBean = false;
for (AnnotationEntry annotation : annotations) {
String type = annotation.getAnnotationType();
if (SPRING_CLASS_ANNOTATIONS.contains(type)) {
isSpringBean = true;
} else if (SPRING_SCOPE_ANNOTATION.equals(type)) {
ElementValuePair[] pairs = annotation.getElementValuePairs();
if (!CollectionUtils.isEmpty(pairs)) {
for (ElementValuePair pair : pairs) {
String propName = pair.getNameString();
if ("value".equals(propName) || "scopeName".equals(propName)) {
ElementValue value = pair.getValue();
return "singleton".equals(value.stringifyValue());
}
}
}
}
}
return isSpringBean;
}
use of org.apache.bcel.classfile.ElementValue in project fb-contrib by mebigfatguy.
the class FindClassCircularDependencies method visitAnnotation.
@Override
public void visitAnnotation(@DottedClassName String annotationClass, Map<String, ElementValue> map, boolean runtimeVisible) {
if (!runtimeVisible) {
return;
}
for (ElementValue v : map.values()) {
if (v.getElementValueType() == ElementValue.CLASS) {
String annotationClsAttr = SignatureUtils.stripSignature(v.stringifyValue());
Set<String> dependencies = getDependenciesForClass(className);
dependencies.add(annotationClsAttr);
}
}
}
Aggregations