Search code examples
javaeclipsefoldingcode-folding

Eclipse folding with java


Working with eclipse in a java collapsed file if i try to write a method between two collapsed methods when I write public and press space automatically the ide collapses the word public inside the method below.

State initial 
   - public methodA()
   - public methodC()

Step 1:
   - public methodA()
     public 
   - public methodC()

Eclipse bug
   - public methodA()
   - public methodC() //Error because public is declared twice!

If I write the method faster the problem doesn't occur. Any form to avoid this weird behaviour without disable code folding?

Thanks in advance


Solution

  • What I do is to unfold the method before where I want to insert the code. Then it doesn't actually fold the new text into the previous (folded) method. But the simplest way is probably to just not fold the code and use the outline view to navigate around the file.