javaee / jaxb-v2

Other
210 stars 100 forks source link

Inherited lifecycle methods not detected #477

Closed glassfishrobot closed 16 years ago

glassfishrobot commented 16 years ago

Currently, setLifecycleFlags() in JaxBeanInfo searches the array returned by jaxbType.getDeclaredMethods() for lifecycle methods. This does not include methods inherited from super-classes, though. So, if I have a common super-class for several of my JAXB beans, lifecycle-methods implemented in the super-class are not called for any of the sub-classes when they are instantiated. FIX: Either call jaxbType.getMethods() instead (which returns public methods only, but includes inherited methods), or call getDeclaredMethods() for super-class of jaxbType recursively. A cleaner long-term solution (in my opinion) would be to declare an Interface for livecycle methods that must be implemented by classes requiring call-backs. Thanks!

Environment

Operating System: All Platform: All

Affected Versions

[2.1.6]

glassfishrobot commented 16 years ago

Reported by kflorian

glassfishrobot commented 16 years ago

@pavelbucek said: Fixed in 2.1.10.

setLifeCycleFlags() now traverses thru class hierarchy (from last child to Object) and looks for lifecycle methods. Only first found method is saved (and called afterwards).

glassfishrobot commented 16 years ago

Was assigned to jaxb-issues

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAXB-477

glassfishrobot commented 16 years ago

Marked as fixed on Wednesday, November 12th 2008, 1:14:09 am