Optimized excluded by name handling
This commit is contained in:
Greg Wilkins 2017-04-26 13:50:58 +02:00
parent 6ca9bacee6
commit a3ace98a8d
1 changed files with 5 additions and 0 deletions

View File

@ -516,6 +516,8 @@ public class ClasspathPattern extends AbstractSet<String>
try
{
Boolean byName = _patterns.isIncludedAndNotExcluded(clazz.getName());
if (Boolean.FALSE.equals(byName))
return byName; // Already excluded so no need to check location.
File locationFile = TypeUtil.getLocationOfClassAsFile(clazz);
Boolean byLocation = locationFile == null ? null
: _locations.isIncludedAndNotExcluded(locationFile.toPath());
@ -543,6 +545,8 @@ public class ClasspathPattern extends AbstractSet<String>
name=name.replace("/",".");
Boolean byName = _patterns.isIncludedAndNotExcluded(name);
if (Boolean.FALSE.equals(byName))
return byName; // Already excluded so no need to check location.
// Try to find a file path for location matching
Boolean byLocation = null;
@ -566,4 +570,5 @@ public class ClasspathPattern extends AbstractSet<String>
boolean excluded = byName==Boolean.FALSE || byLocation==Boolean.FALSE;
return included && !excluded;
}
}