Andrew John Hughes wrote:
This adds our new non-copying variant of StringBuilder, which
I've called CPStringBuffer. It should be used internally where
we can get away with a non-synchronized non-copying string buffer.
ChangeLog:
I missed the change log part but...
> +package gnu.classpath;
Can we make it package private to java.lang?
.
.
.
> + static
> + {
> + try
> + {
> + cons = String.class.getDeclaredConstructor(char[].class, Integer.TYPE,
> + Integer.TYPE, Boolean.TYPE);
> + }
That way we wouldn't have to use reflection. Which on most platforms
has very large overhead.
There could be some sort of VMCPStringBuffer Where the default
implementation used a package private String constructor that does no
synchronization or copying, but that could fall back to using a public
String constructor.
In general I like this, but having to use reflection to invoke the
string constructor I think should be avoided.
David Daney