Danger Will Robinson! Missing API!

John Rose john.r.rose at oracle.com
Thu May 26 01:16:40 PDT 2011


On May 25, 2011, at 11:04 PM, Charles Oliver Nutter wrote:

> I don't say it's not clever. It's just not something anyone is
> typically going to figure out on their own. There will be constant
> questions "if I can invalidate a SwitchPoint, why can't I ask if it
> has been invalidated?"

You are right about the questions.  That's one of the first things to annoy me about an API:  mutators w/o queries.

We omitted it because it's not a very trustworthy query.  But it's easy to add.

Here's possible javadoc:

    /**
     * Determines if this switchpoint is still valid.
     * <p>
     * Since invalidation is a global and immediate operation,
     * this query must be sequenced with any
     * other threads that could invalidate this switchpoint.
     * It may therefore be expensive.
     * <p>
     * In addition, due to concurrent invalidations by other threads,
     * a switchpoint may report itself as valid, and yet become
     * invalid before the querying thread begins to act on the
     * supposed validity.
     * @return true if this switchpoint has never been invalidated
     */
    public boolean isValid() {...}



More information about the mlvm-dev mailing list