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.

HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* *******************************************************************
  2. * Copyright (c) 2005 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. * Adrian Colyer Initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.patterns;
  13. import org.aspectj.weaver.UnresolvedType;
  14. /**
  15. * @author colyer
  16. *
  17. */
  18. public class HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor
  19. extends AbstractPatternNodeVisitor {
  20. boolean ohYesItHas = false;
  21. /**
  22. * Is the Exact type parameterized?
  23. * Generic is ok as that just means we resolved a simple type pattern to a generic type
  24. */
  25. public Object visit(ExactTypePattern node, Object data) {
  26. UnresolvedType theExactType = node.getExactType();
  27. if (theExactType.isParameterizedType()) ohYesItHas = true;
  28. //if (theExactType.isGenericType()) ohYesItHas = true;
  29. return data;
  30. }
  31. /**
  32. * Any type bounds are bad.
  33. * Type parameters are right out.
  34. */
  35. public Object visit(WildTypePattern node, Object data) {
  36. if (node.getUpperBound() != null) ohYesItHas = true;
  37. if (node.getLowerBound() != null) ohYesItHas = true;
  38. if (node.getTypeParameters().size() != 0) ohYesItHas = true;
  39. return data;
  40. }
  41. public boolean wellHasItThen/*?*/() {
  42. return ohYesItHas;
  43. }
  44. }