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.

Declare.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.patterns;
  13. import java.io.IOException;
  14. import org.aspectj.weaver.ISourceContext;
  15. import org.aspectj.weaver.VersionedDataInputStream;
  16. public abstract class Declare extends PatternNode {
  17. public static final byte ERROR_OR_WARNING = 1;
  18. public static final byte PARENTS = 2;
  19. public static final byte SOFT = 3;
  20. public static final byte DOMINATES = 4;
  21. public static final byte ANNOTATION = 5;
  22. public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
  23. byte kind = s.readByte();
  24. switch (kind) {
  25. case ERROR_OR_WARNING:
  26. return DeclareErrorOrWarning.read(s, context);
  27. case DOMINATES:
  28. return DeclarePrecedence.read(s, context);
  29. case PARENTS:
  30. return DeclareParents.read(s, context);
  31. case SOFT:
  32. return DeclareSoft.read(s, context);
  33. case ANNOTATION:
  34. return DeclareAnnotation.read(s,context);
  35. default:
  36. throw new RuntimeException("unimplemented");
  37. }
  38. }
  39. /**
  40. * Returns this declare mutated
  41. */
  42. public abstract void resolve(IScope scope);
  43. /**
  44. * Indicates if this declare should be treated like advice. If true, the
  45. * declare will have no effect in an abstract aspect. It will be inherited by
  46. * any concrete aspects and will have an effect for each concrete aspect it
  47. * is ultimately inherited by.
  48. */
  49. public abstract boolean isAdviceLike();
  50. }