Microsoft KB Archive/221948

= BUG: User-Defined Parameter Names Lost When Creating COM Objects =

Article ID: 221948

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Java Virtual Machine

-



This article was previously published under Q221948



SYMPTOMS
When creating a Java-implemented COM object with Visual J++ 6.0 or the Microsoft SDK for Java, the Microsoft virtual machine (Microsoft VM) creates a typelib where any user-define names that were used as parameters to methods are lost or renamed to Parameter0, Parameter1, and so forth.



CAUSE
This is a limitation in how the Microsoft VM creates TypeInfo.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 From the Visual J++ 6.0 File menu, click New Project. Select Components and create a default COM DLL (Project1). Open Class1.java.  Create a public method as follows:

public void demo (int MyInt)  Build the project. From the Project menu, click Add COM Wrapper.</li> Find the new COM object created (if default was used you will find "Project1").</li> Now view Class1.java within the wrapper class folder (project1) found in the Project Explorer window</li>  Find the "demo" method that looks like the following:

public native void demo(int Parameter0); </li> You will notice that MyInt gets renamed to Parameter0.</li></ol>

If you were to create a Visual Basic client for a Java-COM object whose methods have user-defined names for parameters, you will notice that its IntelliSense shows these arguments as Paramter0, Paramter1, and so forth.

Other ways to see this result is through the use of OLE View, which is installed with Visual J++ 6.0. By default a shortcut to OLE View can be found under Start.Programs.Microsoft Visual J++ 6.0.Microsoft Visual J++ 6.0 Tools.

<div class="references_section">