Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355050

Summary: Add of composite to tab item in XWT Form causes a stack overflow
Product: [Technology] XWT Reporter: Joerg Reichert <joerg83reichert>
Component: CoreAssignee: Yves YANG <yves.yang>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: eug.nikolaev, Konstantin.Scheglov, mdiliberto, thenightex, yves.yang
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=354908
Whiteboard:
Attachments:
Description Flags
The form before adding the composite
none
The project containing the copied XWT libraries
none
possible solution none

Description Joerg Reichert CLA 2011-08-18 06:18:55 EDT
Build Identifier: Eclipse 3.7 20110615-0604

I actually posted this bug first as an WindowBuilder bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=354908), but it seems to be more a XWT bug.

The XWT Form Composite wizard copies some libraries into the project, e.g. org.eclipse.e4.xwt_0.9.1.SNAPSHOT.jar (see also the appended workspace screenshot).

I appended the hole forms file in the state before adding the composite.

When adding a composite element as a child of a tabitem a StackOverflow is
caused. This is the code produced in the XML-File:

        <TabItem text="A">
            <TabItem.control>
                <Composite/>
            </TabItem.control>
        </TabItem>


!ENTRY org.eclipse.wb.core 4 4 2011-08-17 08:58:05.895
!MESSAGE Designer [1.0.0.r37x201106081531.201108170858]:
java.lang.StackOverflowError
!STACK 0
java.lang.StackOverflowError
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.initialize(AbstractMetaclass.java:614)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.assertInitialize(AbstractMetaclass.java:610)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:360)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:361)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:361)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)
    at
org.eclipse.e4.xwt.javabean.metadata.AbstractMetaclass.newInstance(AbstractMetaclass.java:361)
    at
org.eclipse.e4.xwt.forms.metaclass.AbstractFormMetaclass.doNewInstance(AbstractFormMetaclass.java:63)


Maybe the problem is that the Window Builder wizard uses the SNAPSHOT version of the XWT library.

Reproducible: Always

Steps to Reproduce:
1. Create new plug-in project
2. Create package in src
3. Create a new XWT file with the XWT Forms Composite wizard
4. Create TabFolder with TabItems
5. Try to add a composite to the TabItem
Comment 1 Joerg Reichert CLA 2011-08-18 06:19:31 EDT
Created attachment 201705 [details]
The form before adding the composite
Comment 2 Joerg Reichert CLA 2011-08-18 06:20:07 EDT
Created attachment 201706 [details]
The project containing the copied XWT libraries
Comment 3 Matteo Di Liberto Gasparin CLA 2014-05-13 03:24:13 EDT
The problem seems to be at the end of the method doNewInstance in org.eclipse.xwt.forms.metaclass.AbstractFormMetaclass where there should be a call to super.doNewInstance instead of super.newInstance. I can't provide a patch right now, but this seems pretty trivial.

Similar to this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=425450
Comment 4 Matteo Di Liberto Gasparin CLA 2014-07-14 04:25:55 EDT
Created attachment 245027 [details]
possible solution
Comment 5 Yves YANG CLA 2014-07-28 08:25:20 EDT
Thanks for the report. We'll check it out.
Comment 6 Sascha Hanke CLA 2014-07-28 08:44:10 EDT
Matteo Di Liberto Gasparin's solution works for me.
Comment 7 Yves YANG CLA 2014-08-07 07:52:17 EDT
Valided and committed.