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 183777 - [69cat] Some code templates generated uncompilable source modification
Summary: [69cat] Some code templates generated uncompilable source modification
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-09 14:48 UTC by Michel Graciano
Modified: 2010-04-14 12:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2010-04-09 14:48:25 UTC
[ BUILD # : ef67b41cc450 ]
[ JDK VERSION : 1.6.* ]

Follow this steps:
1. Create a new main class like this:

public class NewMain {
   public static void main(String[] args) {
      final String str = "abc";
      str.toString();
   }
}

2. Select the line 3, 'final String str = "abc";', and hit code template
'Surround with if (exp)...'

the generated code will be:

public class NewMain {
   public static void main(String[] args) {
      String str = null;
      if (exp) {
         final str  = "abc";
      } else {
      }
      str.toString();
   }
}

and the expected is remove 'final' keyword.
Comment 1 Dusan Balek 2010-04-14 12:29:14 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/b0d96cd8edd2