44 * http://sourceforge.net/projects/drjava/ or http://www.drjava.org/
55 *
66 * DrJava Open Source License
7- *
7+ *
88 * Copyright (C) 2001-2003 JavaPLT group at Rice University (javaplt@rice.edu)
99 * All rights reserved.
1010 *
1111 * Developed by: Java Programming Languages Team
1212 * Rice University
1313 * http://www.cs.rice.edu/~javaplt/
14- *
15- * Permission is hereby granted, free of charge, to any person obtaining a
14+ *
15+ * Permission is hereby granted, free of charge, to any person obtaining a
1616 * copy of this software and associated documentation files (the "Software"),
17- * to deal with the Software without restriction, including without
18- * limitation the rights to use, copy, modify, merge, publish, distribute,
19- * sublicense, and/or sell copies of the Software, and to permit persons to
20- * whom the Software is furnished to do so, subject to the following
17+ * to deal with the Software without restriction, including without
18+ * limitation the rights to use, copy, modify, merge, publish, distribute,
19+ * sublicense, and/or sell copies of the Software, and to permit persons to
20+ * whom the Software is furnished to do so, subject to the following
2121 * conditions:
22- *
23- * - Redistributions of source code must retain the above copyright
22+ *
23+ * - Redistributions of source code must retain the above copyright
2424 * notice, this list of conditions and the following disclaimers.
25- * - Redistributions in binary form must reproduce the above copyright
25+ * - Redistributions in binary form must reproduce the above copyright
2626 * notice, this list of conditions and the following disclaimers in the
2727 * documentation and/or other materials provided with the distribution.
2828 * - Neither the names of DrJava, the JavaPLT, Rice University, nor the
3232 * use the term "DrJava" as part of their names without prior written
3333 * permission from the JavaPLT group. For permission, write to
3434 * javaplt@rice.edu.
35- *
36- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
39- * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
40- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
41- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35+ *
36+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
39+ * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
40+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
41+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4242 * OTHER DEALINGS WITH THE SOFTWARE.
43- *
43+ *
4444END_COPYRIGHT_BLOCK*/
4545
4646package koala .dynamicjava .interpreter ;
6969 */
7070
7171public class TypeChecker14 extends AbstractTypeChecker {
72-
72+
7373 /**
7474 * Creates a new name visitor
7575 * @param ctx the context
@@ -83,18 +83,18 @@ public TypeChecker14(Context ctx) {
8383 * @param node the node to visit
8484 */
8585 public Class <?> visit (ForEachStatement node ){
86- throw new WrongVersionException ("ForEach Statements are only supported in Java 1.5 or better " );
86+ throw new WrongVersionException ("ForEach Statements are only supported in Java 1.5 or higher " );
8787 }
8888
8989 /**
9090 * Checks if the node is of GenericReference Type, which is only allowed in 1.5 or better
9191 * @param node the node being checked
92- */
92+ */
9393 protected void checkGenericReferenceType (ReferenceType node ) {
9494 if (node instanceof GenericReferenceType )
9595 throw new WrongVersionException ("Generics are not supported before Java 1.5" );
9696 }
97-
97+
9898 /**
9999 * Checks to see if the MethodDeclaration has variable arguments, which are only allowed in 1.5 or better
100100 * Note: the checkVarArgs here may or may not actually work. The test case in Distinction1415 failed when tiger features
@@ -104,28 +104,28 @@ protected void checkGenericReferenceType(ReferenceType node) {
104104 */
105105 protected void checkVarArgs (MethodDeclaration node ) {
106106 if (node .isVarArgs ())
107- throw new WrongVersionException ("Methods with variable arguments are only allowed in Java 1.5 or better " );
107+ throw new WrongVersionException ("Methods with variable arguments are only allowed in Java 1.5 or higher " );
108108 }
109-
109+
110110 /**
111111 * Visits a static import statement and throws an exception
112112 * @param node the ImportDeclaration node being checked
113113 */
114114 protected void staticImportHandler (ImportDeclaration node ){
115115 throw new WrongVersionException ("Static Import is not supported before Java 1.5" );
116116 }
117-
118-
117+
118+
119119 /**
120120 * Boxing is not allowed prior to version 1.5. Throws an exception.
121121 * @param exp the expression to box
122122 * @param refType the reference type to box the primitive type to
123123 * @return the <code>SimpleAllocation</code> that boxes the expression
124124 */
125125 protected SimpleAllocation _box (Expression exp , Class <?> refType ) {
126- throw new WrongVersionException ("Box required to use " + refType + " here. Autoboxing requires minimum Java 1.5" );
126+ throw new WrongVersionException ("Box required to use " + refType + " here. Autoboxing requires Java 1.5 or higher " );
127127 }
128-
128+
129129 /**
130130 * Unboxes the given expression by returning the correct
131131 * <code>ObjectMethodCall</code> corresponding to the given type
@@ -134,6 +134,6 @@ protected SimpleAllocation _box(Expression exp, Class<?> refType) {
134134 * @return The <code>ObjectMethodCall</code> that unboxes the expression
135135 */
136136 protected ObjectMethodCall _unbox (Expression child , Class <?> type ) {
137- throw new WrongVersionException ("Unbox required to use " + type + " here. Auto-unboxing requires minimum Java 1.5" );
137+ throw new WrongVersionException ("Unbox required to use " + type + " here. Auto-unboxing requires Java 1.5 or higher " );
138138 }
139139}
0 commit comments