Commit eed762df authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

fix(gui): exclusion disablement should be exact package match (PR #500)

parent d3dbdb24
......@@ -88,7 +88,8 @@ public class JadxWrapper {
return classList.stream().filter(cls -> {
for (String exclude : excludedPackages) {
if (cls.getFullName().startsWith(exclude)) {
if (cls.getFullName().equals(exclude)
|| cls.getFullName().startsWith(exclude + '.')) {
return false;
}
}
......@@ -98,11 +99,15 @@ public class JadxWrapper {
public List<String> getExcludedPackages() {
String excludedPackages = settings.getExcludedPackages().trim();
if (excludedPackages.isEmpty()) {
return Collections.emptyList();
}
return Arrays.asList(excludedPackages.split("[ ]+"));
}
public void addExcludedPackage(String packageToExclude) {
settings.setExcludedPackages(settings.getExcludedPackages() + ' ' + packageToExclude);
String newExclusion = settings.getExcludedPackages() + ' ' + packageToExclude;
settings.setExcludedPackages(newExclusion.trim());
settings.sync();
}
......
......@@ -46,7 +46,8 @@ public class JPackage extends JNode implements Comparable<JPackage> {
private void setEnabled(JadxWrapper wrapper) {
List<String> excludedPackages = wrapper.getExcludedPackages();
this.enabled = excludedPackages.isEmpty()
|| excludedPackages.stream().filter(p -> !p.isEmpty()).noneMatch(p -> name.startsWith(p));
|| excludedPackages.stream().filter(p -> !p.isEmpty())
.noneMatch(p -> name.equals(p) || name.startsWith(p + '.'));
}
public final void update() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment