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

Bug 366000

Summary: [Xtend] ability to define multiple classes in one file
Product: [Tools] Xtend Reporter: Sven Efftinge <sven.efftinge>
Component: CoreAssignee: Project Inbox <xtend-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: consiliens, jvb, sebastian.zarnekow
Version: 2.2.0Flags: sven.efftinge: juno+
Target Milestone: M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-12-08 05:12:43 EST
Currently an Xtend file consist of only one class.
For small internal structures it's convenient to be able to define them in the same file.

Example
class Foo {
  class MyInternalStructure {
    String foo
  }
}

Just a rough shot. 
We need to discuss the details (e.g. visibility, static, etc.).
Comment 1 Sven Efftinge CLA 2012-04-10 04:00:57 EDT
Starting by allowing multiple classes on top level, which will be translated to individual java source files.
I'll have to adjust the naming convention check (i.e. class must have the she name than the file).
I'm inclined to remove it completely. What do others think?
Comment 2 Sebastian Zarnekow CLA 2012-04-10 04:10:39 EDT
I really like the naming convention and would like to keep the name in sync with the (often only) top level class. However, I'm not sure that it's worth to have the check in place.
Comment 3 Sebastian Zarnekow CLA 2012-04-10 04:33:00 EDT
Having multiple classes per file may have impact on the Run As .. / Debug As .. selection handling.
Comment 4 Sven Efftinge CLA 2012-04-10 04:47:01 EDT
Yes, having them aligned seems to be common. But it's not always what you want take for instance  domain models e.g. Xcore. You wouldn't want to be forced to name the file like the first class.

Maybe we can have an optional check (i.e. when we support preferences).
Comment 5 Sven Efftinge CLA 2012-04-10 09:48:27 EDT
It's now possible to have multiple top-level classes. 

Inner classes are tracked in bug #376399
Comment 6 Karsten Thoms CLA 2017-09-19 18:03:33 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 18:13:42 EDT
Closing all bugs that were set to RESOLVED before Neon.0