C
Chris Uppal
Here's something that I've just noticed: Try this on a 1.5 Java:
=============
import java.lang.reflect.Method;
public class Test
{
public static void
main(String[] args)
{
Class sbc = java.lang.StringBuilder.class;
for (Method method : sbc.getDeclaredMethods())
{
if (method.getName().equals("append")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == char.class)
{
System.out.println(method);
System.out.println("\tbridge: " + method.isBridge());
System.out.println("\tsynthetic: " + method.isSynthetic());
}
}
}
}
=============
Which produces:
=============
public java.lang.StringBuilder java.lang.StringBuilder.append(char)
bridge: false
synthetic: false
public volatile java.lang.Appendable java.lang.StringBuilder.append(char)
throws java.io.IOException
bridge: true
synthetic: true
public volatile java.lang.AbstractStringBuilder
java.lang.StringBuilder.append(char)
bridge: true
synthetic: true
=============
<grining>
Two volatile methods!
<grinning/>
I looks as if Sun are using the same bit to mark these bridge methods as is
used for volatile fields (ACC_VOLATILE == 0x0040). Does anyone know for sure ?
I had been under the impression that they were using a 'Bridge' attribute to
mark those methods.
-- chris
=============
import java.lang.reflect.Method;
public class Test
{
public static void
main(String[] args)
{
Class sbc = java.lang.StringBuilder.class;
for (Method method : sbc.getDeclaredMethods())
{
if (method.getName().equals("append")
&& method.getParameterTypes().length == 1
&& method.getParameterTypes()[0] == char.class)
{
System.out.println(method);
System.out.println("\tbridge: " + method.isBridge());
System.out.println("\tsynthetic: " + method.isSynthetic());
}
}
}
}
=============
Which produces:
=============
public java.lang.StringBuilder java.lang.StringBuilder.append(char)
bridge: false
synthetic: false
public volatile java.lang.Appendable java.lang.StringBuilder.append(char)
throws java.io.IOException
bridge: true
synthetic: true
public volatile java.lang.AbstractStringBuilder
java.lang.StringBuilder.append(char)
bridge: true
synthetic: true
=============
<grining>
Two volatile methods!
<grinning/>
I looks as if Sun are using the same bit to mark these bridge methods as is
used for volatile fields (ACC_VOLATILE == 0x0040). Does anyone know for sure ?
I had been under the impression that they were using a 'Bridge' attribute to
mark those methods.
-- chris