Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366000 - [Xtend] ability to define multiple classes in one file
Summary: [Xtend] ability to define multiple classes in one file
Status: CLOSED FIXED
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 05:12 EST by Sven Efftinge CLA
Modified: 2017-09-19 18:13 EDT (History)
3 users (show)

See Also:
sven.efftinge: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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