The information in this article applies to:
SYMPTOMSThe Java Language Compiler (jvc) incorrectly compiles code that violates field visibility rules according to the Java specification. If a sub- classed object (S) is derived from a base class (B) in another package that has a protected member variable (ld) and class S tries to access a member via a qualified name of Q.ld, access is permitted only if Q is S or a subclass of S. If Q is the base class of S, then access should not be permitted and an error should be generated. JVC compiles code that violates this field visibility rule without generating any warnings or errors. STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual J++ 1.1. MORE INFORMATIONSteps to Reproduce ProblemThe following sample code demonstrates an example where the qualified name Q.ld has Q being a superclass of S, instead of a subclass. According to the Sun specification 6.6.2, the expression a.myProtectedVariable is not valid since it is defined in another package with protected field visibility:
REFERENCESFor the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following pages on the Microsoft Technical Support site: http://support.microsoft.com/support/visualj/ Additional query words:
Keywords : kbCommandLine kbVJ100bug kbVJ110fix |
Last Reviewed: November 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |