[
https://issues.apache.org/jira/browse/NETBEANS-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gili updated NETBEANS-332:
--------------------------
Description:
1. Given:
{code:java}
public enu NoOpAllowPriceStep
{
INSTANCE;
public Order atMaximumPrice(BigDecimal price)
{
return null;
}
public Order atBestPrice()
{
return null;
}
}
{code}
2. Invoke code-format
3. File is reformatted as following:
{code:java}
public enu
NoOpAllowPriceStep
{
INSTANCE;
public Order
atMaximumPrice
(BigDecimal
price
)
{
return null;
}
public Order
atBestPrice
()
{
return null;
}
}
{code}
Expected behavior: If file cannot be parsed, IDE should beep and refuse to
reformat. The file contents should not be changed.
Justification: If code-format rearranges tokens, then user corrects the
compiler error, then invokes code-format again, he/she will not end up with the
same result as if they had corrected the compiler error in the first place and
invoked code-format. It takes a lot of effort to fix the formatting once the
IDE messes it up.
was:
1. Given:
{code:java}
public enu NoOpAllowPriceStep
{
INSTANCE;
public Order atMaximumPrice(BigDecimal price)
{
return null;
}
@Override
public Order atBestPrice()
{
return null;
}
}
{code}
2. Invoke code-format
3. File is reformatted as following:
{code:java}
public enu
NoOpAllowPriceStep
{
INSTANCE;
public Order
atMaximumPrice
(BigDecimal
price
)
{
return null;
}
@Override
public Order
atBestPrice
()
{
return null;
}
}
{code}
Expected behavior: If file cannot be parsed, IDE should beep and refuse to
reformat. The file contents should not be changed.
Justification: If code-format rearranges tokens, then user corrects the
compiler error, then invokes code-format again, he/she will not end up with the
same result as if they had corrected the compiler error in the first place and
invoked code-format. It takes a lot of effort to fix the formatting once the
IDE messes it up.
> Code-format messes up file if it cannot be parsed
> -------------------------------------------------
>
> Key: NETBEANS-332
> URL: https://issues.apache.org/jira/browse/NETBEANS-332
> Project: NetBeans
> Issue Type: Bug
> Components: editor - Formatting & Indentation
> Environment: Product Version: Apache NetBeans IDE Dev (Build
> 20180117-unknown-revn)
> Updates: Updates available
> Java: 9.0.4; Java HotSpot(TM) 64-Bit Server VM 9.0.4+11
> Runtime: Java(TM) SE Runtime Environment 9.0.4+11
> System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (nb)
> User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
> Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev
> Reporter: Gili
> Priority: Major
>
> 1. Given:
>
> {code:java}
> public enu NoOpAllowPriceStep
> {
> INSTANCE;
> public Order atMaximumPrice(BigDecimal price)
> {
> return null;
> }
> public Order atBestPrice()
> {
> return null;
> }
> }
> {code}
> 2. Invoke code-format
> 3. File is reformatted as following:
>
> {code:java}
> public enu
> NoOpAllowPriceStep
> {
> INSTANCE;
> public Order
> atMaximumPrice
> (BigDecimal
> price
> )
> {
> return null;
> }
> public Order
> atBestPrice
> ()
> {
> return null;
> }
> }
> {code}
> Expected behavior: If file cannot be parsed, IDE should beep and refuse to
> reformat. The file contents should not be changed.
> Justification: If code-format rearranges tokens, then user corrects the
> compiler error, then invokes code-format again, he/she will not end up with
> the same result as if they had corrected the compiler error in the first
> place and invoked code-format. It takes a lot of effort to fix the formatting
> once the IDE messes it up.
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists