Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How can i change modifier from private to public? AST? Preprocessor? Java6 Processor?

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 <eric.bodden@xxxxxxxxxxxxxx>:

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 <aspectj-users@xxxxxxxxxxxxx> 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 (timomeinen@xxxxxxxxx)
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users






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

E-Mail: volare@xxxxxxxxxxxxx
Web: http://www.TimoMeinen.de
ICQ: 10201138
AIM: TimoLiebtEffi
Jab: timomeinen@xxxxxxxxxx
Google: timomeinen@xxxxxxxxxxxxxx

Auf dem Rücken musst du Drücken!


Back to the top