Why does the idl2java pre-processor option not seem to work?

From Support
Jump to: navigation, search

Question:

The idl2java pre-processor option

  -C                       Retain comments in output

does not work. The exact same code is generated whether it is used or not.

Answer:

The -C option is a preprocessor option only.  You can see that it is
working properly by using -preprocess_only.  This prevents the
preprocessor from stripping out comments.  The back end code generation
decides what to do with these comments.

Currently the idl2java code generation back end will pass only javadoc
style comments through.

So given this IDL:

// Bank.idl

/** My comment */

module Bank {
  interface Account {
    float balance();
  };
/** Another comment */

  interface AccountManager {
    Account open(in string name);
  };
};

You can see that -C passes comments to the back end by examining the
output from  "idl2java -preprocess_only -C Bank.idl"

If you run "idl2java -C Bank.idl" you should see the javadoc style
comments in the generated code.

There is no equivalent feature in idl2cpp because due to teh IDL/C++ language mapping it is unlear where the generated comments should be placed.
 



Article originally contributed by