Skip to content

Commit f8d559e

Browse files
author
dyrby76
committed
All features except VariableArguments now works in the InteractionsPane when you are using the Jsr14 v.2.4 compiler. I have not found out why it creates the mismatching arguments when you try to use varargs when the jsr14 is enabled. It should not be any different than using java 1.5. We translate the varargs into an arraytype. For now, due to the release coming up, I have put in a check for it in TypeChecker15, to give the user a message that VarArgs is currently not supported in anything else than java 1.5 or higher. This check will be removed when I have located the problem.
git-svn-id: file:///tmp/test-svn/trunk@3065 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent d13e11e commit f8d559e

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

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-20050413-0716;
56+
* This javadoc corresponds to build drjava-20050421-1237;
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 = "20050413-0716";
65+
private static final String BUILD_TIME_STRING = "20050421-1237";
6666

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ protected void checkGenericReferenceType(ReferenceType node) {
103103
* @param node - the MethodDeclaration which may or may not contain variable arguments
104104
*/
105105
protected void checkVarArgs(MethodDeclaration node) {
106+
if(true){
107+
throw new RuntimeException("What the hell!!!");
108+
}
106109
if(node.isVarArgs())
107110
throw new WrongVersionException("Methods with variable arguments are only allowed in Java 1.5 or higher");
108111
}

dynamicjava/src/koala/dynamicjava/interpreter/TypeChecker15.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,18 @@ protected void checkGenericReferenceType(ReferenceType node) {
139139

140140
/**
141141
* Does nothing - Variable Arguments are allowed in 1.5
142+
* Variable Arguments are currently Not working with jsr14 in the interactionspane
143+
* This check here can be deleted when this is fixed.
144+
* This is temporarily included to ensure decent feedback to the users of our new beta.
142145
* @param node - unused
143146
*/
144147
protected void checkVarArgs(MethodDeclaration node) {
145-
148+
try {
149+
java.lang.reflect.Method.class.getMethod("isVarArgs", new Class<?>[]{});
150+
}
151+
catch (Throwable t) {
152+
throw new WrongVersionException("Variable Arguments are currently only supported in the InteractionsPane for Java Version 1.5 or better.");
153+
}
146154
}
147155

148156
/**

dynamicjava/src/koala/dynamicjava/util/TigerUtilities.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ public static void resetVersion() {
110110
try {
111111
//Class.forName("java.lang.Enum");
112112
// Class.forName("com.sun.javadoc.ParameterizedType");
113-
114-
java.lang.reflect.Method.class.getMethod("isVarArgs", new Class<?>[]{});
113+
Integer.valueOf(5); //This method only exists in jsr14 and java 1.5+ isVarArgs doesnt
114+
//java.lang.reflect.Method.class.getMethod("isVarArgs", new Class<?>[]{});
115115
_tigerEnabled = true;
116116
}
117117
catch (Throwable t) {
@@ -174,7 +174,7 @@ public static boolean isVarArgs(Constructor c) {
174174
* @return boolean that is true if tiger is enabled and <code>c.isEnum()</code>
175175
*/
176176
public static boolean isEnum(Class<?> c) {
177-
System.out.println("enabled: "+_tigerEnabled+", "+c+".super: "+c.getSuperclass());
177+
// System.out.println("enabled: "+_tigerEnabled+", "+c+".super: "+c.getSuperclass());
178178
return _tigerEnabled && c.getSuperclass()!=null && (c.getSuperclass().getName().equals("java.lang.Enum"));
179179

180180
// The following is what it should be. The reason why this commented is that

0 commit comments

Comments
 (0)