Microsoft KB Archive/194770

= PRB: Visual J++ 6.0 Code Generator Can Generate Ambiguous Names =

Article ID: 194770

Article Last Modified on 8/25/2005

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition

-



This article was previously published under Q194770



SYMPTOMS
When compiling code from the code generator and wizards in a Windows Foundation Classes (WFC) application, one of the following errors may occur:

Class 'class' doesn't have a method that matches 'method' (J0078)

-or-

Class 'class' doesn't have a constructor that matches 'class' (J0082) 'field' is not a field in class 'class' (J0234)



CAUSE
The following import statements are made by the wizards and designer code generators:   import com.ms.wfc.app.*; import com.ms.wfc.core.*; import com.ms.wfc.ui.*; import com.ms.wfc.html.*; These imports can cause name collisions if your application defines classes in different packages with the same name as those in the WFC packages.



RESOLUTION
If you must import a package that has class names that conflict with the above import statements, you must make sure all of your code uses the fully qualified class names. If you define a class in the default package that conflicts with the above import statements, you must also make sure all of your code uses the fully qualified class names. This includes changing code that was generated by the wizards and Form Designer, for example changing "new Point(300,300)" to "new com.ms.wfc.ui.Point(300,300)".



STATUS
This behavior is by design.



MORE INFORMATION
In some cases the Form Designer's code generator will generate code that you will need to fully qualify. If the section of code requiring editing is gray (read-only), you must first close the Form Designer window before making your changes to the Java file. Warning: making future changes in the Form Designer might change your code back to non-fully qualified names.

Steps to Reproduce Behavior
 From the File menu, select New Project. Click the New tab. Select Applications Folder under Visual J++ Projects. Select the Windows Application icon. Click Open.</li> From the Project menu, select Add Class.</li> Change the name field to Point.java.</li> Click Open.</li> From the Build menu, select Rebuild. You will get the following errors listed in the Task-List:

Class 'Control' doesn't have a method that matches 'setSize(Point)' (J0078)

Class 'Point' doesn't have a constructor that matches 'Point(int,int)' (J0082)

</li>  To workaround the errors, double-click one of the above errors and change the statement from this.setSize (new Point(300,300)); to: this.setSize (new com.ms.wfc.ui.Point(300,300)); </li></ol>

<div class="references_section">