Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357392 - JavaTypeImpl with clazz=java.lang.String doesn't match StringTypeImpl
Summary: JavaTypeImpl with clazz=java.lang.String doesn't match StringTypeImpl
Status: CLOSED FIXED
Alias: None
Product: M2T
Classification: Modeling
Component: Xpand (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: M2   Edit
Assignee: Karsten Thoms CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-12 10:57 EDT by Ali AKAR CLA
Modified: 2013-02-21 08:13 EST (History)
4 users (show)

See Also:
karsten.thoms: juno+


Attachments
patch for bug 357392 (1.85 KB, patch)
2011-09-26 07:45 EDT, Benedikt Niehues CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ali AKAR CLA 2011-09-12 10:57:34 EDT
From the xtend/xpand file the type of my feature is StringTypeImpl and from the Ecore it's a JavaTypeImpl where the clazz attribute is a java.lang.String. In my Ecore the type of the feature is not an EString, but an Identifier with the instanceclassname is a java.lang.String. 

That's why features are not found when compiling an xtend file.

I have modified JavaTypeImpl#internalIsAssignableFrom(final Type t) to the code below:

@Override
    protected boolean internalIsAssignableFrom(final Type t) {
        if (t instanceof JavaTypeImpl){
            return clazz.isAssignableFrom(((JavaTypeImpl) t).clazz);
        }else if (t instanceof StringTypeImpl){
        	return clazz.isAssignableFrom(String.class);
        }else if(t instanceof BooleanTypeImpl){
        	return clazz.isAssignableFrom(Boolean.class);
        }else if(t instanceof IntegerTypeImpl){
        	return clazz.isAssignableFrom(Integer.class);
        }else if(t instanceof RealTypeImpl){
        	return clazz.isAssignableFrom(Double.class) || clazz.isAssignableFrom(Float.class);
        }
        return false;
    }

This code resolve my problem but I don't know if it's a good idea to do this at this level.
Comment 1 Sven Efftinge CLA 2011-09-19 04:44:39 EDT
could you please provide a small sample project to reproduce the issue?
Comment 2 Benedikt Niehues CLA 2011-09-26 07:45:35 EDT
Created attachment 204008 [details]
patch for bug 357392

this patches the bug 357392
Comment 3 Ali AKAR CLA 2011-09-26 09:22:25 EDT
OK for the patch !
Comment 4 Karsten Thoms CLA 2011-09-26 11:15:27 EDT
Applied and reviewed the patch. Thanks for submitting.
Comment 5 Karsten Thoms CLA 2013-02-21 08:13:30 EST
Bug resolved before Xpand 1.2 release date => Closing