Message5682

Author bpedman
Recipients bpedman
Date 2010-04-12.15:50:46
SpamBayes Score 5.85698e-13
Marked as misclassified No
Message-id <1271087446.99.0.604439559192.issue1596@psf.upfronthosting.co.za>
In-reply-to
Content
When I get a SynchronizedCallable object back from looking up an attribute on an object it does not report that it is callable. This makes it hard to determine whether the object is just a regular attribute or a method or something else. (In my case I really just need to detect that it is callable). This occurs by calling object.isCallable() and any SynchronizedCallable will return false even though it should be callable.

The reason this happens is because the actual object that would report that it is callable is stored as an attribute on the object. To fix this there are a couple of options, both include creating a method in the SynchronizedCallable class:

1.) Just return true since it is a callable

public boolean isCallable(){
    return true;
}

2) check the isCallable() function on the callable object
public boolean isCallable(){
    return callable.isCallable();
}

I think option 2 is more safe but I don't know what leads up to the creation of a SynchronizedCallable or if there is any verification that happens to make sure the callable object is callable, so it could just be by virtue of it being a SynchronizedCallable that it is in fact callable.
History
Date User Action Args
2010-04-12 15:50:47bpedmansetrecipients: + bpedman
2010-04-12 15:50:46bpedmansetmessageid: <1271087446.99.0.604439559192.issue1596@psf.upfronthosting.co.za>
2010-04-12 15:50:46bpedmanlinkissue1596 messages
2010-04-12 15:50:46bpedmancreate