Skip to content

Commit f8d50a7

Browse files
author
moez
committed
added small modification to varargs to make it more 1.3 compatible and avoid lack of support of isVarArgs() is some Java 1.5 betas
git-svn-id: file:///tmp/test-svn/trunk@2702 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent f4d62c7 commit f8d50a7

4 files changed

Lines changed: 93 additions & 93 deletions

File tree

dynamicjava/src/koala/Version.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* This file is copied to Version.java by the build process, which also
5454
* fills in the right values of the date and time.
5555
*
56-
* This javadoc corresponds to build drjava-20040831-2058;
56+
* This javadoc corresponds to build drjava-20040904-2117;
5757
*
5858
* @version $Id$
5959
*/
@@ -62,7 +62,7 @@ public abstract class Version {
6262
* This string will be automatically expanded upon "ant commit".
6363
* Do not edit it by hand!
6464
*/
65-
private static final String BUILD_TIME_STRING = "20040831-2058";
65+
private static final String BUILD_TIME_STRING = "20040904-2117";
6666

6767
/** A {@link Date} version of the build time. */
6868
private static final Date BUILD_TIME = _getBuildDate();

dynamicjava/src/koala/dynamicjava/interpreter/ClassInfoCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,7 @@ public Void visit(FieldDeclaration node) {
18321832
*/
18331833
public Void visit(MethodDeclaration node) {
18341834
if(node.isVarArgs())
1835-
TigerUtilities.assertTigerEnabled("Methods with variable arguments are only allowed in Java 1.5 or better");
1835+
TigerUtilities.assertTigerEnabled("Methods with variable arguments are only allowed in Java 1.5 or higher");
18361836
MethodInfo mi = classInfo.getMethod(node);
18371837
int af = mi.getModifiers();
18381838
String mn = node.getName();

dynamicjava/src/koala/dynamicjava/interpreter/TypeChecker14.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
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
@@ -32,15 +32,15 @@
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+
*
4444
END_COPYRIGHT_BLOCK*/
4545

4646
package koala.dynamicjava.interpreter;
@@ -69,7 +69,7 @@
6969
*/
7070

7171
public 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

Comments
 (0)