Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 159940 - Error in rewriting of EmptyStatement
Error in rewriting of EmptyStatement
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: Source
6.x
All All
: P3 (vote)
: 6.x
Assigned To: Rastislav Komara
issues@java
: NETFIX
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-09 21:21 UTC by tronicek
Modified: 2009-05-25 20:59 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
test case (2.17 KB, text/plain)
2009-05-16 21:27 UTC, fommil
Details
test case and proposed fix (2.86 KB, text/plain)
2009-05-17 00:41 UTC, fommil
Details

Note You need to log in before you can comment on or make changes to this bug.
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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo