< prev index next >

test/langtools/lib/combo/tools/javac/combo/Diagnostics.java

Print this page

 67     }
 68 
 69     public List<Diagnostic<?>> getAllDiags() {
 70         return diags.stream().map(d -> (Diagnostic<?>)d).collect(toList());
 71     }
 72 
 73     /** Do the diagnostics contain the specified error key? */
 74     public boolean containsErrorKey(String key) {
 75         return diags.stream()
 76                     .filter(d -> d.getKind() == Diagnostic.Kind.ERROR)
 77                     .anyMatch(d -> d.getCode().equals(key));
 78     }
 79 
 80     /** Do the diagnostics contain the specified warning key? */
 81     public boolean containsWarningKey(String key) {
 82         return diags.stream()
 83                     .filter(d -> d.getKind() == Diagnostic.Kind.WARNING || d.getKind() == Diagnostic.Kind.MANDATORY_WARNING)
 84                     .anyMatch(d -> d.getCode().equals(key));
 85     }
 86 






 87     /** Get the error keys */
 88     public List<String> errorKeys() {
 89         return diags.stream()
 90                     .filter(d -> d.getKind() == Diagnostic.Kind.ERROR)
 91                     .map(Diagnostic::getCode)
 92                     .collect(toList());
 93     }
 94 
 95     public String toString() { return keys().toString(); }
 96 
 97     /** Clear all diagnostic state */
 98     public void reset() {
 99         diags.clear();
100     }
101 }

 67     }
 68 
 69     public List<Diagnostic<?>> getAllDiags() {
 70         return diags.stream().map(d -> (Diagnostic<?>)d).collect(toList());
 71     }
 72 
 73     /** Do the diagnostics contain the specified error key? */
 74     public boolean containsErrorKey(String key) {
 75         return diags.stream()
 76                     .filter(d -> d.getKind() == Diagnostic.Kind.ERROR)
 77                     .anyMatch(d -> d.getCode().equals(key));
 78     }
 79 
 80     /** Do the diagnostics contain the specified warning key? */
 81     public boolean containsWarningKey(String key) {
 82         return diags.stream()
 83                     .filter(d -> d.getKind() == Diagnostic.Kind.WARNING || d.getKind() == Diagnostic.Kind.MANDATORY_WARNING)
 84                     .anyMatch(d -> d.getCode().equals(key));
 85     }
 86 
 87     public boolean containsWarningKey(String key, int numberOfWarnings) {
 88         return diags.stream()
 89                 .filter(d -> d.getKind() == Diagnostic.Kind.WARNING || d.getKind() == Diagnostic.Kind.MANDATORY_WARNING)
 90                 .filter(d -> d.getCode().equals(key)).count() == numberOfWarnings;
 91     }
 92 
 93     /** Get the error keys */
 94     public List<String> errorKeys() {
 95         return diags.stream()
 96                     .filter(d -> d.getKind() == Diagnostic.Kind.ERROR)
 97                     .map(Diagnostic::getCode)
 98                     .collect(toList());
 99     }
100 
101     public String toString() { return keys().toString(); }
102 
103     /** Clear all diagnostic state */
104     public void reset() {
105         diags.clear();
106     }
107 }
< prev index next >