minor fix
[cdsspec-compiler.git] / src / edu / uci / eecs / specExtraction / WrongAnnotationException.java
1 package edu.uci.eecs.specExtraction;
2
3 import java.io.File;
4
5 /**
6  * <p>
7  * This class is the main error processing exception in processing the
8  * annotations.
9  * </p>
10  * 
11  * @author Peizhao Ou
12  * 
13  */
14 public class WrongAnnotationException extends Exception {
15         /**
16          * 
17          */
18         private static final long serialVersionUID = 1L;
19
20         public WrongAnnotationException(String msg) {
21                 super(msg);
22         }
23
24         /**
25          * <p>
26          * This is a utility function for more conveniently generating specification
27          * error exceptions. We help locate the error by the line number in the
28          * processing file, and an associated error message.
29          * </p>
30          * 
31          * @param file
32          *            The file that we see the error
33          * @param line
34          *            The associated line number of the error
35          * @param msg
36          *            The error message printout
37          * @throws WrongAnnotationException
38          */
39         public static void err(File file, int line, String msg)
40                         throws WrongAnnotationException {
41                 String errMsg = "Spec error in file \"" + file.getName() + "\", Line "
42                                 + line + " :\n\t" + msg + "\n";
43                 throw new WrongAnnotationException(errMsg);
44         }
45
46         /**
47          * <p>
48          * This is a utility function for more conveniently generating specification
49          * warning. We help locate the warning by the line number in the processing
50          * file, and an associated warning message.
51          * </p>
52          * 
53          * @param file
54          *            The file that we see the warning
55          * @param line
56          *            The associated line number of the warning
57          * @param msg
58          *            The warning message printout
59          * @throws WrongAnnotationException
60          */
61         public static void warning(File file, int line, String msg) {
62                 String errMsg = "Spec WARNING in file \"" + file.getName()
63                                 + "\", Line " + line + " :\n\t" + msg + "\n";
64                 System.out.println(errMsg);
65         }
66 }