# Java IDL: IDL to Java Language Mapping

This release of the JavaTM 2 Platform, Standard Edition, v.1.3, includes `idlj`, a compiler that reads an Object Management Group (OMG) Interface Definition Language (IDL) file and translates it, or maps it, to a Java interface. The `idlj` compiler also creates stub, skeleton, helper, holder, and other files as necessary. These `.java` files are generated from the IDL file according to the mapping specified in the OMG document (pdf format) OMG IDL to Java Language Mapping Specification, formal, 99-07-53. The postscript version of this specification can be found at http://www.omg.org/technology/documents/formal/omg_idl_to_java_language_mapping.htm. Formal specification 99-07-53 of the IDL to Java language mapping is aligned with CORBA version 2.3. For a basic summary of the IDL to Java mapping, see IDL to Java Language Mapping Overview below.

Some topics from the OMG IDL to Java Language Mapping specification that are not easily summarized are:

- Section 1.19, Mapping Pseudo-Objects to Java
- Section 1.20, Server-Side Mapping
- Section 1.21, Java ORB Portability Interfaces

## IDL to Java Language Mapping Overview

CORBA objects are defined in OMG IDL (Object Management Group Interface Definition Language). J2SE v1.3 includes `idlj`, the IDL-to-Java compiler that maps the IDL-defined interfaces to Java classes and interfaces.

This overview shows the correspondence between OMG IDL constructs and Java constructs. Note that OMG IDL, as its name implies, defines interfaces. Like Java interfaces, IDL interfaces contain no implementations for their operations (methods in Java). In other words, IDL interfaces define only the signature for an operation (the name of the operation, the data type of its return value, the data types of the parameters that it takes, and any exceptions that it raises). The implementations for these operations need to be supplied in Java classes written by a Java programmer.

The following table lists the main constructs of IDL and the corresponding constructs in Java.

IDL Construct | Java Construct
--- | ---
module | package
interface (non-abstract) | signature interface and an operations interface, helper class, holder class
interface (abstract) | signature interface, helper class, holder class
constant (not within an interface) | public interface
boolean | boolean
char, wchar | char
octet | byte
string, wstring | java.lang.String
short, unsigned short | short
long, unsigned long | int
long long, unsigned long long | long
float | float
double | double
fixed | java.math.BigDecimal
enum, struct, union | class
sequence, array | array
exception | class
readonly attribute | accessor method
readwrite attribute | accessor and modifer methods
operation | method

Note: When a CORBA operation takes a type that corresponds to a Java object type (a `String`, for example), it is illegal to pass a Java `null` as the parameter value. Instead, pass an empty version of the designated object type (for example, an empty `String` or an empty array). A Java `null` can be passed as a parameter only when the type of the parameter is a CORBA object reference or value type, in which case the `null` is interpreted as a `nil` CORBA object reference.

Home

Copyright © 1995-98 Sun Microsystems, Inc. All Rights Reserved.