# HG changeset patch # User Jan Lahoda # Date 1299435789 -3600 # Node ID b9a0402dbea39d76fa8780dbbce5f0913e4a561b # Parent 59cba1c67c4062ac218bffb79c258a977b5f5629 Fixing @SuppressWarnings for marks-based hints. diff -r 59cba1c67c40 -r b9a0402dbea3 api/src/org/netbeans/modules/jackpot30/impl/hints/HintsInvoker.java --- a/api/src/org/netbeans/modules/jackpot30/impl/hints/HintsInvoker.java Sun Mar 06 17:38:53 2011 +0100 +++ b/api/src/org/netbeans/modules/jackpot30/impl/hints/HintsInvoker.java Sun Mar 06 19:23:09 2011 +0100 @@ -99,6 +99,7 @@ import org.netbeans.modules.jackpot30.spi.HintDescription.Value; import org.netbeans.modules.jackpot30.spi.HintMetadata; import org.netbeans.modules.jackpot30.spi.HintMetadata.HintSeverity; +import org.netbeans.modules.jackpot30.spi.support.FixFactory; import org.netbeans.spi.editor.hints.ErrorDescription; import org.netbeans.spi.editor.hints.ErrorDescriptionFactory; import org.netbeans.spi.editor.hints.Fix; @@ -559,8 +560,22 @@ if (hed.fixDescriptions.isEmpty()) { //XXX: @SuppressWarnings! ErrorDescription ed = hed.acceptor.accept(hed.ctx); + List swKeys = new ArrayList(); - ed = ErrorDescriptionFactory.createErrorDescription(ed.getSeverity(), ed.getDescription(), hed.createdFixes, ed.getFile(), ed.getRange().getBegin().getOffset(), ed.getRange().getEnd().getOffset()); + for (String key : hed.hd.getSuppressWarnings()) { + if (key == null) break; + swKeys.add(key); + } + + List fixes = new ArrayList(); + + fixes.addAll(hed.createdFixes); + + if (!swKeys.isEmpty()) { + fixes.addAll(FixFactory.createSuppressWarnings(info, hed.ctx.getPath(), swKeys.toArray(new String[0]))); + } + + ed = ErrorDescriptionFactory.createErrorDescription(ed.getSeverity(), ed.getDescription(), fixes, ed.getFile(), ed.getRange().getBegin().getOffset(), ed.getRange().getEnd().getOffset()); if (ed != null) { merge(errors, hed.hd, ed);