1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jdo.impl.model.java;
18
19 import org.apache.jdo.model.java.JavaType;
20
21 /***
22 * An instance of class ErrorType represents an erroneous type. Components
23 * such as the semantic analysis may use this type to indicate an error
24 * situtaion. It is compatible to all other types.
25 *
26 * @author Michael Bouschen
27 * @since JDO 1.0.1
28 */
29 public class ErrorType
30 extends AbstractJavaType
31 {
32 /*** The singleton ErrorType instance. */
33 public static final ErrorType errorType = new ErrorType();
34
35 /***
36 * Creates new a ErrorType instance. This constructor should not be
37 * called directly; instead, the singleton instance {@link #errorType}
38 * should be used.
39 */
40 protected ErrorType() {}
41
42 /***
43 * Returns true if this JavaType is compatible with the specified
44 * JavaType. This implementation always returns <code>true</code>,
45 * because ErrorType is compatible with any other type.
46 * @param javaType the type this JavaType is checked with.
47 * @return <code>true</code> if this is compatible with the specified
48 * type; <code>false</code> otherwise.
49 */
50 public boolean isCompatibleWith(JavaType javaType)
51 {
52 return true;
53 }
54
55 /***
56 * Returns the name of the type.
57 * @return type name
58 */
59 public String getName()
60 {
61 return "<error type>";
62 }
63
64 }