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.

AnnotationOnTypeMunger.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* *******************************************************************
  2. * Copyright (c) 2005 IBM
  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 initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver;
  13. import java.io.IOException;
  14. /**
  15. * Represents adding an annotation to a type
  16. */
  17. public class AnnotationOnTypeMunger extends ResolvedTypeMunger {
  18. AnnotationAJ newAnnotation;
  19. public AnnotationOnTypeMunger(AnnotationAJ anno) {
  20. super(AnnotationOnType, null);
  21. newAnnotation = anno;
  22. }
  23. public void write(CompressingDataOutputStream s) throws IOException {
  24. throw new RuntimeException("unimplemented");
  25. }
  26. public AnnotationAJ getNewAnnotation() {
  27. return newAnnotation;
  28. }
  29. public boolean equals(Object other) {
  30. if (!(other instanceof AnnotationOnTypeMunger)) {
  31. return false;
  32. }
  33. AnnotationOnTypeMunger o = (AnnotationOnTypeMunger) other;
  34. // TODO does not check equality of annotation values
  35. return newAnnotation.getTypeSignature().equals(o.newAnnotation.getTypeSignature());
  36. }
  37. private volatile int hashCode = 0;
  38. public int hashCode() {
  39. if (hashCode == 0) {
  40. int result = 17;
  41. result = 37 * result + newAnnotation.getTypeSignature().hashCode();
  42. hashCode = result;
  43. }
  44. return hashCode;
  45. }
  46. }