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.

NameBindingPointcut.java 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 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. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.patterns;
  13. import java.util.List;
  14. import org.aspectj.weaver.ResolvedType;
  15. import org.aspectj.weaver.World;
  16. import org.aspectj.weaver.ast.Test;
  17. import org.aspectj.weaver.ast.Var;
  18. /**
  19. * Common super type for Pointcuts that can bind formal parameters.
  20. *
  21. * @author Erik Hilsdale
  22. * @author Jim Hugunin
  23. * @author Andy Clement
  24. */
  25. public abstract class NameBindingPointcut extends Pointcut {
  26. public NameBindingPointcut() {
  27. super();
  28. }
  29. protected Test exposeStateForVar(Var var,TypePattern type, ExposedState state, World world) {
  30. if (type instanceof BindingTypePattern) {
  31. BindingTypePattern b = (BindingTypePattern)type;
  32. state.set(b.getFormalIndex(), var);
  33. }
  34. ResolvedType myType = type.getExactType().resolve(world);
  35. if (myType.isParameterizedType()) {
  36. // unchecked warning already issued...
  37. myType = (ResolvedType) myType.getRawType();
  38. }
  39. return Test.makeInstanceof(var, myType.resolve(world));
  40. }
  41. public abstract List<BindingTypePattern> getBindingTypePatterns();
  42. public abstract List<BindingAnnotationTypePattern> getBindingAnnotationTypePatterns();
  43. }