Fixing @SuppressWarnings for marks-based hints. marks
authorJan Lahoda <jlahoda@netbeans.org>
Sun, 06 Mar 2011 19:23:09 +0100
branchmarks
changeset 555b9a0402dbea3
parent 554 59cba1c67c40
Fixing @SuppressWarnings for marks-based hints.
api/src/org/netbeans/modules/jackpot30/impl/hints/HintsInvoker.java
     1.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/hints/HintsInvoker.java	Sun Mar 06 17:38:53 2011 +0100
     1.2 +++ b/api/src/org/netbeans/modules/jackpot30/impl/hints/HintsInvoker.java	Sun Mar 06 19:23:09 2011 +0100
     1.3 @@ -99,6 +99,7 @@
     1.4  import org.netbeans.modules.jackpot30.spi.HintDescription.Value;
     1.5  import org.netbeans.modules.jackpot30.spi.HintMetadata;
     1.6  import org.netbeans.modules.jackpot30.spi.HintMetadata.HintSeverity;
     1.7 +import org.netbeans.modules.jackpot30.spi.support.FixFactory;
     1.8  import org.netbeans.spi.editor.hints.ErrorDescription;
     1.9  import org.netbeans.spi.editor.hints.ErrorDescriptionFactory;
    1.10  import org.netbeans.spi.editor.hints.Fix;
    1.11 @@ -559,8 +560,22 @@
    1.12                  if (hed.fixDescriptions.isEmpty()) {
    1.13                      //XXX: @SuppressWarnings!
    1.14                      ErrorDescription ed = hed.acceptor.accept(hed.ctx);
    1.15 +                    List<String> swKeys = new ArrayList<String>();
    1.16  
    1.17 -                    ed = ErrorDescriptionFactory.createErrorDescription(ed.getSeverity(), ed.getDescription(), hed.createdFixes, ed.getFile(), ed.getRange().getBegin().getOffset(), ed.getRange().getEnd().getOffset());
    1.18 +                    for (String key : hed.hd.getSuppressWarnings()) {
    1.19 +                        if (key == null) break;
    1.20 +                        swKeys.add(key);
    1.21 +                    }
    1.22 +
    1.23 +                    List<Fix> fixes = new ArrayList<Fix>();
    1.24 +
    1.25 +                    fixes.addAll(hed.createdFixes);
    1.26 +
    1.27 +                    if (!swKeys.isEmpty()) {
    1.28 +                        fixes.addAll(FixFactory.createSuppressWarnings(info, hed.ctx.getPath(), swKeys.toArray(new String[0])));
    1.29 +                    }
    1.30 +
    1.31 +                    ed = ErrorDescriptionFactory.createErrorDescription(ed.getSeverity(), ed.getDescription(), fixes, ed.getFile(), ed.getRange().getBegin().getOffset(), ed.getRange().getEnd().getOffset());
    1.32  
    1.33                      if (ed != null) {
    1.34                          merge(errors, hed.hd, ed);