import org.aspectj.weaver.patterns.DeclareParents;
import org.aspectj.weaver.patterns.DeclarePrecedence;
import org.aspectj.weaver.patterns.DeclareSoft;
+import org.aspectj.weaver.patterns.DeclareTypeErrorOrWarning;
import org.aspectj.weaver.patterns.Pointcut;
import org.aspectj.weaver.patterns.TypePattern;
import org.aspectj.weaver.tools.PointcutDesignatorHandler;
return crosscuttingMembersSet.getDeclareAnnotationOnMethods();
}
- // public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() {
- // return crosscuttingMembersSet.getDeclareTypeEows();
- // }
+ public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() {
+ return crosscuttingMembersSet.getDeclareTypeEows();
+ }
public List<DeclareSoft> getDeclareSoft() {
return crosscuttingMembersSet.getDeclareSofts();
return new DeclareSoft(p, pointcut);
}
+ /**
+ * Attempt to parse a pointcut, if that fails then try again for a type pattern.
+ *
+ * @param isError true if it is declare error rather than declare warning
+ * @return the new declare
+ */
private Declare parseErrorOrWarning(boolean isError) {
- Pointcut pointcut = parsePointcut();
+ Pointcut pointcut = null;
+ int index = tokenSource.getIndex();
+ try {
+ pointcut = parsePointcut();
+ } catch (ParserException pe) {
+ try {
+ tokenSource.setIndex(index);
+ boolean oldValue = allowHasTypePatterns;
+ TypePattern typePattern = null;
+ try {
+ allowHasTypePatterns = true;
+ typePattern = parseTypePattern();
+ } finally {
+ allowHasTypePatterns = oldValue;
+ }
+ eat(":");
+ String message = parsePossibleStringSequence(true);
+ return new DeclareTypeErrorOrWarning(isError, typePattern, message);
+ } catch (ParserException pe2) {
+ // deliberately throw the original problem
+ throw pe;
+ }
+ }
eat(":");
String message = parsePossibleStringSequence(true);
return new DeclareErrorOrWarning(isError, pointcut, message);