Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] identifying whether class is public/private

AspectJ doesn't currently directly support modifiers in type patterns
(which is what you would need to most naturally express this). We have
an enhancement request open to add such a capability post 1.5.0.

So you'd like to say something like:

declare warning : staticinitialization(!public org.xyz..*) : "this
type must be declared public";

but you can't say that yet.

using the if() pcd you can express this as a runtime check, but that's
the best we can do at the moment:

before() : staticinitialization(org.xyz..*) &&
if(!Modifier.isPublic(thisJoinPointStaticPart.getSignature().getModifiers())
{
   // issue runtime warning (IllegalStateException ???)
}

Regards, Adrian.

On 09/09/05, hina shah <hina.shah@xxxxxxxxx> wrote:
> Hi,
> I want to declare a warning for all the classes in a particular package if
> they are not declared public.
> As I am new to this, I don't know whether there is any way to check for
> access modifiers at package level.
> 
> I know that we have joinpoints for method calls, class initialization etc
> ... But I was interested in knowing if there is a way where we can have
> checks at package level.
> 
> Thanks in advance.
> Regards,
> Hina.
> 
> 
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
> 
> This e-mail message may contain proprietary, confidential or legally
> privileged information for the sole use of the person or entity to
> whom this message was originally addressed. Any review, e-transmission
> dissemination or other use of or taking of any action in reliance upon
> this information by persons or entities other than the intended
> recipient is prohibited. If you have received this e-mail in error
> kindly delete  this e-mail from your records. If it appears that this
> mail has been forwarded to you without proper authority, please notify
> us immediately at netadmin@xxxxxxxxx and delete this mail.
> _____________________________________________________________________
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 
> 


-- 
-- Adrian
adrian.colyer@xxxxxxxxx


Back to the top