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 218495 - Inspect and Transform option "No Loggers" breaks certain java files
Summary: Inspect and Transform option "No Loggers" breaks certain java files
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-18 00:39 UTC by NuclearRussian
Modified: 2013-06-18 14:58 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
original file (9.29 KB, application/octet-stream)
2012-09-18 00:39 UTC, NuclearRussian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NuclearRussian 2012-09-18 00:39:48 UTC
Created attachment 124482 [details]
original file

I was importing and refactoring the latest source files for ImageJ, and upon applying all possible transforms got a number of errors - some files returned null exception, some got broken, and this is one of the more obvious issues.


Attached is simple java file(original, working version), which, when acted on by the "No loggers" option under logging in inspect and transform, breaks the file.

Relevant piece of code change, besides all the weird formatting, is

class ColorGenerator extends ColorProcessor{
 //bunch of code   
} 

class ColorCanvas extends Canvas implements MouseListener, MouseMotionListener{
 int width, height;
 Vector colors;
 //bunch of code 2
}



to




class ColorGenerator extends ColorProcessor{
 //bunch of code
 private static final Logger LOG =   Logger.getLogger(ColorGenerator.class.getName()); 
}

class ColorCanvas extends Canvas implements MouseListener, MouseMotionListener{
 int width,
 int width, height;
 Vector colors;
 //bunch of code 2
 private static final Logger LOG = Logger.getLogger(ColorCanvas.class.getName());
}


Somehow insertion of the LOG logger creates an extra initialization statement when multiple variables are initialized in 1 line, obviously resulting in file not compiling.

This can be made into a trivial test file of only several lines, namely:

class dummy {
    
}

class TestClass {
    int a,b;
    Object c;
}

changes to

class dummy {
    private static final Logger LOG = Logger.getLogger(dummy.class.getName());    
}

class TestClass {

    int a,
    int a,b;
    Object c;
    private static final Logger LOG = Logger.getLogger(TestClass.class.getName());
}



Conditions:
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.7.0_07; Java HotSpot(TM) 64-Bit Server VM 23.3-b01
System: Windows 7 version 6.1 running on amd64; Cp1251; en_CA (nb)
Comment 1 Quality Engineering 2013-06-18 14:49:30 UTC
Integrated into 'main-golden', will be available in build *201306181109* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a3d39bc8afa5
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #218495: better diffing of top-level classes, being more careful when printing field groups
Comment 2 Jan Lahoda 2013-06-18 14:58:39 UTC
Should be fine after the above changeset.