The current implementation of ExclusionManager takes a Map<String, String> as a constructor as a collection of patterns.
|
public ExclusionManager(Map<String, String> patterns) { |
|
this.exclusions = new HashSet<>(patterns.size()); |
|
this.cache = new HashMap<>(); |
|
|
|
patterns.forEach((k, v) -> { |
|
var invert = false; |
|
|
|
if (k.startsWith("!")) { |
|
invert = true; |
|
k = k.substring(1); |
|
} |
|
|
|
exclusions.add(new Exclusion(v, Exclusion.ExclusionType.forIdentifier(k), invert)); |
|
}); |
|
} |
This is a flawed implementation because it allows for overwriting exclusion patterns in the map, causing them to vanish. Need to also change this line as well:
|
public class ExclusionsDeserializer extends JsonDeserializer<ExclusionManager> { |
|
@Override |
|
public ExclusionManager deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { |
|
JsonNode node = p.getCodec().readTree(p); |
|
var map = new HashMap<String, String>(); |
|
node.fields().forEachRemaining(entry -> map.put(entry.getKey(), entry.getValue().asText())); |
|
return new ExclusionManager(map); |
|
} |
|
} |
Thanks to lokirus for finding the side effects of my dumb code logic errors!
The current implementation of ExclusionManager takes a Map<String, String> as a constructor as a collection of patterns.
radon/xyz.itzsomebody.radon/src/main/java/xyz/itzsomebody/radon/exclusions/ExclusionManager.java
Lines 30 to 44 in 7d3e871
This is a flawed implementation because it allows for overwriting exclusion patterns in the map, causing them to vanish. Need to also change this line as well:
radon/xyz.itzsomebody.radon/src/main/java/xyz/itzsomebody/radon/config/ExclusionsDeserializer.java
Lines 30 to 38 in 7d3e871
Thanks to lokirus for finding the side effects of my dumb code logic errors!