mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-11 18:39:43 +07:00
Using reflection to find and report deprecated uniques (#5276)
* Using reflection to find and report deprecated uniques * No kotlin reflection needed thank you very much
This commit is contained in:
parent
7a59cbcbe8
commit
05394f627d
@ -312,11 +312,19 @@ class Ruleset {
|
||||
if (unique.type == null) continue
|
||||
val complianceErrors = unique.type.getComplianceErrors(unique, this)
|
||||
for (complianceError in complianceErrors) {
|
||||
if (complianceError.errorSeverity == severityToReport)
|
||||
if (complianceError.errorSeverity == severityToReport)
|
||||
lines += "$name's unique \"${unique.text}\" contains parameter ${complianceError.parameterName}," +
|
||||
" which does not fit parameter type" +
|
||||
" ${complianceError.acceptableParameterTypes.joinToString(" or ") { it.parameterName }} !"
|
||||
}
|
||||
|
||||
val deprecationAnnotation = unique.type.declaringClass.getField(unique.type.name)
|
||||
.getAnnotation(Deprecated::class.java)
|
||||
if (deprecationAnnotation != null) {
|
||||
// Not user-visible
|
||||
println("$name's unique \"${unique.text}\" is deprecated ${deprecationAnnotation.message}," +
|
||||
" replace with \"${deprecationAnnotation.replaceWith.expression}\"")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user