R
Roedy Green
I have an Applet that works fine in earlier JDKs but is failing in
1.6.
Code like this
public class StartsWithBug
{
/**
* test startsWith optimisation bug
*
* @param args a string possibly starting with snippets/
*/
public static void main ( String[] args )
{
//
String urlString = args[0];
System.out.println( urlString );
if ( !urlString.startsWith( "snippets/" ) )
{
urlString = "snippets/" + urlString;
}
System.out.println( urlString );
}
}
is failling to prepend the "snippets/" string.
Of coruse it works fine in this isolated snippet. I gather the hotspot
optimiser screws it up in some contexts.
1.6.
Code like this
public class StartsWithBug
{
/**
* test startsWith optimisation bug
*
* @param args a string possibly starting with snippets/
*/
public static void main ( String[] args )
{
//
String urlString = args[0];
System.out.println( urlString );
if ( !urlString.startsWith( "snippets/" ) )
{
urlString = "snippets/" + urlString;
}
System.out.println( urlString );
}
}
is failling to prepend the "snippets/" string.
Of coruse it works fine in this isolated snippet. I gather the hotspot
optimiser screws it up in some contexts.