Example of append(StringBuffer)
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:57:02 +0200
changeset 138473cf6bb7084
parent 137 a6ae66ce006d
child 139 9a3dc528afa5
Example of append(StringBuffer)
samples/incompatibilities/src-wildimport/org/apidesign/stringandbuffer/AppendStringBuffer.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/incompatibilities/src-wildimport/org/apidesign/stringandbuffer/AppendStringBuffer.java	Sat Jun 14 09:57:02 2008 +0200
     1.3 @@ -0,0 +1,15 @@
     1.4 +package org.apidesign.stringandbuffer;
     1.5 +
     1.6 +/** This code compiles on 1.3 as well as 1.4. However, if compiled on
     1.7 + * 1.4, it will throw <code>NoSuchMethodError</code> when executed on
     1.8 + * 1.3. How is that possible?
     1.9 + */
    1.10 +public class AppendStringBuffer {
    1.11 +    static {
    1.12 +        // BEGIN: theory.appendstringbuffer
    1.13 +        StringBuffer sb = new StringBuffer();
    1.14 +        StringBuffer another = new StringBuffer();
    1.15 +        sb.append(another);
    1.16 +        // END: theory.appendstringbuffer
    1.17 +    }
    1.18 +}