Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354384 - [xbase] Allow instantiating inner classes
Summary: [xbase] Allow instantiating inner classes
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.5.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 377463 (view as bug list)
Depends on: 427279
Blocks:
  Show dependency tree
 
Reported: 2011-08-10 10:41 EDT by Knut Wannheden CLA
Modified: 2015-11-12 05:03 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Knut Wannheden CLA 2011-08-10 10:41:05 EDT
Given the following Java classes:

public class Foo {
  public class Bar {
  }
}

In Xtend2 I should be able to write "new Foo().new Bar()". But that gives me a parse error on the second "new".

The editor does however accept "new Foo$Bar()". But that's of course wrong and the generated code doesn't compile.

Setting this one to minor as I think this is fairly unusual coding style.
Comment 1 Sven Efftinge CLA 2014-02-03 10:24:05 EST
*** Bug 377463 has been marked as a duplicate of this bug. ***
Comment 2 Dennis Huebner CLA 2015-11-03 08:49:32 EST
Had the same issue today. If the outer type is not final, following strategy could be a workaround:

val bar = new Foo(){def createBar() {new Bar}}.createBar()