1

When I define the following class

public class Outer extends Outer.Inner { public static class Inner { } } 

Netbeans 6.9.1 gives me the "has no definition of serialVersionUID" warning for both Outer and Inner. I'm wondering if there is a legit reason for this warning, or if it's a bug. What about extending an inner class makes the compiler think they are implementing Serializable?

Note: This is more out of curiosity than wanting this unnecessary design pattern.

3
  • Most curious. Perhaps the compiler isn't able to generate a serialVersionUID because class Inner is in the scope of Outer. Commented May 21, 2011 at 0:47
  • Eclipse 3.7 gives an error: Cycle detected: the type Outer cannot extend/implement itself or one of its own member types. Commented May 21, 2011 at 0:49
  • 1
    NetBeans 13 reports cyclic inheritance involving Outer and nothing regarding serialVersionUID. Commented May 12, 2022 at 12:20

1 Answer 1

1

I've wondered the same thing myself. In lieu of an answer, I turned off the warning.

Tools -> Options Menu Hints Tab -> Standard Javac warnings Uncheck the serialization checkbox.

Now you'll have to be careful when extending Serialized Objects, but it stops annoying you about things that aren't serialized.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.