|
null string concatenation: msg#00161java.vm.kaffe.general
Hi, With reference to the bug: http://www.kaffe.org/pipermail/kaffe/2003-November/044458.html I suggest the following patch: --- kopi-2.1B/src/kjc/JCompoundAssignmentExpression.java 2002-07-16 03:53:32.000000000 +0900 +++ test/JCompoundAssignmentExpression.java 2003-11-25 19:26:58.000000000 +0900 @@ -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, By the way, the bytecode which JCompoundAssignmentExpression.java generates looks quite different from the bytecode produced by gcj or Sun's javac. The former uses String.concat and the latter uses StringBuffer for string concatenation. Which is better?
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Kaffe for Debain on IA-64, Balaji Iyengar |
|---|---|
| Next by Date: | Re: null string concatenation, Dalibor Topic |
| Previous by Thread: | Kaffe for Debain on IA-64, Balaji Iyengar |
| Next by Thread: | Re: null string concatenation, Arnaud Vandyck |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |