Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Call Join points


Nope, AspectJ5 runs on Java 1.3 or 1.4 - but obviously you can only
exploit Java5 features (annotations/generics) if you are using Java 1.5
As you aren't using these features, you should be fine to use it
on whatever JVM you already have installed.

Andy.



"DiFrango, Ron" <ron.difrango@xxxxxxxxxxxxxx>
Sent by: aspectj-dev-bounces@xxxxxxxxxxx

10/05/2005 15:16

Please respond to
AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>

To
"AspectJ developer discussions" <aspectj-dev@xxxxxxxxxxx>
cc
Subject
RE: [aspectj-dev] Call Join points





Andy,

I can do that, but is JDK1.5 [or Java 5] required?

                -----Original Message-----
                From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Andrew Clement
                Sent: Tuesday, May 10, 2005 9:01 AM
                To: AspectJ developer discussions
                Subject: RE: [aspectj-dev] Call Join points
               
               

                I seem to remember fixing a bug between AspectJ1.2.1
(AJDT1.1.12) and
                AspectJ1.5.0 (AJDT1.2.0) on the line of code which is failing
for you:
               
                java.lang.RuntimeException: Internal Compiler Error: Unexpected
null source location passed as 'see also' location.                  at
               
org.aspectj.ajdt.internal.compiler.WeaverMessageHandler.buildSeeAlsoProb
lems(WeaverMessageHandler.java:192)        
               
                It is failing when trying to report an error - unfortunately
losing the
                real error in the process.
               
                if you did a quick one off compile on the command line with
AspectJ1.5.0 then
                it should tell you what the real problem is...
               
                Andy.
               
               
               
               
               
               
"DiFrango, Ron" <ron.difrango@xxxxxxxxxxxxxx>
Sent by: aspectj-dev-bounces@xxxxxxxxxxx

10/05/2005 13:07
Please respond to
AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>


To
"AspectJ developer discussions" <aspectj-dev@xxxxxxxxxxx>
cc
Subject
RE: [aspectj-dev] Call Join points

               




                I am using 1.1.12 and Eclipse 3.0.1.
               
                -----Original Message-----
                From: aspectj-dev-bounces@xxxxxxxxxxx
                [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of DiFrango,
Ron
                Sent: Tuesday, May 10, 2005 8:05 AM
                To: AspectJ developer discussions
                Subject: RE: [aspectj-dev] Call Join points
               
               
                I think I know what the problem is, the library has some bad
design [not
                my fault, I swear] where it throws Exception on some of those
methods
                and I think that is what is making the compiler throw up like it
is
                below.
               
                Any comments or thoughts?
               
                -----Original Message-----
                From: DiFrango, Ron
                Sent: Tuesday, May 10, 2005 8:00 AM
                To: 'AspectJ developer discussions'
                Subject: RE: [aspectj-dev] Call Join points
                Importance: High
               
               
                Thanks Ron.  I added that, but now I get the following compiler
error:
               
                Internal compiler error
                java.lang.RuntimeException: Internal Compiler Error: Unexpected
null
                source location passed as 'see also' location.
at
               
org.aspectj.ajdt.internal.compiler.WeaverMessageHandler.buildSeeAlsoProb
                lems(WeaverMessageHandler.java:192)                  at
               
org.aspectj.ajdt.internal.compiler.WeaverMessageHandler.handleMessage(We
                averMessageHandler.java:99)                  at
                org.aspectj.weaver.Lint$Kind.signal(Lint.java:179)
at
               
org.aspectj.weaver.patterns.KindedPointcut.warnOnConfusingSig(KindedPoin
                tcut.java:135)                  at
               
org.aspectj.weaver.patterns.KindedPointcut.match(KindedPointcut.java:69)
                at
org.aspectj.weaver.patterns.OrPointcut.match(OrPointcut.java:44)
                at
               
org.aspectj.ajdt.internal.compiler.problem.AjProblemReporter.unhandledEx
                ception(AjProblemReporter.java:84)                  at
               
org.eclipse.jdt.internal.compiler.flow.FlowContext.checkExceptionHandler
                s(FlowContext.java:182)                  at
               
org.eclipse.jdt.internal.compiler.ast.MessageSend.analyseCode(MessageSen
                d.java:48)                  at
               
org.eclipse.jdt.internal.compiler.ast.Block.analyseCode(Block.java:40)
                at
               
org.eclipse.jdt.internal.compiler.ast.IfStatement.analyseCode(IfStatemen
                t.java:80)                  at
               
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.analyseCode(Meth
                odDeclaration.java:70)                  at
               
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.internalAnalyseCod
                e(TypeDeclaration.java:705)                  at
               
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.analyseCode(TypeDe
                claration.java:262)                  at
               
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.analyse
                Code(CompilationUnitDeclaration.java:78)                  at
               
org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:547)
                at
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:365)
                at
               
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation
                (AjBuildManager.java:671)                  at
               
org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildMan
                ager.java:167)                  at
               
org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuild
                Manager.java:101)                  at
               
org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:1
                22)                  at
               
org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJ
                BuildManager.java:165)
               
                -----Original Message-----
                From: aspectj-dev-bounces@xxxxxxxxxxx
                [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
                Sent: Monday, May 09, 2005 10:44 PM
                To: 'AspectJ developer discussions'
                Subject: RE: [aspectj-dev] Call Join points
               
               
                Hi Ron,
               
                Remember that if you want to handle checked exceptions through
an
                aspect, you will need to use the declare soft form so the
compiler
                recognizes that the exceptions won't leave the given join point.
Declare
                soft is described in the programmer's guide for the basics.
               
                You can also see an example of how to do this in an article that
                Ramnivas and I wrote:
http://www.linux-mag.com/2004-04/aspects_01.html
               
                -----Original Message-----
                From: aspectj-dev-bounces@xxxxxxxxxxx
                [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of DiFrango,
Ron
                Sent: Monday, May 09, 2005 11:06 AM
                To: AspectJ developer discussions
                Subject: RE: [aspectj-dev] Call Join points
               
                Okay, now here is an interesting one that I think is for AJDT
though.  I
                was trying to use this to inject Exception handling into my code
so that
                I did not have to scatter it everywhere when using this library.
               
                Well, when I compiled the code with the original try catch
blocks in the
                application proper the outline view was correct and it compiled
cleanly.
                The minute I remove it, it complains about not having exception
handlers
                in place.  Anyone know why that might be.
               
                Thanks in advance,
               
                Ron
               
                -----Original Message-----
                From: aspectj-dev-bounces@xxxxxxxxxxx
                [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of DiFrango,
Ron
                Sent: Monday, May 09, 2005 1:26 PM
                To: AspectJ developer discussions
                Subject: RE: [aspectj-dev] Call Join points
               
               
                Adrian/Ramnivas,
               
                Thanks for your help.  I now have this work.  I will still like
to be
                able to go through my DataContracts interface and now have to
enumerate
                all the interfaces it has housed in it.  Maybe I will submit an
                enhancement request on this one.
               
                Ron
               
                -----Original Message-----
                From: DiFrango, Ron
                Sent: Monday, May 09, 2005 8:40 AM
                To: 'AspectJ developer discussions'
                Subject: RE: [aspectj-dev] RE: [aspectj-users] Call Join points
               
               
                Adrian,
               
                After you sent it, Ramnivas' solution made more sense to me.  I
tried it
                and it still did not work and I got the following:
               
                                no match for this type name: AccountActionsData
                [Xlint:invalidAbsoluteTypeName]
ExceptionHandlerInsertion.aj
               
                The only difference between my code and yours is that
AccountActionsData
                is yet another interface that implements two additional
interfaces and
                not a concrete class.
               
                So change your code below to the following:
               
                package abc;
               
                public interface AccountActionsData extends
AccountActionsRiskData,
                AccountActionsBaseData { }
               
                public interface AccountActionsBaseData {
                                public void boo1() throws MyAppException;
                }
               
                public interface AccountActionsRiskData {
                                public void boo2() throws MyAppException;
                }
               
                Then we have a dynamic proxy that actually constructs the
underlying
                implementation classes based upon these interfaces.
               
                Also, these classes are in a separate JAR file that I am weaving
in
                therefore, the need for the call side pointcut.
               
                Even if I got this to work, I am not sure I would like it
because, I now
                have to enumerate all the interfaces
               
                Thanks again!
               
                Ron
               
                -----Original Message-----
                From: aspectj-dev-bounces@xxxxxxxxxxx
                [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of Adrian
Colyer
                Sent: Monday, May 09, 2005 8:14 AM
                To: AspectJ developer discussions
                Subject: Re: [aspectj-dev] RE: [aspectj-users] Call Join points
               
               
                The version that uses DataContracts.*.*(..) does not work
because this
                will match any type in a package DataContracts (AspectJ expects
a type
                pattern in this position), but DataContracts.ACCOUNT_ACTIONS is
not a
                type
                - it's a the name of a public field. The version that Ramnivas
proposes
                I
                would expect to work. I created a simple replica of your project
and
                tried
                all of:
               
                call( * AccountActionsData.*(..))
                call(* *(..)) && target(AccountActionsData)  // also matches the
                toString
                call
                call(* *(..)) && target(aad) && if (aad ==
                DataContracts.ACCOUNT_ACTIONS)
                // only matches for the ACCOUNT_ACTIONS instance
               
                which all worked for me as expected.
               
                Here is my source code:
               
                package abc;
               
                public class Driver {
               
                   public static void main(String[] args) {
                     DataContracts.ACCOUNT_ACTIONS.boo();
                     DataContracts.ACCOUNT_ACTIONS.toString();
                   }
               
                }
               
                =============
               
                package abc;
               
                public interface DataContracts {
               
                   public static AccountActionsData ACCOUNT_ACTIONS =
                       new AccountActionsData();
               
                }
               
                =============
               
                package abc;
               
                public class AccountActionsData {
               
                   public void boo() {}
               
                }
               
                =============
               
                package abc;
               
                public aspect ExceptionHandling {
               
                   pointcut exceptionHandling(AccountActionsData aad) :
                       call(* *(..)) && target(aad) && if(aad ==
                DataContracts.ACCOUNT_ACTIONS);
               
                   Object around() : exceptionHandling(AccountActionsData) {
                       System.out.println("handling " + thisJoinPoint);
                       try {
                           return proceed();
                       } catch (Exception ex) {
                           return null;
                       }
                   }
               
                }
               
                =============
               
                when I run this I get the output:
               
                handling call(void abc.AccountActionsData.boo())
                handling call(String java.lang.Object.toString())
               
               
                So I guess that leads to 2 questions:
                * does my source code work in your environment?, and
                * can you think of any difference between my example and yours
that
                could
                be causing the failure to match?
               
                I'm travelling again today and will be offline again for the
next few
                hours...
               
                -- Adrian
                Adrian_Colyer@xxxxxxxxxx
               
               
               
                "DiFrango, Ron" <ron.difrango@xxxxxxxxxxxxxx>
                Sent by: aspectj-dev-bounces@xxxxxxxxxxx
                09/05/2005 12:14
                Please respond to
                AspectJ developer discussions <aspectj-dev@xxxxxxxxxxx>
               
               
                To
                "AspectJ developer discussions" <aspectj-dev@xxxxxxxxxxx>
                cc
               
                Subject
                [aspectj-dev] RE: [aspectj-users] Call Join points
               
               
               
               
               
               
                Can one of the developers look into the situation below and let
me know
                if this is a bug or if it is something that I am doing wrong?
               
                Thanks in advance,
               
                Ron
               
                -----Original Message-----
                From: aspectj-users-bounces@xxxxxxxxxxx
                [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of
DiFrango, Ron
                Sent: Thursday, May 05, 2005 8:12 AM
                To: aspectj-users@xxxxxxxxxxx
                Subject: RE: [aspectj-users] Call Join points
               
               
                Thanks for the suggestion, but that does not work either.
Actually,
                neither of those approaches work for some reason.  I think we
need one
                of the developers to comment on why this might be happening.
               
                -----Original Message-----
                From: aspectj-users-bounces@xxxxxxxxxxx
                [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ramnivas
Laddad
                Sent: Wednesday, May 04, 2005 11:22 PM
                To: aspectj-users@xxxxxxxxxxx
                Subject: Re: [aspectj-users] Call Join points
               
               
                Ron,
               
                I think your pointcut should be like the following:
                   pointcut exceptionHandlingInsertion() :
                       call(* AccountActionsData.*(..));
               
                   Or if you want to apply to only ACCOUNT_ACTIONS instances:
               
                    pointcut exceptionHandlingInsertion(AccountActionsData aad)
:
                       call(* AccountActionsData.*(..)) && target(aad) && if(aad
==
                DataContracts.ACCOUNT_ACTIONS) ;
               
                -Ramnivas
               
                ===
                Ramnivas Laddad,
                Author, AspectJ in Action
                http://ramnivas.com
                M: (408)203-4621
               
               
               
                DiFrango, Ron wrote:
               
                >Okay, I have a situation that I can not figure out.  I have the
                >following interface declared:
                >
                >
                >public interface DataContracts
                >{
                >    /**
                >     *  Constant for the <code>AccountActionsData</code>
interface(s).
                >     */
                >    public static AccountActionsData ACCOUNT_ACTIONS =
                >        AccountActionsDataService.getDataInstance();
                >}
                >
                >What I want to do is pick out any calls to the
                >DataContracts.ACCOUNT_ACTIONS so I created the following
aspect:
                >
                >public aspect ExceptionHandlerInsertion {
                >                pointcut exceptionHandlingInsertion() :
                >                                call(* DataContracts.*.*(..));
                >
                >                Object around() : exceptionHandlingInsertion()
                >                {
                >                                try
                >                                {
                >                                                return
proceed();
                >                                }
                >                                catch(Exception e)
                >                                {
                >                                                return null;
                >                                }
                >                }
                >}
                >
                >The only thing is that it does not pick out any calls such as
the
                >following:
                >
                >
                >DataContracts.ACCOUNT_ACTIONS.update("Aspectj");
                >
                >Any thoughts on how I can make this work?
                >
                >Thanks in advance,
                >
                >Ron
                >_______________________________________________
                >aspectj-users mailing list
                >aspectj-users@xxxxxxxxxxx
                >https://dev.eclipse.org/mailman/listinfo/aspectj-users
                >
                >
                >
                _______________________________________________
                aspectj-users mailing list
                aspectj-users@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-users
                _______________________________________________
                aspectj-users mailing list
                aspectj-users@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-users
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
               
               
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
               
               
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
                _______________________________________________
                aspectj-dev mailing list
                aspectj-dev@xxxxxxxxxxx
                https://dev.eclipse.org/mailman/listinfo/aspectj-dev
               
               

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


Back to the top