langtools/src/share/classes/javax/tools/DiagnosticCollector.java
changeset 22165 ec53c8946fc2
parent 22163 3651128c74eb
child 25287 d2440361b323
equal deleted inserted replaced
22164:c8eb1ae29c58 22165:ec53c8946fc2
     1 /*
     1 /*
     2  * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    37  *
    37  *
    38  * @author Peter von der Ahé
    38  * @author Peter von der Ahé
    39  * @since 1.6
    39  * @since 1.6
    40  */
    40  */
    41 public final class DiagnosticCollector<S> implements DiagnosticListener<S> {
    41 public final class DiagnosticCollector<S> implements DiagnosticListener<S> {
    42     private List<Diagnostic<? extends S>> diagnostics = Collections.synchronizedList(new ArrayList<>());
    42     private List<Diagnostic<? extends S>> diagnostics =
       
    43             Collections.synchronizedList(new ArrayList<Diagnostic<? extends S>>());
    43 
    44 
    44     public void report(Diagnostic<? extends S> diagnostic) {
    45     public void report(Diagnostic<? extends S> diagnostic) {
    45         diagnostic.getClass(); // null check
    46         diagnostic.getClass(); // null check
    46         diagnostics.add(diagnostic);
    47         diagnostics.add(diagnostic);
    47     }
    48     }