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.

View | Details | Raw Unified | Return to bug 214721
Collapse All | Expand All

(-)a/java.source/src/org/netbeans/api/java/source/TranslateIdentifier.java (+2 lines)
Lines 398-403 Link Here
398
    }
398
    }
399
399
400
    public Tree visitMethod(MethodTree node, Boolean p) {
400
    public Tree visitMethod(MethodTree node, Boolean p) {
401
        if (unit != null && info.getTreeUtilities().isSynthetic(/*should not be used:*/unit, node)) return node;
402
401
        BlockTree body = (BlockTree) translateTree(node.getBody());
403
        BlockTree body = (BlockTree) translateTree(node.getBody());
402
        Tree defaultValue = translateTree(node.getDefaultValue());
404
        Tree defaultValue = translateTree(node.getDefaultValue());
403
        List<? extends VariableTree> parameters = translateTree(node.getParameters());
405
        List<? extends VariableTree> parameters = translateTree(node.getParameters());
(-)a/java.source/test/unit/src/org/netbeans/api/java/source/gen/FormRegressionTest.java (+37 lines)
Lines 217-222 Link Here
217
        System.err.println(res);
217
        System.err.println(res);
218
        assertEquals(golden, res);
218
        assertEquals(golden, res);
219
    }
219
    }
220
    
221
    public void testDontImportSyntheticConstructors() throws Exception {
222
        testFile = new File(getWorkDir(), "Test.java");
223
        String originalCode =
224
            "package test;\n" +
225
            "public class Test {\n" +
226
            "    private void initComponents(java.util.ArrayList orig) {\n" +
227
            "        new java.util.ArrayList(orig) {};\n" +
228
            "    }\n" +
229
            "}\n";
230
        TestUtilities.copyStringToFile(testFile, originalCode);
231
        String golden =
232
            "package test;\n\n" +
233
            "import java.util.ArrayList;\n\n" +
234
            "public class Test {\n" +
235
            "    private void initComponents(ArrayList orig) {\n" +
236
            "        new ArrayList(orig) {};\n" +
237
            "    }\n" +
238
            "}\n";
239
240
        JavaSource src = getJavaSource(testFile);
241
        Task<WorkingCopy> task = new Task<WorkingCopy>() {
242
243
            public void run(WorkingCopy workingCopy) throws IOException {
244
                workingCopy.toPhase(Phase.RESOLVED);
245
                CompilationUnitTree cut = workingCopy.getCompilationUnit();
246
                GeneratorUtilities gu = GeneratorUtilities.get(workingCopy);
247
                
248
                workingCopy.rewrite(cut, gu.importFQNs(cut));
249
            }
250
            
251
        };
252
        src.runModificationTask(task).commit();
253
        String res = TestUtilities.copyFileToString(testFile);
254
        System.err.println(res);
255
        assertEquals(golden, res);
256
    }
220
257
221
    String getGoldenPckg() {
258
    String getGoldenPckg() {
222
        return "";
259
        return "";

Return to bug 214721