Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* *******************************************************************
  2. * Copyright (c) 2006 Contributors
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Andy Clement IBM initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.asm;
  13. import java.util.ArrayList;
  14. import java.util.Collections;
  15. import org.aspectj.weaver.AnnotationAJ;
  16. import org.aspectj.org.objectweb.asm.AnnotationVisitor;
  17. import org.aspectj.org.objectweb.asm.Attribute;
  18. import org.aspectj.org.objectweb.asm.Label;
  19. import org.aspectj.org.objectweb.asm.MethodVisitor;
  20. /**
  21. * Constructed with an AsmMethod to 'fill in' with attributes and annotations.
  22. * Bit of a shame we can't "terminate" before visiting the code as we know
  23. * we aren't interested in any of it.
  24. */
  25. class MethVisitor implements MethodVisitor {
  26. AsmMethod am;
  27. public MethVisitor(AsmMethod rm) { am = rm;}
  28. public AnnotationVisitor visitAnnotationDefault() {
  29. return new EmptyVisitor(); // means we are ignoring default values - is that a problem?
  30. }
  31. public AnnotationVisitor visitAnnotation(String desc, boolean isVisible) {
  32. AnnotationAJ annotation = new AnnotationAJ(desc,isVisible);
  33. am.addAnAnnotation(annotation);
  34. return new AnnVisitor(annotation);
  35. }
  36. public void visitAttribute(Attribute attr) {
  37. if (am.attributes==Collections.EMPTY_LIST) am.attributes = new ArrayList();
  38. am.attributes.add(attr);
  39. }
  40. public AnnotationVisitor visitParameterAnnotation(int arg0, String arg1, boolean arg2) {
  41. return null; // AJ doesnt support these yet
  42. }
  43. public void visitCode() {}
  44. public void visitInsn(int arg0) {}
  45. public void visitIntInsn(int arg0, int arg1) {}
  46. public void visitVarInsn(int arg0, int arg1) {}
  47. public void visitTypeInsn(int arg0, String arg1) {}
  48. public void visitFieldInsn(int arg0, String arg1, String arg2, String arg3) {}
  49. public void visitMethodInsn(int arg0, String arg1, String arg2, String arg3) {}
  50. public void visitJumpInsn(int arg0, Label arg1) {}
  51. public void visitLabel(Label arg0) {}
  52. public void visitLdcInsn(Object arg0) {}
  53. public void visitIincInsn(int arg0, int arg1) {}
  54. public void visitTableSwitchInsn(int arg0, int arg1, Label arg2, Label[] arg3) {}
  55. public void visitLookupSwitchInsn(Label arg0, int[] arg1, Label[] arg2) {}
  56. public void visitMultiANewArrayInsn(String arg0, int arg1) {}
  57. public void visitTryCatchBlock(Label arg0, Label arg1, Label arg2, String arg3) {}
  58. public void visitLocalVariable(String arg0, String arg1, String arg2, Label arg3, Label arg4, int arg5) {}
  59. public void visitLineNumber(int arg0, Label arg1) {}
  60. public void visitMaxs(int arg0, int arg1) {}
  61. public void visitEnd() {}
  62. }