Bug 99099 - Tests on protected methods fail
Tests on protected methods fail
Product: java
Classification: Unclassified
Component: JUnit
PC Windows XP
: P2 with 1 vote (vote)
Assigned To: Marian Petras
Depends on:
  Show dependency treegraph
Reported: 2007-03-27 11:46 UTC by ulfzibis
Modified: 2007-11-24 16:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT

Project tree (262.21 KB, application/octet-stream)
2007-03-27 11:52 UTC, ulfzibis

Note You need to log in before you can comment on or make changes to this bug.
Description ulfzibis 2007-03-27 11:46:03 UTC
See project files attached!

Test class sun.jdbc.odbc.JdbcOdbcDriver__Test was created by NetBeans tool, but
does not run because of error:

Testcase: testGetAttributeProperties(sun.jdbc.odbc.JdbcOdbcDriver__Test):	Caused
tried to access method
from class sun.jdbc.odbc.JdbcOdbcDriver__Test
java.lang.IllegalAccessError: tried to access method
from class sun.jdbc.odbc.JdbcOdbcDriver__Test
Comment 1 ulfzibis 2007-03-27 11:52:35 UTC
Created attachment 40020 [details]
Project tree
Comment 2 ulfzibis 2007-07-05 16:02:01 UTC
This issue also occurs on NB 6.0.
Comment 3 ulfzibis 2007-07-14 22:01:34 UTC
I've also submitted this issue to the JUnit project:


Please actuate them to find the fixing.
Comment 4 Marian Petras 2007-07-18 14:11:20 UTC
Calling protected methods from other classes within the same package works without problems in simple J2SE projects - I
tried that.

I looked at your project and noticed that you fiddle with classpaths and bootclasspaths quite a bit. I also found
information that two classes stored in packages of the same name, but loaded by different classloaders are not
considered as being from the same package (see http://access1.sun.com/techarticles/DR-article.html) which implies that
protected methods from one class are not accessible from the other class. I suspect your problem is caused by exactly
this. As a workaround, create a public method in the tested class (let's call it "xfinalize") which only calls the
finalize() method. From the test, call xfinalize() instead of finalize().

If you find that I am wrong, feel free to reopen the issue.
Comment 5 ulfzibis 2007-07-18 23:01:16 UTC

Thanx very much for your hints!

I've found out another tricky possibility (file project.properties):

What you think about it?
Comment 6 ulfzibis 2007-07-18 23:05:48 UTC
But ...
By this trick the ant script is not independent from the IDE.

Do you have an idea to avoid this?
Comment 7 ulfzibis 2007-07-19 00:31:31 UTC
Perhaps define properties like:
Comment 8 Marian Petras 2007-07-20 15:43:15 UTC
I am sorry, your concerns of the correct setup of classpaths do not justify reopening this bug report. Marked as INVALID
Comment 9 ulfzibis 2007-11-24 16:35:15 UTC
Verified with 6.0 RC2.

Enhancements copied to issue 122677.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo