| 1 | /* |
| 2 | * Copyright 2007 The Closure Compiler Authors. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.google.javascript.jscomp; |
| 18 | |
| 19 | import com.google.javascript.jscomp.CheckLevel; |
| 20 | |
| 21 | /** |
| 22 | * The error manager is in charge of storing, organizing and displaying |
| 23 | * errors and warnings generated by the compiler. |
| 24 | * |
| 25 | */ |
| 26 | public interface ErrorManager extends ErrorHandler { |
| 27 | /** |
| 28 | * Reports an error. The errors will be displayed by the |
| 29 | * {@link #generateReport()} at the discretion of the implementation. |
| 30 | * |
| 31 | * @param level the reporting level |
| 32 | * @param error the error to report |
| 33 | */ |
| 34 | @Override |
| 35 | void report(CheckLevel level, JSError error); |
| 36 | |
| 37 | /** |
| 38 | * Writes a report to an implementation-specific medium. The compiler calls |
| 39 | * this method after any and all {@link #report} calls. |
| 40 | */ |
| 41 | void generateReport(); |
| 42 | |
| 43 | /** |
| 44 | * Gets the number of reported errors. |
| 45 | */ |
| 46 | int getErrorCount(); |
| 47 | |
| 48 | /** |
| 49 | * Gets the number of reported warnings. |
| 50 | */ |
| 51 | int getWarningCount(); |
| 52 | |
| 53 | /** |
| 54 | * Gets all the errors. |
| 55 | */ |
| 56 | JSError[] getErrors(); |
| 57 | |
| 58 | /** |
| 59 | * Gets all the warnings. |
| 60 | */ |
| 61 | JSError[] getWarnings(); |
| 62 | |
| 63 | /** |
| 64 | * Sets the percentage of typed expressions. |
| 65 | */ |
| 66 | void setTypedPercent(double typedPercent); |
| 67 | |
| 68 | /** |
| 69 | * Gets the percentage of typed expressions. |
| 70 | */ |
| 71 | double getTypedPercent(); |
| 72 | } |