Daniel John Debrunner wrote:
Before changing the access, it should be determined why that method is
being called directly from user code in JDK6.
In a JDK 6 environment I assume that the code should be using a
BrokeredStatement40. If user code is calling the
BrokeredStatement.isClosed() method then that indicates that instead a
BrokeredStatement object is being used, that would be a bug.
Below is the user code that invokes the exception. Once I make the
change that BrokeredStatement.isClosed() is public then the program runs
normally and calls
BrokeredStatement40.isClosed()
import org.apache.derby.jdbc.EmbeddedXADataSource40;
import java.sql.*;
import javax.sql.*;
public class AbstractAccessError {
public static void main(String[] args) throws Exception {
EmbeddedXADataSource40 ds = new EmbeddedXADataSource40();
ds.setDatabaseName("wombat");
ds.setCreateDatabase("create");
XAConnection xaConn = ds.getXAConnection();
Connection conn = xaConn.getConnection();
Statement stmt = conn.createStatement();
System.out.println("stmt.isClosed():" + stmt.isClosed());
}
}
Without access change output:
The following program gives:
Exception in thread "main" java.lang.IllegalAccessError
at
AbstractAccessError.main(AbstractAccessError.java:13)
With access change output:
[C:/kmarsden/repro/brokclosed] java AbstractAccessError
stmt.isClosed():false
I am not sure why the jvm is accessing the parent class's method during
runtime, is that a JVM bug that it does?
Kathey