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

TransformAfter.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Javassist, a Java-bytecode translator toolkit.
  3. * Copyright (C) 1999-2003 Shigeru Chiba. All Rights Reserved.
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. Alternatively, the contents of this file may be used under
  8. * the terms of the GNU Lesser General Public License Version 2.1 or later.
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. */
  15. package javassist.convert;
  16. import javassist.CtMethod;
  17. import javassist.NotFoundException;
  18. import javassist.bytecode.*;
  19. public class TransformAfter extends TransformBefore {
  20. public TransformAfter(Transformer next,
  21. CtMethod origMethod, CtMethod afterMethod)
  22. throws NotFoundException
  23. {
  24. super(next, origMethod, afterMethod);
  25. }
  26. protected int match2(int pos, CodeIterator iterator) throws BadBytecode {
  27. iterator.move(pos);
  28. iterator.insert(saveCode);
  29. iterator.insert(loadCode);
  30. int p = iterator.insertGap(3);
  31. iterator.insert(loadCode);
  32. pos = iterator.next();
  33. iterator.writeByte(iterator.byteAt(pos), p);
  34. iterator.write16bit(iterator.u16bitAt(pos + 1), p + 1);
  35. iterator.writeByte(INVOKESTATIC, pos);
  36. iterator.write16bit(newIndex, pos + 1);
  37. iterator.move(p);
  38. return iterator.next();
  39. }
  40. }