// }
String scope = definition.getScopeForAspect(name);
if (scope != null) {
// Resolve the type pattern
try {
TypePattern scopePattern = new PatternParser(scope).parseTypePattern();
scopePattern.resolve(world);
scopes.put(name, scopePattern);
if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
world.getMessageHandler().handleMessage(
MessageUtil.info("Aspect '" + name
+ "' is scoped to apply against types matching pattern '"
+ scopePattern.toString() + "'"));
}
} catch (Exception e) {
// TODO definitions should remember which file they came from, for inclusion in this message
world.getMessageHandler().handleMessage(
MessageUtil.error("Unable to parse scope as type pattern. Scope was '" + scope + "': "
+ e.getMessage()));
}
}
}
try {
List<String> includePatterns = definition.getIncludePatterns();
if (includePatterns.size() > 0) {
includedPatterns = new ArrayList<TypePattern>();
includedFastMatchPatterns = new ArrayList<String>();
}
for (String includePattern : includePatterns) {
if (includePattern.endsWith("..*")) {
// from 'blah.blah.blah..*' leave the 'blah.blah.blah.'
includedFastMatchPatterns.add(includePattern.substring(0, includePattern.length() - 2));
} else {
TypePattern includedPattern = new PatternParser(includePattern).parseTypePattern();
includedPatterns.add(includedPattern);
}
}
List<String> excludePatterns = definition.getExcludePatterns();
if (excludePatterns.size() > 0) {
excludedPatterns = new ArrayList<TypePattern>();
excludedFastMatchPatterns = new ArrayList<String>();
}
for (String excludePattern : excludePatterns) {
if (excludePattern.endsWith("..*")) {
// from 'blah.blah.blah..*' leave the 'blah.blah.blah.'
excludedFastMatchPatterns.add(excludePattern.substring(0, excludePattern.length() - 2));
} else {
TypePattern excludedPattern = new PatternParser(excludePattern).parseTypePattern();
excludedPatterns.add(excludedPattern);
}
}
} catch (ParserException pe) {
// TODO definitions should remember which file they came from, for inclusion in this message