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 159940

Summary: Error in rewriting of EmptyStatement
Product: java Reporter: tronicek <tronicek>
Component: SourceAssignee: Rastislav Komara <moonko>
Status: RESOLVED FIXED    
Severity: blocker CC: fommil, jkovalsky
Priority: P3 Keywords: NETFIX
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: test case
test case and proposed fix

Description tronicek 2009-03-09 21:21:47 UTC
I am rewriting EmptyStatement to EmptyStatement:

                modified = make.EmptyStatement();
                System.out.println("original: " + node);
                System.out.println("modified: " + modified);
                rewrite(node, modified);

The source is

public class X {

    void m1(int p) {
        if (p > 5);
    }
}

The result is:

public class X {

    void m1(int p) {
        if (p > 5)
    }
}

which is not correct because the empty statement (';') is missing.
In the log, there is:

original: ;
modified: ;
-----
package testproject;

public class X {

    void m1(int p) {
        if (p > 5);
    }
}
-----
INFO [org.netbeans.modules.java.source.save.CasualDiff]: Illegal values: from = -1; to = 80.Please, attach your
messages.log to new issue!
Comment 1 David Strupl 2009-03-31 16:06:48 UTC
Resolving all issues with milestone "future" as LATER. If you feel strongly that
it should be implemented please reopen and set the target milestone to "next".
Comment 2 tronicek 2009-04-01 07:53:41 UTC
I am working on a refactoring module and these bugs are crucial for it to work.
Comment 3 fommil 2009-05-16 20:53:45 UTC
I'd like to NetFIX [1] this bug. Is it possible? [1] http://wiki.netbeans.org/NetFIX
Comment 4 fommil 2009-05-16 21:27:52 UTC
Created attachment 82247 [details]
test case
Comment 5 fommil 2009-05-16 21:29:04 UTC
Bug confirmed... the patch I submitted contains a failing test unit based on the OPs case.
Comment 6 fommil 2009-05-17 00:41:08 UTC
Created attachment 82251 [details]
test case and proposed fix
Comment 7 fommil 2009-05-17 00:44:39 UTC
I've uploaded a proposed fix... if I understand it correctly, this was much more widespread than for diffIf. The bug was that all instances of kind JCTree.SKIP 
(i.e. empty statements ";") were being completely ignored by the diff engine! Now they are not ignored.
Comment 8 Rastislav Komara 2009-05-22 13:37:30 UTC
ACCEPTED.
Comment 9 Rastislav Komara 2009-05-22 15:22:49 UTC
jet-main #ef34c805eb0e
Comment 10 Quality Engineering 2009-05-23 06:57:00 UTC
Integrated into 'main-golden', will be available in build *200905230201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ef34c805eb0e
User: Rastislav Komara <moonko@netbeans.org>
Log: #159940: Error in rewriting of EmptyStatement