[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] test package names
|
Ah, you're right. When I run my tests as a normal JUnit test it works fine
but I get an IllegalAccessError when running as a plugin test.
That's unfortunate, I wonder if there's an option to change this behavior.
It can be very useful to allow tests to have access to package-private
members.
Mike Kucera
Software Developer
IBM CDT Team, Toronto
mkucera@xxxxxxxxxx
"Schorn, Markus"
<Markus.Schorn@wi
ndriver.com> To
Sent by: "CDT General developers list."
cdt-dev-bounces@e <cdt-dev@xxxxxxxxxxx>
clipse.org cc
Subject
12/19/2007 03:30 RE: [cdt-dev] test package names
AM
Please respond to
"CDT General
developers list."
<cdt-dev@eclipse.
org>
Mike,
This works only partially. If you run such a test as JUnit Plugin Test,
as
we do with the nightly builds, the classloader of the plugin will
prevent
the access. I.e. packages with the same name in different plugins are
treated
as something different.
Markus.
-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mike Kucera
Sent: Wednesday, December 19, 2007 12:47 AM
To: CDT General developers list.
Subject: [cdt-dev] test package names
Importance: Low
Hi Everyone,
I was just porting a bunch of tests from the C99 preprocessor to the new
CPreprocessor when I realized that maybe the package structure of the
test plugins could be improved. The problem I ran into is that I had a
test that I wanted to apply to the expression evaluator but couldn't
because that class is package-private for the new preprocessor.
There's a common practice that allows tests to have access to
package-private members while still living in a separate directory or
plug-in. Its possible for more than one plug-in to have a package with
the same name and the cool thing is that Java considers them to be
logically the same package. This means that the tests for a package can
actually live in that package, but in a separate source tree.
Its important to limit the visibility of classes when appropriate, so
for example ExpressionEvaluator should stay package-private. And putting
the tests in the same package allows one to write more tests which is
also very good.
Its probably too much work to change the package structure in the test
plugins at this point. I'm just mentioning this because it might be
something useful to keep in mind going forward. Thoughts?
Mike Kucera
Software Developer
IBM CDT Team, Toronto
mkucera@xxxxxxxxxx
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev