How can I identify an anonymous inner class in a NotSerializableException

前端 未结 2 1543
我寻月下人不归
我寻月下人不归 2020-12-04 02:06

I have received the following error message when trying to debug an application in NetBeans:

java.io.WriteAbortedException: writing aborted; java.io.N

相关标签:
2条回答
  • 2020-12-04 02:34

    Board$1 is the first anonymous class encountered in Board.java. For example:

    class Board {
      public static void main(String[] args) {
        new Object() {}; // Board$1
        new Object() {}; // Board$2
      }
    }
    

    With an IDE like Eclipse, it's easy to spot those anonymous classes in the outline view. I'm sure NetBeans has similar views:

    enter image description here

    0 讨论(0)
  • 2020-12-04 02:49

    In IntelliJ (and Android Studio) one can Navigate->Class (⌘-O on mac) and paste in Board$1, and it will take you to the code for that inner class.

    0 讨论(0)
提交回复
热议问题