-
Bug
-
Resolution: Duplicate
-
P5
-
None
-
1.0.2, 1.1, 1.1.1
-
sparc
-
solaris_2.4, solaris_2.6
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 method from another class.
> javac -d . exec00502.java
> javac -d . exec00502a.java
> java -verify javasoft.sqe.tests.lang.exec005.exec00502.exec00502
failed
--------------------------exec00502------------------------------
package javasoft.sqe.tests.lang.exec005.exec00502;
import java.io.PrintStream;
public class exec00502 extends exec00502a {
public static void main(String argv[])
{
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
try {
prc (6);
}
catch (Error e) {
out.println ("er2 " + e);
return 0;
}
out.println ("failed");
return 2;
}
}
class exec00502a {
int a = 5;
static int prc (int i) {
return i;
}
}
-----------------------------------------------------------------
--------------------------exec00502a-----------------------------
package javasoft.sqe.tests.lang.exec005.exec00502;
public class exec00502a {
int a = 5;
private static int prc (int i) {
return i;
}
}
-----------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4007892 Using private field from another class.
-
- Closed
-
-
JDK-4018532 no runtime check of accessibility of an invoked method
-
- Closed
-
-
JDK-4066506 the VM disables certain access checks for locally loaded classes.
-
- Closed
-