![]() |
By default, only those interfaces, structs, and so on, that are defined in the IDL file on the command line have the Java bindings generated for them. The types defined in included files are not generated. For example, assume the following two IDL files:
My.idl #include MyOther.idl interface My { }; MyOther.idl interface MyOther { };The following command will only generate bindings for types within My:
idlj My.idlTo generate bindings for all of the types in My.idl and all of the types in files that My.idl includes (in this example, MyOther.idl), use the following command:
idlj -emitAll My.idlThere is a caveat to the default rule. #include statements which appear at the global scope are treated as described. These #include statements can be thought of as import statements. #include statements which appear within some enclosing scope are treated as true #include statements, meaning that the code within the included file is treated as if it appeared in the original file and, therefore, Java bindings are emitted for it. Here is an example:
My.idl #include MyOther.idl interface My { #include Embedded.idl }; MyOther.idl interface MyOther { }; Embedded.idl enum E {one, two, three};Running the following command:
idlj My.idlwill generate the following list of Java files:
./MyHolder.java ./MyHelper.java ./_MyStub.java ./MyPackage ./MyPackage/EHolder.java ./MyPackage/EHelper.java ./MyPackage/E.java ./My.javaNotice that MyOther.java was not generated because it is defined in an import-like #include. But E.java was generated because it was defined in a true #include. Notice also that because Embedded.idl was included within the scope of the interface My it appears within the scope of My (that is, in MyPackage).
If the -emitAll flag were used in the previous example, all types in all included files would be emitted.