Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360633 - FormData: static inner classes instead of member classes
Summary: FormData: static inner classes instead of member classes
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-12 05:19 EDT by Ivan Motsch CLA
Modified: 2021-08-19 11:17 EDT (History)
1 user (show)

See Also:


Attachments
Patch Proposal for FormData generation in Scout SDK (1.22 KB, patch)
2011-10-12 09:09 EDT, Matthias Villiger CLA
mvi: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Motsch CLA 2011-10-12 05:19:52 EDT
Currently when using the sdk to automatically create the form data for a form
it creates inner member classes (public class ...).
I request to change this to create inner static classes for fields, properties, etc. (public static class ...).
This change would make the form data a 100% pure java bean composite with 
- empty constructors of all - also inner - types
- inner classes can be used isolated of outer (not member any more)
- form data composite can be used in jax-ws as complex types.

The change would not affect scout rt concepts and handling in any way.
From the rt point of view it is a null change.
Comment 1 Matthias Villiger CLA 2011-10-12 09:04:52 EDT
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
Comment 2 Matthias Villiger CLA 2011-10-12 09:09:50 EDT
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.
Comment 3 Matthias Villiger CLA 2011-10-14 04:36:09 EDT
runtime has been adapted. patch applied.
Comment 4 Matthias Zimmermann CLA 2012-07-09 06:49:33 EDT
ticket closed.
deliverd as part of eclipse scout 3.8.0 (juno release train)