Good news: with patches for HARMONY-677, I was able to run 1.5 classes on DRLVM + classlib built with target=1.5.
But, I had some fun with the default javac (tried Sun jdk1.5.0_06 and jrockit-jdk1.5.0-windows-ia32), which outwits itself in optimizing String concatenations. At first I got puzzled with this error message: --------------------------- java/lang/IllegalAccessError : from java/security/Security$1 to java/lang/AbstractStringBuilder at java.security.AccessController.doPrivilegedImpl (: -1) at java.security.AccessController.doPrivileged (: -1) at java.security.Security.<clinit> (Security.java: 57) at org.apache.harmony.security.fortress.PolicyUtils$SecurityPropertyAccessor.run (PolicyUtils.java: 148) at org.apache.harmony.security.fortress.PolicyUtils$SecurityPropertyAccessor.run (PolicyUtils.java: 127) at java.security.AccessController.doPrivilegedImpl (: -1) at java.security.AccessController.doPrivileged (: -1) at java.security.Policy.getDefaultProvider (Policy.java: 139) at java.security.Policy.getAccessiblePolicy (Policy.java: 190) at java.security.Policy.getPolicy (Policy.java: 131) at java.lang.ClassLoader.<clinit> (: -1) at java.lang.Thread.<init> (: -1) at java.lang.Thread.<init> (: -1) ---------------------------- Indeed, looking at the bytecode of j.s.Security$1: --------------------- 10: invokespecial #4; //Method java/lang/StringBuilder."<init>":()V 13: ldc #5; //String java.home 15: invokestatic #6; //Method java/lang/System.getProperty:(Ljava/lang/String;)Ljava/lang/String; 18: invokevirtual #7; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; < cut off several append() > 49: ldc #11; //String java.security 51: invokevirtual #7; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 54: invokevirtual #12; //Method java/lang/AbstractStringBuilder.toString:()Ljava/lang/String; ---------------------- How do you like the last instruction operand? %) After some analysis, I figured that the reason was j.l.StringBuilder extending j.l.AbstractStringBuilder without explicitly overriding toString(). Interestingly, I tried to reproduce this bug manually, but in vain... Eclipse's ecj was smarter (or just less eager :)) and produced correct bytecode. Neverthless, I guess we have to workaround this in j.l.StringBuilder. Index: modules/luni/src/main/java/java/lang/StringBuilder.java ============================================================ --- modules/luni/src/main/java/java/lang/StringBuilder.java (revision 417667 ) +++ modules/luni/src/main/java/java/lang/StringBuilder.java (working copy) @@ -733,4 +733,8 @@ out.writeInt(length()); out.writeObject(getValue()); } + + public String toString() { + return super.toString(); + } } --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]