Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] A little pointcut help please

Well, that might help, but answering the question in the first message
of this thread will do nicely for now:

At the line commented with GENERALIZE ME, I'd like to replace a
hard-coded type expression with one that effectively means "not within
the package of the thing (field, method, constructor or class)
annotated with @ProtectedInternal".

public aspect ProtectedInternalDeclareError {
       declare error :
               (!within(org.foo.model.*)) // GENERALIZE ME
                       && (set(@ProtectedInternal * *)
                               || get(@ProtectedInternal * *)
                               || call(@ProtectedInternal * *(..))
                               || call(* (@ProtectedInternal *..*).*(..))
                               || call(@ProtectedInternal *.new(..))
                               || call((@ProtectedInternal *).new(..))
               )
               : "The target constructor, method, or field is not designed for
public consumption; access is disallowed.";
}

I just realized that there's a bug in my pointcut -- I'm not
supporting the prevention of accessing any fields whose class is
annotated with @ProtectedInternal.  How would I add that one, too?

Thanks,
Matthew

On Sat, Oct 10, 2009 at 8:05 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
> Hi Matthew,
>
> I don't know how much control you have over the code you are trying to
> enforce API usage on, but OSGi + Eclipse's API tooling might be a help
> here:
> http://wiki.eclipse.org/ApiTools_Architecture
>
> Essentially, the API tooling allows you to add JavaDoc tags (yes,
> Eclipse internals are still using 1.4, so no annotations) that
> describe how other plugins can consume classes in the current plugin.
> Eg- @noreference, @noimplement, @noextend, etc.
>
> On Sat, Oct 10, 2009 at 7:19 AM, Matthew Adams <matthew@xxxxxxxxxxxxxxx> wrote:
>> BTW, now that I think about it, even in OSGi, I'm not sure this solves
>> my problem, because OSGi bundles export packages, not individual
>> classes or methods, and my problem exists at the method visibility
>> level across several classes within the package.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



-- 
mailto:matthew@xxxxxxxxxxxxxxx
skype:matthewadams12
yahoo:matthewadams
aol:matthewadams12
google-talk:matthewadams12@xxxxxxxxx
msn:matthew@xxxxxxxxxxxxxxx
http://matthewadams.me
http://www.linkedin.com/in/matthewadams


Back to the top