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.
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
Related to https://netbeans.org/bugzilla/show_bug.cgi?id=229590 and https://netbeans.org/bugzilla/show_bug.cgi?id=237072 i guess
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.