org.apache.bcel.classfile.Field.getAnnotationEntries()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中org.apache.bcel.classfile.Field.getAnnotationEntries()方法的一些代码示例,展示了Field.getAnnotationEntries()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.getAnnotationEntries()方法的具体详情如下:
包路径:org.apache.bcel.classfile.Field
类名称:Field
方法名:getAnnotationEntries

Field.getAnnotationEntries介绍

暂无

代码示例

代码示例来源:origin: find-sec-bugs/find-sec-bugs

private void analyzeField(Field field, JavaClass javaClass) {
  for (AnnotationEntry annotation : field.getAnnotationEntries())  {
    if (ANNOTATION_TYPES.contains(annotation.getAnnotationType()) ||
        annotation.getAnnotationType().contains("JsonTypeInfo")) {
      for (ElementValuePair elementValuePair : annotation.getElementValuePairs()) {
        if ("use".equals((elementValuePair.getNameString())) &&
            VULNERABLE_USE_NAMES.contains(elementValuePair.getValue().stringifyValue())) {
          bugReporter.reportBug(new BugInstance(this, DESERIALIZATION_TYPE, HIGH_PRIORITY)
              .addClass(javaClass)
              .addString(javaClass.getClassName() + " on field " +
                  field.getName() + " of type " + field.getType() +
                  " annotated with " + annotation.toShortString())
              .addField(FieldAnnotation.fromBCELField(javaClass, field))
              .addString("")
          );
        }
      }
    }
  }
}

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

@Override
public void visitField(Field obj) {
  if (obj.getAnnotationEntries().length > 0) {
    fieldsWithAnnotations.add(getFieldDescriptor());
  }
}

代码示例来源:origin: mebigfatguy/fb-contrib

@Override
public void visitField(Field obj) {
  if (obj.getAnnotationEntries().length > 0) {
    fieldsWithAnnotations.add(getFieldDescriptor());
  }
}

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

/**
 * looks to see the field has a runtime visible annotation, if it does it might be autowired or some other mechanism attached that makes them less
 * interesting for a toString call.
 *
 * @param f
 *            the field to check
 * @return if the field has a runtime visible annotation
 */
private static boolean fieldHasRuntimeVisibleAnnotation(Field f) {
  AnnotationEntry[] annotations = f.getAnnotationEntries();
  if (annotations != null) {
    for (AnnotationEntry annotation : annotations) {
      if (annotation.isRuntimeVisible()) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: mebigfatguy/fb-contrib

/**
 * looks to see the field has a runtime visible annotation, if it does it might
 * be autowired or some other mechanism attached that makes them less
 * interesting for a toString call.
 *
 * @param f the field to check
 * @return if the field has a runtime visible annotation
 */
private static boolean fieldHasRuntimeVisibleAnnotation(Field f) {
  AnnotationEntry[] annotations = f.getAnnotationEntries();
  if (annotations != null) {
    for (AnnotationEntry annotation : annotations) {
      if (annotation.isRuntimeVisible()) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: org.apache.bcel/bcel

public void checkAnnotatedField(final JavaClass clazz, final String fieldname,
    final String AnnotationEntryName, final String AnnotationEntryElementName,
    final String AnnotationEntryElementValue)
{
  final Field[] fields = clazz.getFields();
  for (final Field f : fields) {
    final AnnotationEntry[] fieldAnnotationEntrys = f.getAnnotationEntries();
    if (f.getName().equals(fieldname))
    {
      checkAnnotationEntry(fieldAnnotationEntrys[0], AnnotationEntryName,
          AnnotationEntryElementName, AnnotationEntryElementValue);
    }
  }
}

代码示例来源:origin: com.h3xstream.findsecbugs/findsecbugs-plugin

private void analyzeField(Field field, JavaClass javaClass) {
  for (AnnotationEntry annotation : field.getAnnotationEntries())  {
    if (ANNOTATION_TYPES.contains(annotation.getAnnotationType()) ||
        annotation.getAnnotationType().contains("JsonTypeInfo")) {
      for (ElementValuePair elementValuePair : annotation.getElementValuePairs()) {
        if ("use".equals((elementValuePair.getNameString())) &&
            VULNERABLE_USE_NAMES.contains(elementValuePair.getValue().stringifyValue())) {
          bugReporter.reportBug(new BugInstance(this, DESERIALIZATION_TYPE, HIGH_PRIORITY)
              .addClass(javaClass)
              .addString(javaClass.getClassName() + " on field " +
                  field.getName() + " of type " + field.getType() +
                  " annotated with " + annotation.toShortString())
              .addField(FieldAnnotation.fromBCELField(javaClass, field))
              .addString("")
          );
        }
      }
    }
  }
}

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

boolean hasAutowired = false;
String qualifier = "";
for (AnnotationEntry entry : field.getAnnotationEntries()) {
  switch (entry.getAnnotationType()) {
    case SPRING_AUTOWIRED:

代码示例来源:origin: mebigfatguy/fb-contrib

boolean hasAutowired = false;
String qualifier = "";
for (AnnotationEntry entry : field.getAnnotationEntries()) {
  switch (entry.getAnnotationType()) {
    case SPRING_AUTOWIRED:

代码示例来源:origin: mebigfatguy/fb-contrib

boolean hasAutowired = false;
String qualifier = "";
for (AnnotationEntry entry : field.getAnnotationEntries()) {
  switch (entry.getAnnotationType()) {
    case SPRING_AUTOWIRED:

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

boolean hasAutowired = false;
String qualifier = "";
for (AnnotationEntry entry : field.getAnnotationEntries()) {
  switch (entry.getAnnotationType()) {
    case SPRING_AUTOWIRED:

代码示例来源:origin: mebigfatguy/fb-contrib

FieldAnnotation fa = new FieldAnnotation(cls.getClassName(), f.getName(), f.getSignature(), false);
boolean hasExternalAnnotation = false;
for (AnnotationEntry entry : f.getAnnotationEntries()) {
  ConstantUtf8 cutf = (ConstantUtf8) cp.getConstant(entry.getTypeIndex());
  if (!cutf.getBytes().startsWith(Values.JAVA)) {

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

FieldAnnotation fa = new FieldAnnotation(cls.getClassName(), f.getName(), f.getSignature(), false);
boolean hasExternalAnnotation = false;
for (AnnotationEntry entry : f.getAnnotationEntries()) {
  ConstantUtf8 cutf = (ConstantUtf8) cp.getConstant(entry.getTypeIndex());
  if (!cutf.getBytes().startsWith(Values.JAVA)) {

代码示例来源:origin: org.apache.bcel/bcel

+ dumpAnnotationEntries(f.getAnnotationEntries()));
+ f.getAnnotationEntries().length, f.getAnnotationEntries().length == 2);

相关文章