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

Bug 345371

Summary: Xtend2 generates a void _xblockexpression
Product: [Modeling] TMF Reporter: Serano Colameo <serano.colameo>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: moritz.eysholdt, sven.efftinge
Version: unspecifiedFlags: sven.efftinge: indigo+
Target Milestone: RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Serano Colameo CLA 2011-05-11 04:03:19 EDT
Build Identifier: 2.0.0.v201105101404

  public String toIdlFileName(final InterfaceDcl iface) { 
    try { 
      void _xblockexpression = null; // wrong block definition
      { 
....


Reproducible: Always

Steps to Reproduce:
1. create an Xtend2 class
2. put this code snippet:
    def String toIdlFileName(InterfaceDcl iface) { 
                try { 
                        val fileName = new File(iface.eResource.URI.toFileString).name 
                        if (fileName.contains('.')) return fileName.split('\\.').get(0) 
                        return fileName 
                } catch (Exception ex) { 
                        return iface.name; 
                } 
        }
Comment 1 Serano Colameo CLA 2011-05-11 04:18:51 EDT
workaround: remove "return" keyword and xtend generates correct statements
Comment 2 Sven Efftinge CLA 2011-05-12 03:51:01 EDT
*** Bug 345458 has been marked as a duplicate of this bug. ***
Comment 3 Sven Efftinge CLA 2011-05-16 04:14:26 EDT
turned out to be a general problem with branching expressions (if, switch, try-catch) in cases where branches were mixing early exits (return, throw) and simple expressions.
Fixed and pushed to master.
Comment 4 Karsten Thoms CLA 2017-09-19 17:54:20 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 5 Karsten Thoms CLA 2017-09-19 18:05:05 EDT
Closing all bugs that were set to RESOLVED before Neon.0