inexplicable Netbeans serializable warning for nested base class
Asked Answered
O

1

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.

Oatmeal answered 21/5, 2011 at 0:28 Comment(3)
Most curious. Perhaps the compiler isn't able to generate a serialVersionUID because class Inner is in the scope of Outer.Barranquilla
Eclipse 3.7 gives an error: Cycle detected: the type Outer cannot extend/implement itself or one of its own member types.Azerbaijani
NetBeans 13 reports cyclic inheritance involving Outer and nothing regarding serialVersionUID.Gowrie
L
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.

Lattimer answered 24/6, 2011 at 19:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.