This code is valid. Both ctors and the setName method have default access which
means they can be called by other classes in the same package. The only thing
that's off limits is the private var.
So I agree and this is strange unless I'm missing something in the EJB
spec. Maybe
someone from Orion will comment.
Eric :-)
Gordon Tyler wrote:
I'm having a problem with Orion that I don't get with the Sun J2EE RI, regarding the use of package private members in one class by another class in the same package (i.e. com.x.y) but in different JARs or WARs.
Say that I have a value class in package com.x.y called One as part of an EJB JAR:
package com.x.y;
class One
{
private String name = null;void setName(String newName)
{
name = newName;
}
}And a class in the same package com.x.y called Two as part of a WAR:
package com.x.y;
class Two
{
public Two()
{
One one = new One();
one.setName("Foo");
}
}These two classes are packaged in their respective EJB JARs and WARs and deployed as an application.
In Orion, I get an IllegalAccessException on the "one.setName" line, however other classes in the same EJB JAR as class One don't the exception when the call setName.
The problem does not occur in the J2EE RI and I have not found anything in the EJB/J2EE spec that would prohibit this cross-JAR usage of package private members.
Any thoughts?
Thanks,
Gordon--- Codito, ergo sum - "I code, therefore I am" ---
Gordon Tyler <[EMAIL PROTECTED]>
Abraxas IT Services - Component Based Devleopment
Tel: +27-(0)21-6803412
PGP key available on request or finger [EMAIL PROTECTED]"Official IT Partner to the Two Oceans Marathon"
http://www.twooceansmarathon.org.za