Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349915 - ArrayIndexOutOfBoundsException working with Dynamic Features
Summary: ArrayIndexOutOfBoundsException working with Dynamic Features
Status: RESOLVED WONTFIX
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 05:32 EDT by Andres Alvarez Mattos CLA
Modified: 2011-06-21 12:53 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Alvarez Mattos CLA 2011-06-21 05:32:58 EDT
Build Identifier: 20110301-1815

If working with Dynamic Features, the generaded accessors code call " Object eDynamicGet(int dynamicFeatureID, EStructuralFeature eFeature, boolean resolve, boolean coreType)" instead of "Object eDynamicGet(int featureID, boolean resolve, boolean coreType)" causing an ArrayIndexOutOfBoundsException when the eClass extends a Class with static features. 

Reproducible: Always

Steps to Reproduce:
1. Create in a model, a Class that extends ENamedElement (from ecore)
2. Create one or more EAttributes
2. Set de genmodel property "Feature Delegation" to "Dynamic"
3. Generate Code
Comment 1 Ed Merks CLA 2011-06-21 12:32:05 EDT
You can't use dynamic delegation when extending a statically generated base class.
Comment 2 Andres Alvarez Mattos CLA 2011-06-21 12:39:15 EDT
With Reflective Feature Delegation I don't have this problem. Can I asume that when extending a statically generated base
class I should work with "Reflective" mode ?
Comment 3 Ed Merks CLA 2011-06-21 12:53:12 EDT
Yes, I was going to mention that I wasn't even sure if reflective works.  But dynamic is definitely optimized to make assumptions that everything is fully dynamic.  I.e., look at the extra overhead of the other version of eDynamicGet.

  public Object eDynamicGet(int featureID, boolean resolve, boolean coreType)
  {
    return eDynamicGet(featureID - eStaticFeatureCount(), eClass().getEStructuralFeature(featureID), resolve, coreType);
  }


It has to do more work just to call a method that could be more efficiently called directly.

I'm not sure the value of using either dynamic or reflective when the base class is neither...