您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AnnotationDefault.java 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* *******************************************************************
  2. * Copyright (c) 2004 IBM Corporation
  3. *
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v 2.0
  7. * which accompanies this distribution and is available at
  8. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  9. *
  10. * Contributors:
  11. * Andy Clement initial implementation
  12. * ******************************************************************/
  13. package org.aspectj.apache.bcel.classfile;
  14. import java.io.DataInputStream;
  15. import java.io.DataOutputStream;
  16. import java.io.IOException;
  17. import org.aspectj.apache.bcel.Constants;
  18. import org.aspectj.apache.bcel.classfile.annotation.ElementValue;
  19. /**
  20. * This attribute is attached to a method and indicates the default
  21. * value for an annotation element.
  22. */
  23. public class AnnotationDefault extends Attribute {
  24. private ElementValue value;
  25. public AnnotationDefault(int nameIndex, int len, DataInputStream dis, ConstantPool cpool) throws IOException {
  26. this(nameIndex, len, ElementValue.readElementValue(dis,cpool), cpool);
  27. }
  28. private AnnotationDefault(int nameIndex, int len, ElementValue value, ConstantPool cpool) {
  29. super(Constants.ATTR_ANNOTATION_DEFAULT, nameIndex, len, cpool);
  30. this.value = value;
  31. }
  32. public Attribute copy(ConstantPool constant_pool) {
  33. throw new RuntimeException("Not implemented yet!");
  34. // is this next line sufficient?
  35. // return (EnclosingMethod)clone();
  36. }
  37. public final ElementValue getElementValue() { return value; }
  38. public final void dump(DataOutputStream dos) throws IOException {
  39. super.dump(dos);
  40. value.dump(dos);
  41. }
  42. public void accept(ClassVisitor v) {
  43. v.visitAnnotationDefault(this);
  44. }
  45. }