Home : MIDL2021 duplicate id when use MIDL compile java2com generated IDL
Q183231 - ERRMSG: MIDL2021 duplicate id when use MIDL compile java2com generated IDL

MIDL2021 Duplicate ID when use MIDL compile java2com generated IDL

You may get the following error when use midl.exe compile idl file generated by J-Integra java2com tool.

These midl error occur because of nested classes/interfaces. Notice that, in this case, java.io.PrintWriter extends java.io.Writer which in turn implements java.lang.Appendable. Therefore, the java2com tool generates an interface for each of java.io.PrintWriter, java.io.Writer, and java.lang.Appendable. 

Because the COM IDL language does not know anything about Java inheritance, it generates 3 append method signatures for JavaLangAppendable, 6 append method signatures for JavaIoWriter, and 9 append method signatures for JavaIoPrintWriter. However, because of the Java inheritance involved, it ends up giving the same method id to the same append method signatures.

To resolve these errors, you need to use the Name Mappings option to tell java2com not to generate IDL definitions for the append() methods in java.io.Writer, and java.lang.Appendable:

  1. Run the java2com (gui) tool.
  2. Click Settings > Name Mappings.
  3. On the left-hand side, click java > io > PrintWriter (its methods will appear to the right).
  4. On the right-hand side, deselect the checkboxes beside the last 6 append methods.
  5. Save settings and regenerate the proxies.

For more informaiton about J-Integra java2com tool, please refer to online documentation:
http://j-integra.intrinsyc.com/support/com/doc/#tools/java2com.html

Please also refer this documentation for using java2com in Early Binding:
http://j-integra.intrinsyc.com/support/com/doc/#javafromcom/index.html#java2com

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
Using java2com in Early Binding
java2com Tool User Guide
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 11/3/2006.
Last Modified on 11/3/2006.
Last Modified by J-Integra KB Admin.
Article has been viewed 11910 times.
Rated 5 out of 10 based on 12 votes.
Print Article
Email Article