I2JAV 1.2 NO IDEA Avatar
  1. OMG Issue

I2JAV12 — is_a support in Java for local interfaces

  • Key: I2JAV12-16
  • Legacy Issue Number: 4699
  • Status: closed  
  • Source: Oracle ( Ken Cavanaugh)
  • Summary:

    With the recent adoption of the resolution to issue 4623 (support
    is_a on local interfaces), we need to answer the question of how
    is_a is implemented in Java. I would like to create a new
    Java RTF issue for this, and propose a solution to hopefully start
    some discussion on this issue.

    Proposed solution:

    Change org.omg.CORBA.LocalObject to an abstract class as follows:

    abstract public class LocalObject implements org.omg.CORBA.Object {

    ...

    abstract public String[] _ids() ;

    public _is_a( String repository_id)
    {
    String[] ids = _ids() ;
    for (int i=0; i<ids.length; i++)

    { if (repository_id.equals( ids[i] ) return true ; }

    return false ;
    }
    }

    Then the IDL compiler generates a local implementation base class as follows:

    class <typename>LocalBase extends org.omg.CORBA.LocalObject
    implements <typename> {

    private String[] _type_ids() =

    { ... }

    public String[] _ids()

    { return _type_ids.clone() ; }

    }

    where _type_ids contains a list of repository IDs of the local
    interface and all of its superinterfaces in order from most derived
    to org.omg.CORBA.Object.

    The implementer of a local interface then simply writes

    class MyImpl extends <typename>LocalBase

    { // implement the declared methods }

    and instantiates the local interface by calling

    new MyImpl( ... ).

    Note: a full proposed resolution to this issue should include a static
    delegate for LocalObject, so that the implementation of _is_a and any
    other non-trivial methods can be made pluggable in the JDK. I will raise
    another issue for get_interface_def after we have an issue number for
    this issue.

  • Reported: I2JAV 1.1 — Mon, 12 Nov 2001 05:00 GMT
  • Disposition: Resolved — I2JAV 1.2
  • Disposition Summary:

    Incorporate the revised text, make corresponding changes in the standard source files, close

  • Updated: Fri, 6 Mar 2015 20:58 GMT