예제 #1
0
  public static Entry[] getDefaultEntries(ClassPath locator, String annotationType) {

    Entry[] def = null;

    if (annotationAttributes.get(annotationType) != null) {
      def = annotationAttributes.get(annotationType).defaultEntries;
    }

    if (def == null) { // Annotation not seen yet - we have to dig it out from the classfile
      try {
        byte[] data = locator.getClassData(annotationType);
        if (data == null) {
          throw new JPFException("annotation class not found: " + annotationType);
        }

        ClassFile cf = new ClassFile(annotationType, data);
        cf.parse(valueCollector);

        def = valueCollector.getDefaultValueEntries();
        annotationAttributes.put(annotationType, new AnnotationAttribute(def, false));

      } catch (ClassFileException cfx) {
        throw new JPFException("malformed annotation classfile");
      }
    }

    return def;
  }
예제 #2
0
  protected AnnotationInfo(String name, ClassPath cp) {
    this.name = name;

    try {
      byte[] data = cp.getClassData(this.name);
      if (data == null) {
        throw new JPFException("annotation class not found: " + this.name);
      }

      ClassFile cf = new ClassFile(name, data);
      cf.parse(valueCollector);

    } catch (ClassFileException cfx) {
      throw new JPFException("malformed annotation classfile");
    }
  }