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 238372 - org.netbeans.spi.java.hints.JavaFixUtilities.rewriteFix removes JavaDoc
Summary: org.netbeans.spi.java.hints.JavaFixUtilities.rewriteFix removes JavaDoc
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: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-14 14:22 UTC by markiewb
Modified: 2013-12-13 13:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Failing testcase (4.79 KB, text/plain)
2013-11-14 14:22 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-11-14 14:22:40 UTC
Created attachment 142183 [details]
Failing testcase

When transforming an expression via org.netbeans.spi.java.hints.JavaFixUtilities.rewriteFix then the leading and following comment is deleted

Example (full example attached as a testcase)

This simple hint

        @Hint(displayName = "#DN_UseBigDecimalConstantsONE", description = 
"#DESC_UseBigDecimalConstantsONE", category = "suggestions", hintKind = Hint.Kind.INSPECTION, severity = Severity.HINT)
        @TriggerPatterns(
                {
                    @TriggerPattern("new java.math.BigDecimal(\"1\")"),}
        )
        public static ErrorDescription convert(HintContext ctx) {
            Fix fix = org.netbeans.spi.java.hints.JavaFixUtilities.rewriteFix(ctx, Bundle.ERR_UseBDConstFixONE(), ctx.getPath(), "java.math.BigDecimal.ONE");
            return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), Bundle.ERR_UseBDConstFixONE(), fix);
        }

transforms

java.math.BigDecimal[] b=new java.math.BigDecimal[]{null, /**PRE*/new java.math.BigDecimal(\"1\")/**POST*/, null};

to

ACTUAL:
java.math.BigDecimal[] b=new java.math.BigDecimal[]{null, BigDecimal.ONE, null};
(the comments are lost)

EXPECTED:
java.math.BigDecimal[] b=new java.math.BigDecimal[]{null, /**PRE*/new BigDecimal.ONE/**POST*/, null};
(the comments are preserved)


Tested with 7.2.1 and 201311130002
Comment 2 Svata Dedic 2013-11-26 17:24:17 UTC
229590 is unrelated, does not use rewriteFix. 

This defect is most probably fixed by http://hg.netbeans.org/jet-main/rev/c6f518969ecb, related to issue #237313 and issue #234134.

Safe enough to put in the patch.