Closed miaoxu9999 closed 6 years ago
Unfortunately, the part of the watcher mechanism that uses reflection is not implemented to work with static fields and so you get that error. I think you could work around this by making a single instance of a class (e.g. Count) with a count field in it. Pass every Zombie a reference the single instance of that class and have the zombies change the count in that class. The Humans could then watch Count.count.
@ncollier Thanks for your reply. I got it
Every time when I try to use an annotation @watch listen static variable, there is an
java.lang.reflect.InvocationTargetException
exception,Human.class