I don't think that means what you think it does ... isAccessible only returns
true if you setAccessible, which tells the VM to skip VM security checks when
you call the method.
You might want Modifier.isPublic(method.getModifiers()) ?
ms
On Jan 4, 2011, at 11:58 AM, John Huss wrote:
> Does anyone know why this code doesn't print anything?
>
> import java.lang.reflect.Method;
>
> public class Main {
>
> public static void main(String[] args) {
> for (Method method : Main.class.getDeclaredMethods()) {
> if (method.isAccessible()) {
> System.out.println(method.getName());
> }
> }
> }
>
> }
>
> I would expect it to print "main" since there is one public method named
> "main" in class Main. Isn't that what isAccessible does?
>
> John
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]