This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 254025 - Incorrect calculation of first invalid line (according to specified import rules)
Summary: Incorrect calculation of first invalid line (according to specified import ru...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
: 253820 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-31 10:02 UTC by stwr
Modified: 2015-08-03 14:36 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Formatting Options (23.93 KB, image/png)
2015-07-31 10:03 UTC, stwr
Details
Result (20.05 KB, image/png)
2015-07-31 10:03 UTC, stwr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stwr 2015-07-31 10:02:37 UTC
Product Version: NetBeans IDE 8.1 Beta (Build 201507302201)
Java: 1.8.0_60-ea; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-ea-b25
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\cendrowiczm\AppData\Roaming\NetBeans\8.1beta
Cache directory: C:\Users\cendrowiczm\AppData\Local\NetBeans\Cache\8.1beta

--Preparation--

Download the Formatting project available for this test specification --> http://services.netbeans.org/synergy/client/app/#/specification/297/v/2

--Use Case--

1. Change the Formatting options like it is shown on the picture 'Formatting Options'
2. Make sure the IDE is showing the hint 'Organize imports'
3. Open imports.Count class
4. Remove all imports if any
5. Use following imports:

//imports start here
import java.util.*;

import static imports.anotherpackage.AuxClass.m1;
import static imports.anotherpackage.AuxClass.m2;
import static imports.anotherpackage.AuxClass.m3;
import static imports.anotherpackage.AuxClass.m4;
//imports end here

--Expected result--

First import ('java.util.*') is marked as the first line which does not fit to the specified code style rules.

--Actual result--

First static import ('imports.anotherpackage.AuxClass.m1') is marked as the first line which does not fit to the specified code style rules. See the 'Result' picture.


--Thoughts--

I started to wonder when could the Formatter realize that first static import is actually the first bad line. My answer was - maybe it answers the question 'what should I find at this line?' having, of course, specified rules. The answer could be 'I should find here some java.util.XYZ import'.
But then...why the Formatter's answer was bad for the question 'what should I find at line with 'import java.util.*'? :)

Maybe it is the problem with star imports only.
Comment 1 stwr 2015-07-31 10:03:33 UTC
Created attachment 155076 [details]
Formatting Options
Comment 2 stwr 2015-07-31 10:03:47 UTC
Created attachment 155077 [details]
Result
Comment 3 Dusan Balek 2015-07-31 13:21:08 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/17afadd89f45
Comment 4 Quality Engineering 2015-08-01 02:01:39 UTC
Integrated into 'main-silver', will be available in build *201508010002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/17afadd89f45
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #254025 - Incorrect calculation of first invalid line (according to specified import rules) - fixed.
Comment 5 Svata Dedic 2015-08-03 14:36:09 UTC
*** Bug 253820 has been marked as a duplicate of this bug. ***