Vassal 3.1.5.
If there is a problem with Layer where it can’t read property, then it will try to report a problem, unfortunately BadDataReport wants to use piece name which depends on the Layer again, which tries to read property value again and this goes until a stack overflow happens:
...
at VASSAL.counters.Decorator.getLocalizedName(Decorator.java:323)
at VASSAL.build.BadDataReport.<init>(BadDataReport.java:68)
at VASSAL.counters.Decorator.reportDataError(Decorator.java:365)
at VASSAL.counters.Embellishment.checkPropertyLevel(Embellishment.java:419)
at VASSAL.counters.Embellishment.getName(Embellishment.java:284)
at VASSAL.counters.Embellishment.getLocalizedName(Embellishment.java:276)
at VASSAL.counters.Decorator.getLocalizedName(Decorator.java:323)
at VASSAL.build.BadDataReport.<init>(BadDataReport.java:68)
at VASSAL.counters.Decorator.reportDataError(Decorator.java:365)
at VASSAL.counters.Embellishment.checkPropertyLevel(Embellishment.java:419)
at VASSAL.counters.Embellishment.getName(Embellishment.java:284)
at VASSAL.counters.Embellishment.getLocalizedName(Embellishment.java:276)
at VASSAL.counters.Decorator.getLocalizedName(Decorator.java:323)
at VASSAL.build.BadDataReport.<init>(BadDataReport.java:68)
at VASSAL.counters.Decorator.reportDataError(Decorator.java:365)
at VASSAL.counters.Embellishment.checkPropertyLevel(Embellishment.java:419)
at VASSAL.counters.Embellishment.getName(Embellishment.java:284)
at VASSAL.counters.Embellishment.getLocalizedName(Embellishment.java:276)
at VASSAL.counters.Decorator.getLocalizedName(Decorator.java:323)
...
This is especially a big problem when in module editor - it can’t read properties derived from prototypes, therefore a lot of pieces is now not accessible, but they do work in the game.
Also, I think this code in VASSAL.counters.Embellishment.checkPropertyLevel is a bit limiting:
final String val =
(String) Decorator.getOutermost(this).getProperty(propertyName);
I can’t return other types from my custom properties if I want Embellishment to work. I suggest using:
final String val =
String.valueOf(Decorator.getOutermost(this).getProperty(propertyName));
…since getProperty is returning Object, why to assume it will be always a String?