Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Behavior change when formatting else-if blocks(Behavior change when formatting else-if blocks)
Behavior change when formatting else-if blocks [message #1705017] Tue, 11 August 2015 08:53 Go to next message
Eclipse UserFriend
Hi

I've upgraded recently to Eclipse Mars. I've noticed a different behavior when formatting else-if blocks :

Before :
if (0==1)
{
   return 0;
}
else if (1==2)
{
   return 1;
}
else if (2==3)
{
   return 2;
}
else if (3==4)
{
   return 3;
}
else
{
   return 4;
}



With Eclipse Mars :
if (0==1)
{
   return 0;
}
else
   if (1==2)
{
   return 1;
}
else
      if (2==3)
{
   return 2;
}
else
         if (3==4)
{
   return 3;
}
else
{
   return 4;
}


This behavior occurs even if the option "Keep 'else if' on one line" is checked in the "Control Statements" tab of the formatter options. Any ideas how to fix this? Is there a workaround that I can use?

Thanks.
Re: Behavior change when formatting else-if blocks [message #1705340 is a reply to message #1705017] Thu, 13 August 2015 17:53 Go to previous message
Eclipse UserFriend
It's probably this bug; https://bugs.eclipse.org/bugs/show_bug.cgi?id=472009
The workaround is to change policy for Line Wrapping -> Statements -> Compact 'if else' to "Do not wrap"
Previous Topic:modeline or local file variable -*- line support
Next Topic:code formatter behaviour has changed from Luna to Mars
Goto Forum:
  


Current Time: Thu Apr 24 10:49:54 EDT 2025

Powered by FUDForum. Page generated in 0.02430 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top