c.s.tools.ide.analysis.modernize/test/unit/src/ide/analysis/modernize/ResponseImpl.java
author Ilia Gromov <ilia@netbeans.org>
Wed, 07 Jun 2017 20:23:29 +0300
branchrelease82
changeset 18423 b9d9af239a0c
parent 18403 ide.analysis.modernize/test/unit/src/ide/analysis/modernize/ResponseImpl.java@67d78b11d2e0
permissions -rw-r--r--
Fixing #270763 - Move clang-tidy integration to nb contrib
* * *
Fixing #270763 - Move clang-tidy integration to nb contrib - move wrapper
* * *
Fixing #270763 - Move clang-tidy integration to nb contrib - sign nbm
* * *
Fixing #270763 - Move clang-tidy integration to nb contrib - move tests
* * *
Fixing #270763 - Move clang-tidy integration to nb contrib - data for a new test
* * *
Fixed #270839 - [clang-tidy] Group checks in Editor hints
(transplanted from 35b6125ef00c470655dac6673075f5c12ec74593)
     1 /*
     2  * To change this license header, choose License Headers in Project Properties.
     3  * To change this template file, choose Tools | Templates
     4  * and open the template in the editor.
     5  */
     6 package ide.analysis.modernize;
     7 
     8 import com.sun.tools.ide.analysis.modernize.impl.ModernizeErrorInfo;
     9 import com.sun.tools.ide.analysis.modernize.impl.ModernizeFix;
    10 import com.sun.tools.ide.analysis.modernize.impl.YamlParser;
    11 import java.util.List;
    12 import junit.framework.TestCase;
    13 import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorInfo;
    14 import org.netbeans.modules.cnd.api.model.syntaxerr.CsmErrorProvider;
    15 import org.openide.util.Exceptions;
    16 
    17 /**
    18  *
    19  * @author Ilia Gromov
    20  */
    21 class ResponseImpl implements CsmErrorProvider.Response {
    22     
    23     private final List<ModernizeFix> fixes;
    24 
    25     public ResponseImpl(List<ModernizeFix> fixes) {
    26         this.fixes = fixes;
    27     }
    28 
    29     @Override
    30     public void addError(CsmErrorInfo info) {
    31         try {
    32             TestCase.assertTrue(info instanceof ModernizeErrorInfo);
    33             final List<YamlParser.Replacement> replacements = ((ModernizeErrorInfo) info).getDiagnostics().getReplacements();
    34             final String id = ((ModernizeErrorInfo) info).getId();
    35             ModernizeFix fix = new ModernizeFix(replacements, id);
    36             fixes.add(fix);
    37         } catch (Exception ex) {
    38             Exceptions.printStackTrace(ex);
    39         }
    40     }
    41 
    42     @Override
    43     public void done() {
    44     }
    45     
    46 }