6

I have a file with nested classes, but it's becoming long enough to be unreadable. Is there a way I can break out the nested classes into separate files?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Vlad the Impala
  • 15,572
  • 16
  • 81
  • 124

3 Answers3

11

Use the right tools.

alt text

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
3

I'm afraid not.
As an alternative, you could consider converting some of them to plain Java classes: although nested classes increase encapsulation, you can certainly create good OO design without them.

My two cents.

Nikita Rybak
  • 67,365
  • 22
  • 157
  • 181
1

Write unit-tests to cover the code you are going to refactor.

Then use refactoring tools, e.g. Eclipse/JDT to extract each class. Run the tests for each refactoring job.

For extra fun, you can do this without the unit tests.

ocodo
  • 29,401
  • 18
  • 105
  • 117