Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345405 - Syntax errors in generated JvmModelInferer
Summary: Syntax errors in generated JvmModelInferer
Status: VERIFIED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: RC1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 07:56 EDT by Karsten Thoms CLA
Modified: 2011-05-12 02:30 EDT (History)
1 user (show)

See Also:
sven.efftinge: indigo+


Attachments
Test project (8.72 KB, application/x-zip)
2011-05-11 07:56 EDT, Karsten Thoms CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2011-05-11 07:56:38 EDT
Created attachment 195333 [details]
Test project

When introducing Xbase to a DSL and generate the DSL, the initially created JvmModelInferrer xtend class has syntax errors.

To reproduce import the attached project and run the workflow.

- import com.google.inject.Inject is missing
- instance name for injected associator is missing

==============================================
GENERATED:
==============================================
package org.xtext.example.mydsl.jvmmodel

import org.eclipse.xtext.xbase.jvmmodel.*
import org.eclipse.xtext.common.types.*
import org.eclipse.emf.ecore.EObject
import java.util.List
import com.google.inject.Inject

/**
 * <p>Infers a JVM model from the source model.</p>
 *
 * <p>The JVM model should contain all elements that would appear in the Java code
 * which is generated from the source model.
 * Other Xtend models link against the JVM model rather than the source model. The JVM
 * model elements should be associated with their source element by means of the
 * {@link IJvmModelAssociator}.</p>
 */
class MyDslJvmModelInferrer implements IJvmModelInferrer {

  @Inject IJvmModelAssociator jvmModelAssociator

     override List<? extends JvmDeclaredType> inferJvmModel(EObject sourceObject) {
       return newArrayList();
     }
}


==============================================
FIXED:
==============================================
package org.xtext.example.mydsl.jvmmodel
 
import org.eclipse.xtext.xbase.jvmmodel.*
import org.eclipse.xtext.common.types.*
import org.eclipse.emf.ecore.EObject
import java.util.List

/**
 * <p>Infers a JVM model from the source model.</p> 
 *
 * <p>The JVM model should contain all elements that would appear in the Java code 
 * which is generated from the source model. 
 * Other Xtend models link against the JVM model rather than the source model. The JVM
 * model elements should be associated with their source element by means of the
 * {@link IJvmModelAssociator}.</p>     
 */
class MyDslJvmModelInferrer implements IJvmModelInferrer {

	@Inject IJvmModelAssociator 

   	override List<? extends JvmDeclaredType> inferJvmModel(EObject sourceObject) {
   		return newArrayList();
   	}
}
Comment 1 Sven Efftinge CLA 2011-05-11 10:54:27 EDT
pushed to master
Comment 2 Karsten Thoms CLA 2011-05-12 02:30:44 EDT
works after update