Update of /cvsroot/nice/Nice/src/bossa/syntax
In directory sc8-pr-cvs1:/tmp/cvs-serv2394/F:/nice/src/bossa/syntax
Modified Files:
NewExp.java RetypedJavaMethod.java
Log Message:
improved some error messages related to retyping of java types.
Index: NewExp.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/NewExp.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** NewExp.java 12 Jun 2003 21:04:40 -0000 1.35
--- NewExp.java 23 Jun 2003 17:49:01 -0000 1.36
***************
*** 64,68 ****
LinkedList constructors = TypeConstructors.getConstructors(tc);
if (constructors == null)
! User.error(this, "Class " + tc + " has no constructor");
// the list of constructors must be cloned, as
--- 64,74 ----
LinkedList constructors = TypeConstructors.getConstructors(tc);
if (constructors == null)
! {
! if (tc.arity() > 0)
! User.error(this, "Class " + tc + " has no constructor with the correct number of " +
! tc.arity() + " type parameters.\nA retyping is needed to use this constructor.");
! else
! User.error(this, "Class " + tc + " has no constructor");
! }
// the list of constructors must be cloned, as
Index: RetypedJavaMethod.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/syntax/RetypedJavaMethod.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RetypedJavaMethod.java 23 Jun 2003 16:15:21 -0000 1.4
--- RetypedJavaMethod.java 23 Jun 2003 17:49:01 -0000 1.5
***************
*** 136,146 ****
((ClassType) holder).getDeclaredMethod (methodName, javaArgType);
! if(reflectMethod == null)
! User.error(className,
! (methodName.equals("<init>")
! ? "Constructor"
! : "Method " + methodName) +
! " was not found in class " + holder.getName());
// use the following, or the Type.flushTypeChanges() in SpecialTypes
//reflectMethod.arg_types = javaArgType;
--- 136,162 ----
((ClassType) holder).getDeclaredMethod (methodName, javaArgType);
! if (reflectMethod == null)
! {
! try {
! reflectMethod =
! ((ClassType) holder).getDeclaredMethod (methodName,
! javaArgType.length);
! } catch (Error e) {
! User.error(this, "The types of the arguments don't exactly match any of the declarations");
! }
! if (reflectMethod == null)
! {
! if (methodName.equals("<init>"))
! User.error(className, "class " + holder.getName() + " has no constructor with " + javaArgType.length + " arguments");
! else
! User.error(className, "No method named " + methodName + " with " +
! javaArgType.length +" arguments was not found in class " +
! holder.getName());
! }
+ User.error(className, "The types of the arguments don't match the declaration:\n"
+ + reflectMethod);
+
+ }
// use the following, or the Type.flushTypeChanges() in SpecialTypes
//reflectMethod.arg_types = javaArgType;
|