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.

NoTypePattern.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* *******************************************************************
  2. * Copyright (c) 2002, 2010 Contributors
  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.io.IOException;
  14. import java.util.Map;
  15. import org.aspectj.util.FuzzyBoolean;
  16. import org.aspectj.weaver.CompressingDataOutputStream;
  17. import org.aspectj.weaver.ResolvedType;
  18. import org.aspectj.weaver.UnresolvedType;
  19. import org.aspectj.weaver.World;
  20. public class NoTypePattern extends TypePattern {
  21. public NoTypePattern() {
  22. super(false, false, new TypePatternList());
  23. }
  24. /*
  25. * (non-Javadoc)
  26. *
  27. * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern)
  28. */
  29. @Override
  30. protected boolean couldEverMatchSameTypesAs(TypePattern other) {
  31. return false;
  32. }
  33. /**
  34. * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(ResolvedType)
  35. */
  36. @Override
  37. protected boolean matchesExactly(ResolvedType type) {
  38. return false;
  39. }
  40. @Override
  41. protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) {
  42. return false;
  43. }
  44. /**
  45. * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(ResolvedType)
  46. */
  47. @Override
  48. public FuzzyBoolean matchesInstanceof(ResolvedType type) {
  49. return FuzzyBoolean.NO;
  50. }
  51. @Override
  52. public void write(CompressingDataOutputStream s) throws IOException {
  53. s.writeByte(NO_KEY);
  54. }
  55. /**
  56. * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind)
  57. */
  58. // public FuzzyBoolean matches(IType type, MatchKind kind) {
  59. // return FuzzyBoolean.YES;
  60. // }
  61. /**
  62. * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(ResolvedType)
  63. */
  64. @Override
  65. protected boolean matchesSubtypes(ResolvedType type) {
  66. return false;
  67. }
  68. @Override
  69. public boolean isStar() {
  70. return false;
  71. }
  72. @Override
  73. public String toString() {
  74. return "<nothing>";
  75. }// FIXME AV - bad! toString() cannot be parsed back (not idempotent)
  76. /*
  77. * (non-Javadoc)
  78. *
  79. * @see java.lang.Object#equals(java.lang.Object)
  80. */
  81. @Override
  82. public boolean equals(Object obj) {
  83. return (obj instanceof NoTypePattern);
  84. }
  85. /*
  86. * (non-Javadoc)
  87. *
  88. * @see java.lang.Object#hashCode()
  89. */
  90. @Override
  91. public int hashCode() {
  92. return 17 * 37 * 37;
  93. }
  94. @Override
  95. public Object accept(PatternNodeVisitor visitor, Object data) {
  96. return visitor.visit(this, data);
  97. }
  98. @Override
  99. public TypePattern parameterizeWith(Map<String,UnresolvedType> arg0, World w) {
  100. return this;
  101. }
  102. }