This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208005

Summary: Add hint for transient with initializer
Product: java Reporter: bondolo <bondolo>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description bondolo 2012-02-02 04:26:20 UTC
transient fields are not initialized upon deserialization. This means:

class Foo {
...
transient int bar = Integer.MIN_VALUE;
...
}

will have the value zero rather than Integer.MIN_VALUE upon deserialization unless the field is specifically initialized during the readObject() method.

It's worth pointing out transient fields with initializers as possible errors because users may expect that they will be run for every instance created.