You might even consider "the simplest thing that could possibly work"; preprocess the source file with a Perl script to change the "private" to "public", then compile the output file with javac. Would that be sufficient?

On Feb 18, 2008, at 9:48 AM, Timo Meinen wrote:

Hi Eric,

thank you for the hint. I will have a look at it. It might be a good idea using an "own" Java compiler. Although, I wanted to learn AOP and the access control seemed to be a nice playground. :-)

Timo

Am 18.02.2008, 16:38 Uhr, schrieb Eric Bodden <[EMAIL PROTECTED] >:

Hi, Timo.

Just one question: Why are you using AspectJ for this? IMHO it would
be way easier to use an open Java compiler (e.g. JastAdd) and alter
its type checker.

Eric

On 18/02/2008, Timo Meinen <[EMAIL PROTECTED]> wrote:
Hi,

I am writing my master's thesis and using AspectJ for a special access control enforcement due to the thesis' challenge. I want to loosen the access control of the 'private' modifier. For example it is possible to realize a friendship-concept of classes. My problem is, that objects shall have access to private-fields and -methods, but then, the compiler won't compile. My solution is to preprocess these private modifiers and convert them into public. The correct access control enforcement is done by an
aspect.

@AccessControl
private int foo;

shall be converted to

@AccessControl
public int foo;

After this covnersion, the appropriate aspects should work on the
annotated, public fields and methods.

The affected modifiers are identified by an annotation. At the moment I am using a Java-6 processor and modify the abstract syntax tree (AST), which is on the one hand complex and on the other not AspectJ compatible (I
think).

How can I solve this problem with AspectJ?

Some ideas/questions:
1) Is AspectJ able to process annotations with an Javac-6-Processor?
2) Can AspectJ change the access modifier before compilation?
3) Is it possible that AspectJ converts private to public "on the fly" before compiling? It is important, that the original source file isn't
modificated.
4) Can I modify the AST of the AspectJ-Compiler? Is there a API available? 5) Do I have to use a preprocessor? Does anyone know a preprocessor with this annotation capabilities? I wasn't able to get it to work with APT.
But I would love to have a all-in-one-AspectJ-solution.

Thank you very much for your ideas.

Timo Meinen ([EMAIL PROTECTED])
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users






--
Wodanstr. 7c - 45891 Gelsenkirchen
0209 - 177 433 12
0170 - 288 0110

E-Mail: [EMAIL PROTECTED]
Web: http://www.TimoMeinen.de
ICQ: 10201138
AIM: TimoLiebtEffi
Jab: [EMAIL PROTECTED]
Google: [EMAIL PROTECTED]

Auf dem Rücken musst du Drücken!
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Dean Wampler, Ph.D.
dean at objectmentor.com
http://www.objectmentor.com
See also:
http://www.aspectprogramming.com  AOP advocacy site
http://aquarium.rubyforge.org     AOP for Ruby
http://www.contract4j.org         Design by Contract for Java5



_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to