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

Bug 345458

Summary: [xtend] invalid java code generated
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Moritz Eysholdt CLA 2011-05-11 12:03:34 EDT
The xtend code
------
def collectAllAmbiguousTransitions(ISyntacticSequencerPDAProvider$ISynFollowerOwner state, Set<ISyntacticSequencerPDAProvider$ISynTransition> result, Set<Object> visited) {
  if(visited.add(state)) {
    if(state instanceof ISyntacticSequencerPDAProvider$ISynTransition && (state as ISyntacticSequencerPDAProvider$ISynTransition).syntacticallyAmbiguous)
      result.add(state as ISyntacticSequencerPDAProvider$ISynTransition)
    for(follower:state.followers)
      collectAllAmbiguousTransitions(follower, result, visited)
  }
}
-------

is compiled to


-------
public Object collectAllAmbiguousTransitions(final ISynFollowerOwner state, final Set<ISynTransition> result, final Set<Object> visited) {
    Object _xifexpression = null;
    final Set<Object> typeConverted_visited = (Set<Object>)visited;
    boolean _add = typeConverted_visited.add(state);
    if (_add) {
      void _xblockexpression = null;
      {
        boolean _operator_and = false;
        if (!(state instanceof org.eclipse.xtext.serializer.ISyntacticSequencerPDAProvider.ISynTransition)) {
          _operator_and = false;
        } else {
          boolean _isSyntacticallyAmbiguous = ((ISynTransition) state).isSyntacticallyAmbiguous();
          _operator_and = BooleanExtensions.operator_and((state instanceof org.eclipse.xtext.serializer.ISyntacticSequencerPDAProvider.ISynTransition), _isSyntacticallyAmbiguous);
        }
        if (_operator_and) {
          result.add(((ISynTransition) state));
        }
        List<ISynState> _followers = state.getFollowers();
        for (ISynState follower : _followers) {
          this.collectAllAmbiguousTransitions(follower, result, visited);
        }
        _xblockexpression = (null);
      }
    }
    return _xifexpression;
  }
------------

which is syntactically incorrect because of

------
	void is an invalid type for the variable _xblockexpression
	_xblockexpression cannot be resolved to a variable

java.lang.Error: Unresolved compilation problems: 
	void is an invalid type for the variable _xblockexpression
	_xblockexpression cannot be resolved to a variable
-------
Comment 1 Sven Efftinge CLA 2011-05-12 03:51:01 EDT

*** This bug has been marked as a duplicate of bug 345371 ***