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

Bug 347773

Summary: Wrong null type definition in function calls
Product: [Modeling] TMF Reporter: Serano Colameo <serano.colameo>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow, sven.efftinge
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Serano Colameo CLA 2011-05-31 08:29:59 EDT
Build Identifier: Xtext 2.0.0.v201105230203

xtend2:

def dispatch compile(InterfaceDcl src) {
	val params = [ParameterDcls pd|if (pd!= null)'''«FOR p : pd.paramDcl SEPARATOR ', '»«p.paramType» «p.name»«ENDFOR»''']
	val xtends = [List<InterfaceDcl> idcl|if (!idcl.empty) ''' extends «FOR i : idcl SEPARATOR ', '»«i.nameWithVersion»«ENDFOR»''']
	'''
	// Interface definitions

java:

protected CharSequence _compile(final OpDcl opDcl) {
    StringConcatenation _xblockexpression = null;
    {
      final Function1<ParameterDcls,StringConcatenation> _function = new Function1<ParameterDcls,StringConcatenation>() {
          public StringConcatenation apply(final ParameterDcls pd) {
            StringConcatenation _xifexpression = null;
            boolean _operator_notEquals = ObjectExtensions.operator_notEquals(pd, null);
            if (_operator_notEquals) {
              StringConcatenation _builder = new StringConcatenation();
              {
                EList<ParamDcl> _paramDcl = pd.getParamDcl();
                boolean hasAnyElements = false;
                for(ParamDcl p : _paramDcl) {
                  if (!hasAnyElements) {
                    hasAnyElements = true;
                  } else {
                    _builder.appendImmediate(", ", "");
                  }
=>                 null _paramType = Idl2IcmCompiler.this.getParamType(p);
                  _builder.append(_paramType, "");
                  _builder.append(" ");



Reproducible: Always

Steps to Reproduce:
1. bug is marked as =>
2.
3.
Comment 1 Serano Colameo CLA 2011-05-31 08:30:44 EDT
workaround:

	def dispatch compile(InterfaceDcl src) {
		val params = [ParameterDcls pd|if (pd!= null)'''«FOR p : pd.paramDcl SEPARATOR ', '»«p.paramType.toString» «p.name»«ENDFOR»''']
		val xtends = [List<InterfaceDcl> idcl|if (!idcl.empty) ''' extends «FOR i : idcl SEPARATOR ', '»«i.nameWithVersion»«ENDFOR»''']

und:

	def StringConcatenation getParamType(ParamDcl paramDcl) {
		if (paramDcl != null && paramDcl.typeSpec != null) paramDcl.typeSpec.toTypeDeclaration
		else ''''''
	}
Comment 2 Sebastian Zarnekow CLA 2011-08-16 17:42:48 EDT
Is this one still reproducable?
Comment 3 Sebastian Zarnekow CLA 2011-08-16 17:43:03 EDT
(In reply to comment #2)
> Is this one still reproducable?

I mean with Xtext 2.0.1
Comment 4 Serano Colameo CLA 2011-08-17 02:11:22 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > Is this one still reproducable?
> 
> I mean with Xtext 2.0.1

good question ;-)

I did not retest it because I've implemented a workaround to avoid this...

Unfortunately my code changed a lot and I cannot rollback to the point where this issue happened.

sorry,
serano
Comment 5 Sven Efftinge CLA 2011-08-24 03:12:18 EDT
closing this unless someone is able reproduce it.
Comment 6 Karsten Thoms CLA 2017-09-19 17:20:35 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:31:53 EDT
Closing all bugs that were set to RESOLVED before Neon.0