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.
Summary: | Interaction between GeneratorUtilities.importFQNs and WorkingCopy.rewrite | ||
---|---|---|---|
Product: | java | Reporter: | tronicek <tronicek> |
Component: | Source | Assignee: | Rastislav Komara <moonko> |
Status: | RESOLVED WONTFIX | ||
Severity: | blocker | CC: | mmirilovic |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
tronicek
2009-03-09 22:06:49 UTC
Please, provide exact algorithm of replacing nodes. Or provide test case file. Thank you. Here it is: @Override public Void visitBlock(BlockTree node, Void p) { List<? extends StatementTree> st = node.getStatements(); if (st.size() == 2) { List<StatementTree> st2 = new ArrayList<StatementTree>(); st2.add(st.get(0)); TreeMaker make = wc.getTreeMaker(); BlockTree modified = make.Block(st2, node.isStatic()); modified = GeneratorUtilities.get(wc).importFQNs(modified); System.out.println("original: " + node); System.out.println("modified: " + modified); wc.rewrite(node, modified); } return super.visitBlock(node, p); } When I comment out line "modified = GeneratorUtilities.get(wc).importFQNs(modified);" and run it on the input void m4(int[] p) { if (p[0] > 0) { if (p[1] > 0) { System.out.println("x"); } if (p[1] > 0) { System.out.println("x"); } } if (p[0] > 0) { if (p[1] > 0) { System.out.println("x"); } if (p[1] > 0) { System.out.println("x"); } } } I get the result void m4(int[] p) { if (p[0] > 0) { if (p[1] > 0) { System.out.println("x"); } } } This is correct. However, with the line "modified = GeneratorUtilities.get(wc).importFQNs(modified);", the result is void m4(int[] p) { if (p[0] > 0) { if (p[1] > 0) { System.out.println("x"); } if (p[1] > 0) { System.out.println("x"); } } } which is not correct. ... requested information provided - remove INCOMPLETE This issue has no affect on existing editor/java functionality. Affected are only newly created manipulations on tree. Also this issue has no effect for current or future end user. The appropriate fix can cause higher risk of regression. waived. NetBeans.org Migration: changing resolution from LATER to WONTFIX |