[kaffe] CVS kaffe-extras (kaz): Added kaffe-extras/patches/kjc-string-concat-to-null.diff.

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Tue Nov 25 08:37:02 2003


PatchSet 20 
Date: 2003/11/25 16:36:19
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
Added kaffe-extras/patches/kjc-string-concat-to-null.diff.
When the left of += is null, it should be treated as if it had
the value "null".

Members: 
	patches/kjc-string-concat-to-null.diff:INITIAL->1.1 

===================================================================
Checking out kaffe-extras/patches/kjc-string-concat-to-null.diff
RCS:  /home/cvs/kaffe/kaffe-extras/patches/kjc-string-concat-to-null.diff,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe-extras/patches/kjc-string-concat-to-null.diff	Tue Nov 25 16:36:20 2003
@@ -0,0 +1,16 @@
+--- kopi-2.1B/src/kjc/JCompoundAssignmentExpression.java.orig	Tue Jul 16 03:53:32 2002
++++ kopi-2.1B/src/kjc/JCompoundAssignmentExpression.java	Wed Nov 26 00:47:18 2003
+@@ -239,6 +239,13 @@
+ 
+     if (oper == OPE_PLUS && type.equals(factory.createReferenceType(TypeFactory.RFT_STRING))) {
+       //      left.genCode(context, false);
++      /* Isn't it stupid to call String.valueOf(String) ?
++       * But we must do this because it may be null.
++       */
++      code.plantMethodRefInstruction(opc_invokestatic,
++			       "java/lang/String",
++			       "valueOf",
++			       "(Ljava/lang/Object;)Ljava/lang/String;");
+       right.genCode(context, false);
+       if (!right.getType(factory).isReference()) {
+ 	code.plantMethodRefInstruction(opc_invokestatic,