You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Tag.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Contributors
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v 2.0
  6. * which accompanies this distribution and is available at
  7. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * Andy Clement pushed down into bcel module
  12. * ******************************************************************/
  13. package org.aspectj.apache.bcel.generic;
  14. /**
  15. * A tag is an instruction-targeter that does not remember its target. Instruction handles will maintain a list of targeters but
  16. * there won't be a way to get back from the tag to the instruction. Maintaining these backward/forward links just slows everything
  17. * down.
  18. */
  19. public abstract class Tag implements InstructionTargeter, Cloneable {
  20. public Tag() {
  21. }
  22. // ---- from InstructionTargeter
  23. public boolean containsTarget(InstructionHandle ih) {
  24. return false;
  25. }
  26. public void updateTarget(InstructionHandle oldHandle, InstructionHandle newHandle) {
  27. oldHandle.removeTargeter(this);
  28. if (newHandle != null) {
  29. newHandle.addTargeter(this);
  30. }
  31. }
  32. public Tag copy() {
  33. try {
  34. return (Tag) clone();
  35. } catch (CloneNotSupportedException e) {
  36. throw new RuntimeException("Sanity check, can't clone me");
  37. }
  38. }
  39. }