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 244632 - JavaFixUtilities.removeFromParent does not work with Tree.Kind.EMPTY_STATEMENT
Summary: JavaFixUtilities.removeFromParent does not work with Tree.Kind.EMPTY_STATEMENT
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-21 16:40 UTC by markiewb
Modified: 2014-06-07 12:31 UTC (History)
0 users

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 markiewb 2014-05-21 16:40:22 UTC
Take this easy hint

    @Hint(displayName = "#DN_DoubleSemicolon", description = "#DESC_DoubleSemicolon", category = "suggestions", hintKind = Hint.Kind.INSPECTION, severity = Severity.WARNING)
    @TriggerTreeKind(Tree.Kind.EMPTY_STATEMENT)
    @NbBundle.Messages("ERR_DoubleSemicolon=Remove semicolon")
    public static ErrorDescription hint(HintContext ctx) {

        Fix fix = JavaFixUtilities.removeFromParent(ctx, "XXX", ctx.getPath());
        return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), Bundle.ERR_DoubleSemicolon(), fix);
    }

When executing the hint

SEVERE: Cannot resolve handle=TreePathHandle[delegate:TreeDelegate[kind:EMPTY_STATEMENT, enclosingElement:ElementHandle[kind=METHOD; sigs=test.Test main ([Ljava/lang/String;)V ], file:C:\Users\markiewb\AppData\Local\Temp\tests-markiewb\d.m.n.p.h.s.D\testDoubleSemicolon2\src\test\Test.java@61aa3e6c:14f9a9d0]]

will be logged and the transformation did not apply.


See https://github.com/markiewb/nb-additional-hints/issues/38

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version , NetBeans 8.0 Patch 1.1
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\markiewb\AppData\Roaming\NetBeans\8.0
Cache directory: C:\Users\markiewb\AppData\Local\NetBeans\Cache\8.0
Comment 1 Dusan Balek 2014-05-30 10:58:34 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/9312191d51b6
Comment 2 Quality Engineering 2014-06-01 01:31:35 UTC
Integrated into 'main-silver', will be available in build *201406010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/9312191d51b6
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #244632: JavaFixUtilities.removeFromParent does not work with Tree.Kind.EMPTY_STATEMENT - fixed.
Comment 3 markiewb 2014-06-07 12:31:42 UTC
Follow up issue is https://netbeans.org/bugzilla/show_bug.cgi?id=244934