Fwd: metacomments and aspectj - need suggestion

View: New views
10 Messages — Rating Filter:   Alert me  

Parent Message unknown Fwd: metacomments and aspectj - need suggestion

by Sergey Staroletov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello. I'm doing my first step research in AspectJ because I am thinking that one feature in it will help me in my big research project. I want to try to extend aspectj language to process my  special  comments (non-java doc, just single-line or multi-line user comments) in java files with aspectj weaving. In my idea It will be as:
 
in aj file (added new word 'comment')

pointcut point(String s) : comment(s);

long before(String s) : point(s) {

System.out.println(s) ;

}

 

in java file

System.out.println("start") ;

//comment here

System.out.println("stop") ;

 

and sample result

 

start

comment here

stop

I am thinking that instruction to process comment will be inserting between code line before comment and code line after comment

It is possible to realize by myself and where can i find the develper documentation? (And what shall I do to patch existing code (I've downloaded AJT source to my Eclipse, built and tried to debug this - but I'm lost my way) ?




--
С уважением, Старолетов Сергей

_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Andrew Eisenberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

The ajc compiler was not designed to be extensible by end users.  Its
focus has is efficiency and stability.  However, the AspectBench
compiler is designed for extensibility and for testing out new ideas.
This might be more suitable to your purposes.

http://abc.comlab.ox.ac.uk/introduction

2009/10/22 Sergey Staroletov <sergey.staroletov@...>:

> Hello. I'm doing my first step research in AspectJ because I am thinking
> that one feature in it will help me in my big research project. I want to
> try to extend aspectj language to process my  special  comments (non-java
> doc, just single-line or multi-line user comments) in java files with
> aspectj weaving. In my idea It will be as:
>
> in aj file (added new word 'comment')
>
> pointcut point(String s) : comment(s);
>
> long before(String s) : point(s) {
>
> System.out.println(s) ;
>
> }
>
>
>
> in java file
>
> System.out.println("start") ;
>
> //comment here
>
> System.out.println("stop") ;
>
>
>
> and sample result
>
>
>
> start
>
> comment here
>
> stop
>
> I am thinking that instruction to process comment will be inserting between
> code line before comment and code line after comment
>
> It is possible to realize by myself and where can i find the develper
> documentation? (And what shall I do to patch existing code (I've downloaded
> AJT source to my Eclipse, built and tried to debug this - but I'm lost my
> way) ?
>
>
> --
> С уважением, Старолетов Сергей
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Parent Message unknown Fwd: Fwd: metacomments and aspectj - need suggestion

by Eric Bodden-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sergev/Andrew and others.

I think what you are trying to do would be possible with abc (the
AspectBench Compiler), however, it may be overkill. A simple parser
should do, actually. Both ajc and abc are designed to implement
joinpoints that are dynamic, i.e. execute at runtime of the program.
What Sergev is trying to do is matching purely static entities
(comments) and actually printing them *at compile time*. This does not
have much to do with AOP. I would suggest to use a simple SableCC or
JavaCC parser. You could use a simple visitor to print the comments.

Another alternative could even be to use awk, grep and/or sed.

Eric

--
Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



2009/10/22 Andrew Eisenberg <andrew@...>:

> Hi there,
>
> The ajc compiler was not designed to be extensible by end users.  Its
> focus has is efficiency and stability.  However, the AspectBench
> compiler is designed for extensibility and for testing out new ideas.
> This might be more suitable to your purposes.
>
> http://abc.comlab.ox.ac.uk/introduction
>
> 2009/10/22 Sergey Staroletov <sergey.staroletov@...>:
>> Hello. I'm doing my first step research in AspectJ because I am thinking
>> that one feature in it will help me in my big research project. I want to
>> try to extend aspectj language to process my  special  comments (non-java
>> doc, just single-line or multi-line user comments) in java files with
>> aspectj weaving. In my idea It will be as:
>>
>> in aj file (added new word 'comment')
>>
>> pointcut point(String s) : comment(s);
>>
>> long before(String s) : point(s) {
>>
>> System.out.println(s) ;
>>
>> }
>>
>>
>>
>> in java file
>>
>> System.out.println("start") ;
>>
>> //comment here
>>
>> System.out.println("stop") ;
>>
>>
>>
>> and sample result
>>
>>
>>
>> start
>>
>> comment here
>>
>> stop
>>
>> I am thinking that instruction to process comment will be inserting between
>> code line before comment and code line after comment
>>
>> It is possible to realize by myself and where can i find the develper
>> documentation? (And what shall I do to patch existing code (I've downloaded
>> AJT source to my Eclipse, built and tried to debug this - but I'm lost my
>> way) ?
>>
>>
>> --
>> С уважением, Старолетов Сергей
>>
>> _______________________________________________
>> aspectj-dev mailing list
>> aspectj-dev@...
>> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>>
>>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Ichthyostega :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sergey Staroletov schrieb:
> ...I want to try to extend aspectj language to process my  special  comments
> (non-java doc, just single-line or multi-line user comments) in java files
> with aspectj weaving.

Hi Sergey,

asking just out of curiosity: would it be possible to use annotations?
After annotations where added to the java language, I always thought
there would be never again the need for "magic" tokens hidden in comments.
But I may be wrong, and thus I'm curious what could prevent you from
building on a set of special annotations?

Hermann V.


_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Sergey Staroletov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you, I will read about it

23 октября 2009 г. 4:12 пользователь Andrew Eisenberg <andrew@...> написал:
Hi there,

The ajc compiler was not designed to be extensible by end users.  Its
focus has is efficiency and stability.  However, the AspectBench
compiler is designed for extensibility and for testing out new ideas.
This might be more suitable to your purposes.

http://abc.comlab.ox.ac.uk/introduction

2009/10/22 Sergey Staroletov <sergey.staroletov@...>:
> Hello. I'm doing my first step research in AspectJ because I am thinking
> that one feature in it will help me in my big research project. I want to
> try to extend aspectj language to process my  special  comments (non-java
> doc, just single-line or multi-line user comments) in java files with
> aspectj weaving. In my idea It will be as:
>
> in aj file (added new word 'comment')
>
> pointcut point(String s) : comment(s);
>

> long before(String s) : point(s) {
>
> System.out.println(s) ;
>
> }
>
>
>
> in java file
>
> System.out.println("start") ;
>
> //comment here
>

> System.out.println("stop") ;
>
>
>
> and sample result
>
>
>
> start
>
> comment here
>
> stop
>
> I am thinking that instruction to process comment will be inserting between
> code line before comment and code line after comment
>
> It is possible to realize by myself and where can i find the develper
> documentation? (And what shall I do to patch existing code (I've downloaded
> AJT source to my Eclipse, built and tried to debug this - but I'm lost my
> way) ?
>
>
> --
> С уважением, Старолетов Сергей
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev



--
С уважением, Старолетов Сергей

_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Sergey Staroletov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello
as I know, annotations is only for methods, isn't it?

2009/10/23 Ichthyostega <prg@...>
Sergey Staroletov schrieb:
> ...I want to try to extend aspectj language to process my  special  comments
> (non-java doc, just single-line or multi-line user comments) in java files
> with aspectj weaving.

Hi Sergey,

asking just out of curiosity: would it be possible to use annotations?
After annotations where added to the java language, I always thought
there would be never again the need for "magic" tokens hidden in comments.
But I may be wrong, and thus I'm curious what could prevent you from
building on a set of special annotations?

Hermann V.


_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev



--
С уважением, Старолетов Сергей

_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Sergey Staroletov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!
yes, comments is static. but I deal with not only printing(it was only example), may be it will be a seriuos code to processing comments depend on it's meaning.

2009/10/23 Eric Bodden <eric.bodden@...>
Hi Sergev/Andrew and others.

I think what you are trying to do would be possible with abc (the
AspectBench Compiler), however, it may be overkill. A simple parser
should do, actually. Both ajc and abc are designed to implement
joinpoints that are dynamic, i.e. execute at runtime of the program.
What Sergev is trying to do is matching purely static entities
(comments) and actually printing them *at compile time*. This does not
have much to do with AOP. I would suggest to use a simple SableCC or
JavaCC parser. You could use a simple visitor to print the comments.

Another alternative could even be to use awk, grep and/or sed.

Eric

--
Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



2009/10/22 Andrew Eisenberg <andrew@...>:
> Hi there,
>
> The ajc compiler was not designed to be extensible by end users.  Its
> focus has is efficiency and stability.  However, the AspectBench
> compiler is designed for extensibility and for testing out new ideas.
> This might be more suitable to your purposes.
>
> http://abc.comlab.ox.ac.uk/introduction
>
> 2009/10/22 Sergey Staroletov <sergey.staroletov@...>:
>> Hello. I'm doing my first step research in AspectJ because I am thinking
>> that one feature in it will help me in my big research project. I want to
>> try to extend aspectj language to process my  special  comments (non-java
>> doc, just single-line or multi-line user comments) in java files with
>> aspectj weaving. In my idea It will be as:
>>
>> in aj file (added new word 'comment')
>>
>> pointcut point(String s) : comment(s);
>>

>> long before(String s) : point(s) {
>>
>> System.out.println(s) ;
>>
>> }
>>
>>
>>
>> in java file
>>
>> System.out.println("start") ;
>>

>> //comment here
>>
>> System.out.println("stop") ;
>>
>>
>>
>> and sample result
>>
>>
>>
>> start
>>
>> comment here
>>
>> stop
>>
>> I am thinking that instruction to process comment will be inserting between
>> code line before comment and code line after comment
>>
>> It is possible to realize by myself and where can i find the develper
>> documentation? (And what shall I do to patch existing code (I've downloaded
>> AJT source to my Eclipse, built and tried to debug this - but I'm lost my
>> way) ?
>>
>>
>> --
>> С уважением, Старолетов Сергей
>>
>> _______________________________________________
>> aspectj-dev mailing list
>> aspectj-dev@...
>> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>>
>>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@...
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>
_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev



--
С уважением, Старолетов Сергей

_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Ichthyostega :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 2009/10/23 Ichthyostega <prg@... <mailto:prg@...>>
> But I may be wrong, and thus I'm curious what could prevent you from building
> on a set of special annotations?

Sergey Staroletov schrieb:
> as I know, annotations is only for methods, isn't it?
...of course (and besides that, for classes and parameters too).
But that doesn't answer my question, just makes it more clear.

What prevents you from building the feature you're after on
method level, and thus use the facilities of the language
(including AspectJ, which is very good on working with
annotations btw)?

I'm asking, as said, because I'm puzzled about the use case, where
going down to single statement level with any cross-cutting mechanism
might be of benefit?

I could imagine performance measurements, but micro-optimising single
lines to my experience always created maintenance problems later on

I could imagine security or transactional behaviour, but would you
really rely on such a fragile construct as a comment is for such
mission critical concerns? The same argument holds for reasoning
about correctness, pre- and post conditions.


You see, probably you're looking after a use case which is quite
different of the common situations, and that's what makes me
curious... ;-)

Greetings,
Hermann V.


_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Sergey Staroletov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Hermann
 
I am doing my research in software testing on various levers of abstraction. I'm know about maintenance problems but my work relies on 'code is model'. I think I can provide dinamic testing of peices of marked code by realize this aspectJ extension.
ps. It is only the research.

2009/10/24 Ichthyostega <prg@...>
> 2009/10/23 Ichthyostega <prg@... <mailto:prg@...>>
> But I may be wrong, and thus I'm curious what could prevent you from building
> on a set of special annotations?

Sergey Staroletov schrieb:
> as I know, annotations is only for methods, isn't it?
...of course (and besides that, for classes and parameters too).
But that doesn't answer my question, just makes it more clear.

What prevents you from building the feature you're after on
method level, and thus use the facilities of the language
(including AspectJ, which is very good on working with
annotations btw)?

I'm asking, as said, because I'm puzzled about the use case, where
going down to single statement level with any cross-cutting mechanism
might be of benefit?

I could imagine performance measurements, but micro-optimising single
lines to my experience always created maintenance problems later on

I could imagine security or transactional behaviour, but would you
really rely on such a fragile construct as a comment is for such
mission critical concerns? The same argument holds for reasoning
about correctness, pre- and post conditions.


You see, probably you're looking after a use case which is quite
different of the common situations, and that's what makes me
curious... ;-)

Greetings,
Hermann V.


_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev



--
С уважением, Старолетов Сергей

_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

Re: Fwd: metacomments and aspectj - need suggestion

by Ichthyostega :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sergey Staroletov schrieb:
> I am doing my research in software testing on various levers of abstraction.
...
> I think I can provide dinamic testing of pieces of marked code by realize
> this aspectJ extension.

Hello Sergey,

thanks for the clarification.... interesting idea! so for example
in a unit test you could verify something specific "happens" in an
marked area within the implementation of the feature to be tested?

Anyway, best wishes for your project!
Hermann


_______________________________________________
aspectj-dev mailing list
aspectj-dev@...
https://dev.eclipse.org/mailman/listinfo/aspectj-dev