-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.0.2
-
sparc
-
solaris_2.4
Name: vsC45997 Date: 10/08/96
The section "12.3.3 Resolution of Symbolic References" of The Java Language
Specification contains the following:
"This error may be thrown at any point in the program that uses a symbolic reference to the type, directly or indirectly:
IllegalAccessError: A symbolic reference has been encountered that
specifies a use or assignment of a field, or invocation of a method,
or creation of an instance of a class, to which the code containing the
reference does not have access because the field or method was declared
private, protected, or default access (not public), or because the class
was not declared public. This can occur, for example, if a field that is
originally declared public is changed to be private after another class
that refers to the field has been compiled (§13.4.6)."
Verifier permits to use the private field from another class.
> javac -d . exec00501.java
> javac -d . exec00501a.java
> java -verify javasoft.sqe.tests.lang.exec005.exec00501.exec00501
failed
--------------------------exec00501------------------------------
package javasoft.sqe.tests.lang.exec005.exec00501;
import java.io.PrintStream;
public class exec00501 {
public static void main(String argv[])
{
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
exec00501a ncli;
try {
ncli = new exec00501a ();
}
catch (Exception e) {
out.println ("1 " + e);
return 0;
}
catch (Error e) {
out.println ("er1 " + e);
return 0;
}
try {
ncli.a = 6;
}
catch (Error e) {
out.println ("er2 " + e);
return 0;
}
out.println ("failed");
return 2;
}
}
class exec00501a {
int a = 5;
int prc (int i) {
return i;
}
}
-----------------------------------------------------------------
--------------------------exec00501a-----------------------------
package javasoft.sqe.tests.lang.exec005.exec00501;
class exec00501a {
private int a = 5;
}
-----------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4007893 Using private method from another class.
-
- Closed
-