Commit a5bf5a0d authored by Noric Couderc's avatar Noric Couderc
Browse files

Refactoring: Made dropping features part of API

Instead of just printing, we allow people to access the information
programmatically too.
parent f6bf9a48
...@@ -207,12 +207,21 @@ class FeatureSet(vararg features : Feature) : ArrayList<Feature>() { ...@@ -207,12 +207,21 @@ class FeatureSet(vararg features : Feature) : ArrayList<Feature>() {
val featuresChecked = this.partition { it.isSupported() } val featuresChecked = this.partition { it.isSupported() }
if (!featuresChecked.second.isEmpty()) { if (!featuresChecked.second.isEmpty()) {
System.err.println("[WARNING]: Some features have been dropped, they are not supported on this machine: ${featuresChecked.second}") for (f in featuresChecked.second) {
dropFeature(f)
}
} }
return FeatureSet(*featuresChecked.first.toTypedArray()) return FeatureSet(*featuresChecked.first.toTypedArray())
} }
val droppedFeatures : MutableList<Feature> = mutableListOf()
fun dropFeature(feature : Feature) {
System.err.println("[WARNING]: Feature '$feature' is not supported on this machine, it will not be gathered.")
droppedFeatures.add(feature)
}
fun accept(visitor : FeatureVisitor) { fun accept(visitor : FeatureVisitor) {
visitor.visitFeatureSet(this) visitor.visitFeatureSet(this)
} }
......
Supports Markdown
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