KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > types > SemanticException


1 package polyglot.types;
2
3 import polyglot.util.Position;
4 import polyglot.main.Report;
5 import java.util.*;
6
7 /**
8  * Thrown during any number of phases of the compiler during which a semantic
9  * error may be detected.
10  */

11 public class SemanticException extends Exception JavaDoc {
12     protected Position position;
13     
14     public SemanticException() {
15         super();
16         trace(this, 5);
17     }
18
19     public SemanticException(Throwable JavaDoc cause) {
20         super(cause);
21         trace(this, 5);
22     }
23
24     public SemanticException(Position position) {
25     super();
26     this.position = position;
27         trace(this, 5);
28     }
29
30     public SemanticException(String JavaDoc m) {
31         super(m);
32         trace(this, 5);
33     }
34
35     public SemanticException(String JavaDoc m, Throwable JavaDoc cause) {
36         super(m, cause);
37         trace(this, 5);
38     }
39
40     public SemanticException(String JavaDoc m, Position position) {
41     super(m);
42     this.position = position;
43         trace(this, 5);
44     }
45
46     public Position position() {
47     return position;
48     }
49
50     static void trace(Exception JavaDoc e, int level) {
51         if (Report.should_report(Report.errors, level)) {
52             e.printStackTrace();
53         }
54     }
55 }
56
Popular Tags