Why would a method be made volatile? How does making a method volatile change the method's behavior?
Edit: I did a toString() on a Method object returned by a class object (Java Reflection). The return string had a volatile modifier against the method name along with public visibility and void return type. Research yielded only information on volatile for properties. This is why I asked this question.
The method declaration was:
public volatile org.osmdroid.api.IGeoPoint org.osmdroid.views.MapView.getMapCenter()
Code for the Reflection Method:
public static class Test {
public static void showMethods(Object target) {
Class<?> clazz = target.getClass();
for (Method method : clazz.getMethods()) {
if (method!=null) {
System.out.println(method.toString());
}
}
}
}
Method invocation:
Test.showMethods(mapView);