Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] declare warning

Eyðun Nielsen wrote:

In special cases like:

void someMethod() {
    ...
    return;
    ... //unreachable code
}
of course, you can - and you do - get a compiler warning.
But, by declaring:
declare warning: !cflow(execution(void *.main(String[]))) : "Unreachable code";

I belive that Philip actually tries to do this in general on any program (as he could use the aspect on any java program) - and I belive that this is unsolvable. (But, please, correct me if I'm interpreting this wrong ;-) )

Try a googlesearch with +"unreachable code" +"unsolvable" : http://tinyurl.com/3y5pq

The first result I got from the search: http://www.cs.montana.edu/ross/previous-courses/510-fall-2000/Assignments/problem_5.13.html

Regards,
-eyðun

In general yes, but so are many analyses. If you restrict yourself to doing constant folding as specified in the java spec and no other analyses you can give a conservative approximation of the unreachable points of code.

Jeff

Jeffrey Palm wrote:

Eyðun Nielsen wrote:

The problem isn't so much in ajdt or aspectj, but in what you are trying to do:

"...i'm trying to give a warning for each joinpoint that isn't in the flow hierachy of my main method...."

This is an UNSOLVABLE PROBLEM - so no matter how, or with what tool/language, you try - it still can't be done.



It's certainly undecidable whether a certain joinpoint in a program will be reached. But, one could definitely compute places in the program that are unreachable. The latter seems to be what Philip is after. But, please, correct me if I'm interpreting this wrong.

Jeff

Regards,
-eyðun
Philip wrote:

I'm still convinsed that cflow could be implemented staticly but that doesn't mean that it should. Neither way it should generate a compiler error.

a bug ?

following fragment causes a ClassCastException aspectj compiler
declare warning:if(true):"Pigs can fly";

So i suspect that the static keywords aren't checked in the compiler of ajdt plugin (i've heared somewhere that it uses a beta version of aspectj)
eclipse: 2.1.2
ui: 0.6.4 tools: 1.1.4

Greetz,
Philip

Op dinsdag 24 februari 2004 17:00, schreef Eyðun Nielsen:
Just wondering... Halting problem? ;-)

----
From "Aspect-Oriented Programming with AspectJ" by Ivan Kiselev, page 199:
"...
Because there is no runtime context at the compile time, the statically determinable pointcuts must not be, and cannot be, expressed in terms of the following primitive pointcuts that depend on runtime information to
work.

this
target
args
cflow
cflowbelow
if

..."

Regards,
-eyðun

philipvanbogaert@xxxxxxxxxx wrote:
following code fragment doesn't seem's to work correctly,
i'm trying to give a warning for each joinpoint that isn't in the flow
hierachy of my main method.

declare warning: !cflow(execution(void *.main(String[]))) : "Unreachable
code";

Greetz,
Philip

-------------------------------------------------------------------------- ------ Tiscali ADSL: 19,50 €/maand, gedurende 3 maand! Snel Internet, en
voor iedereen. http://reg.tiscali.be/default.asp?lg=nl



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




--
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm


Back to the top