| Summary: | FormData: static inner classes instead of member classes | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Ivan Motsch <ivan.motsch> | ||||
| Component: | Scout | Assignee: | Project Inbox <scout.sdk-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | mvi | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Ivan Motsch
In the constructor of AbstractFormData a new instance is created for each nested class (property data). This is done using ConfigurationUtility.newInnerInstance() which uses getDeclaringClass() as indicator whether to use the default constructor (of the nested class) or the constructor with the surrounding (declaring) class as parameter. If we change the FormData nested classes to static inner classes, the constructor has no parameter anymore. But getDeclaringClass() still returns the class of the parent of the static inner class. This leads to the problem that the ConfigurationUtility.newInnerInstance() tries to create the inner instance with parameter while this constructor does not exist (only the default constructor exists) -> NoSuchMethodException. Maybe the ConfigurationUtility.newInnerInstance() should be adapted so that this case can be handled correctly. Keep in mind that this utility method is also used in e.g. AbstractForm where we would like to keep non-static member classes. When changing ConfigurationUtility.newInnerInstance() please consider all of the following cases (analysis from Ivan Motsch) and create tests accordingly: There are five kinds of classes (or interfaces): a) Top level classes -> (declaredClass=null, enclosingClass=null) b) Nested classes (static member classes) -> (declaredClass=parent, enclosingClass=null) c) Inner classes (non-static member classes) -> (declaredClass=parent, enclosingClass=null) d) Local classes (named classes declared within a method) -> (declaredClass=null, enclosingClass=class of method) e) Anonymous classes Created attachment 205030 [details]
Patch Proposal for FormData generation in Scout SDK
The attached patch proposal changes the FormData Generation to create static member classes for fields (instead of non-static).
This can only be applied after the Scout Runtime can handle static member classes in form datas.
runtime has been adapted. patch applied. ticket closed. deliverd as part of eclipse scout 3.8.0 (juno release train) |