Just to say the NPE in this thread is now fixed:
java.lang.NullPointerException
at
org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.visit(AsmHierarchyBuilder.java:548)
at
org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:214)
However, in terms of your matching above:
2. declare @method: public * *..I*Dao+.getSql*(..): @NonCacheable;
ExpenseDao.getSql1()
ExpenseDao.getSql2()
ExpenseDao.getSql3()
ExpenseDao.getSql4()
ExpenseDao.getSql5()
3. declare @method: public * *..I*Dao+.getSql(..): @NonCacheable;
SavingsBaseDao.getSql()
IGmaMbrChartDao.getSql()
GmaMbrDao.getSql()
GmaMbrChartDao.getSql()
GmaHeadCountReportDao.getSql()
GmaFilterDao.getSql()
ExpenseBaseDao.getSql()
I don't understand that - I am expecting getSql* to match all those
methods (group 2 and group 3). But I can't seem to recreate it, it
just works for me. Possibly we need to know a little more about the
hierarchy and how ExpenseDao and the other Daos relate (if at all).
If you want to persue it, please raise a bug and we can look into it.
Andy
2009/10/27 Leyzerzon, Simeon <[email protected]>:
> To anwser your question:
>
>>> public * *..I*Dao+.getSql*(..) != public * *..I*Dao+.getSql(..).
>
>> seems odd. I wonder what set of join points are matched by each variant and
>> how they overlap.
>
>
> These are the join points for each individual declaration:
>
> 1. declare @method: public * *..I*Dao+.set*(..): @NonCacheable;
>
> SavingsDao.setSql1(String)
> SavingsDao.setSql2(String)
> SavingsDao.setSql3(String)
> SavingsDao.setSql4(String)
> SavingsDao.setSql5(String)
> SavingsDao.setSql6(String)
> SavingsDao.setSql7(String)
> SavingsBaseDao.setJdbcTemplate(JdbcTemplate)
> SavingsBaseDao.setSql(String)
> IGmaMbrChartDao.setSql(String)
> IGmaFilterDao.setSql(String)
> GmaMbrDao.setSql(String)
> GmaMbrChartDao.setSql(String)
> GmaHeadCountReportDao.setSql(String)
> GmaFilterDao.setSql(String)
> GmaFilterDao.setData(IDataBuffer)
> DetailsSummaryGmaDao.setSql1(String)
> ExpenseDao.setSql1(String)
> ExpenseDao.setSql2(String)
> ExpenseDao.setSql3(String)
> ExpenseDao.setSql4(String)
> ExpenseDao.setSql5(String)
> ExpenseBaseDao.setJdbcTemplate(JdbcTemplate)
> ExpenseBaseDao.setSql(String)
>
> 2. declare @method: public * *..I*Dao+.getSql*(..): @NonCacheable;
>
> ExpenseDao.getSql1()
> ExpenseDao.getSql2()
> ExpenseDao.getSql3()
> ExpenseDao.getSql4()
> ExpenseDao.getSql5()
>
> 3. declare @method: public * *..I*Dao+.getSql(..): @NonCacheable;
>
> SavingsBaseDao.getSql()
> IGmaMbrChartDao.getSql()
> GmaMbrDao.getSql()
> GmaMbrChartDao.getSql()
> GmaHeadCountReportDao.getSql()
> GmaFilterDao.getSql()
> ExpenseBaseDao.getSql()
>
> 4. declare @method: public * *..I*Dao+.getJdbc*(..): @NonCacheable;
>
> SavingsBaseDao.getJdbcTemplate()
> ExpenseBaseDao.getJdbcTemplate()
>
> 5. declare @method: !...@noncacheable public * *..I*Dao+.*(..):
> @Cacheable(modelId="fooModel");
>
>
> SavingsDao.getSavingsChartDataBuffer(String,String,String,String,String,String,String)
>
> SavingsDao.getDAPGridDataBuffer(String,String,String,String,String,String,String)
>
> ISavingsDao.getSavingsChartDataBuffer(String,String,String,String,String,String,String)
>
> ISavingsDao.getDAPGridDataBuffer(String,String,String,String,String,String,String)
>
> SummaryGmaDao.getSummaryDatagridsDaoBuffer(String,String,String,String,String,String,String,String)
>
> ISummaryGmaDao.getSummaryDatagridsDaoBuffer(String,String,String,String,String,String,String,String)
> IGmaMbrReportDao.getMBRReportDataBuffer(MBRReportObject)
> IGmaMbrReportDao.isMBRReportExist(MBRReportObject)
> IGmaMbrReportDao.deleteMBRReport(MBRReportObject)
> IGmaMbrReportDao.insertMBRReport(MBRReportObject)
>
> IGmaMbrDao.getGmaExpenseMbrDataBuffer(String,String,String,String,String,String,String,String)
>
> IGmaMbrChartDao.getGmaExpenseMbrDataBuffer(String,String,String,String,String,String,String,String,String,String,String,String)
>
> IGmaMbrChartDao.getGmaExpenseMbrMetaDataBuffer(String,String,String,String,String,String,String,String,String,String,String,String)
>
> IGmaHeadCountReportDao.getHeadCountReportDataBuffer(HeadCountReportObject)
> IGmaHeadCountReportDao.isHeadCountReportExist(HeadCountReportObject)
> IGmaHeadCountReportDao.deleteHeadCountReport(HeadCountReportObject)
> IGmaHeadCountReportDao.insertHeadCountReport(HeadCountReportObject)
>
> IGmaFilterDao.getGmaFilterDataBuffer(String,String,String,String,String,String)
> IGmaChartFilterDao.getGmaChartFilterDataBuffer(String,String,String)
>
> IGmaChartFilterDao.getHCChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> IGmaChartFilterDao.getHCLineChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> IGmaChartFilterDao.getRegionDrillChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> IGmaChartFilterDao.getRegionTrendDrillChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> IExecutiveSummaryGmaDao.getExecutiveSummaryDatagridsDaoBuffer(String,String,String,String,String,String,String,String)
>
> IDetailsSummaryGmaDao.getDetailsSummaryGridDaoBuffer(String,String,String,int,int,String,String,String,String,String,String,String)
> GmaMbrReportDao.getMBRReportDataBuffer(MBRReportObject)
> GmaMbrReportDao.isMBRReportExist(MBRReportObject)
> GmaMbrReportDao.deleteMBRReport(MBRReportObject)
> GmaMbrReportDao.insertMBRReport(MBRReportObject)
>
> GmaMbrDao.getGmaExpenseMbrDataBuffer(String,String,String,String,String,String,String,String)
>
> GmaMbrChartDao.getGmaExpenseMbrDataBuffer(String,String,String,String,String,String,String,String,String,String,String,String)
>
> GmaMbrChartDao.getGmaExpenseMbrMetaDataBuffer(String,String,String,String,String,String,String,String,String,String,String,String)
> GmaHeadCountReportDao.deleteHeadCountReport(HeadCountReportObject)
>
> GmaHeadCountReportDao.getHeadCountReportDataBuffer(HeadCountReportObject)
> GmaHeadCountReportDao.insertHeadCountReport(HeadCountReportObject)
> GmaHeadCountReportDao.isHeadCountReportExist(HeadCountReportObject)
>
> GmaFilterDao.getGmaFilterDataBuffer(String,String,String,String,String,String)
> GmaChartFilterDao.getGmaChartFilterDataBuffer(String,String,String)
>
> GmaChartFilterDao.getHCChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> GmaChartFilterDao.getHCLineChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> GmaChartFilterDao.getRegionDrillChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> GmaChartFilterDao.getRegionTrendDrillChartsDaoBuffer(String,String,String,String,String,String,String,String)
>
> FooGmaDao.getExecutiveSummaryDatagridsDaoBuffer(String,String,String,String,String,String,String,String)
>
> ExecutiveSummaryGmaDao.getExecutiveSummaryDatagridsDaoBuffer(String,String,String,String,String,String,String,String)
>
> DetailsSummaryGmaDao.getDetailsSummaryGridDaoBuffer(String,String,String,int,int,String,String,String,String,String,String,String)
>
> IExpenseDao.getExpenseChartDataBuffer(String,String,String,String,String,String)
>
> IExpenseDao.getExpenseTreeGridDataBuffer(String,String,String,String,String,String,int)
>
> IExpenseDao.getExpensePopUpGridDataBuffer(String,String,String,String,String,int,int,String,String)
>
> IExpenseDao.getExpenseDetailGridDataBuffer(String,String,String,String,String,int,int)
> IExpenseDao.getExpenseFilterDataBuffer(String)
> ExpenseDao.getExpenseFilterDataBuffer(String)
>
> ExpenseDao.getExpenseChartDataBuffer(String,String,String,String,String,String)
>
> ExpenseDao.getExpenseTreeGridDataBuffer(String,String,String,String,String,String,int)
>
> ExpenseDao.getExpensePopUpGridDataBuffer(String,String,String,String,String,int,int,String,String)
>
> ExpenseDao.getExpenseDetailGridDataBuffer(String,String,String,String,String,int,int)
>
> Simeon
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Leyzerzon, Simeon
> [ICG-IT]
> Sent: Tuesday, October 27, 2009 5:17 PM
> To: '[email protected]'
> Subject: RE: [aspectj-users] declare @method syntax - is composite signature
> allowed??
>
> It would be easier to investigate if each of the declaration allowed for some
> identifier, otherwise they look the same in Eclipse AJDT. Apologies in
> advance if this already exists and I'm just anaware of it, this is really my
> first stab in the new territory. I could create a sample project and perhaps
> post it if that'd help looking into what's going on. What'd you suggest?
>
> Once again, appreciate your help!!
> Simeon
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Andy Clement
> Sent: Tuesday, October 27, 2009 3:44 PM
> To: [email protected]
> Subject: Re: [aspectj-users] declare @method syntax - is composite signature
> allowed??
>
> The algorithm used in situations like this is a kind of iterate to a fixed
> point - starting with what you specify. However I doubt we make guarantees
> if the declare @methods interact with each other and are specified in
> different source aspects.
>
>> public * *..I*Dao+.getSql*(..) != public * *..I*Dao+.getSql(..).
>
> seems odd. I wonder what set of join points are matched by each variant and
> how they overlap.
>
> Andy
>
> 2009/10/27 Leyzerzon, Simeon <[email protected]>:
>> Ah, looks like the following properly excludes the getSql() calls:
>>
>> public aspect CachingIntroduction {
>>
>> declare @method: public * *..I*Dao+.set*(..): @NonCacheable;
>> declare @method: public * *..I*Dao+.getSql*(..): @NonCacheable;
>> declare @method: public * *..I*Dao+.getSql(..): @NonCacheable;
>> declare @method: !...@noncacheable public * *..I*Dao+.*(..):
>> @Cacheable(modelId="fooModel");
>>
>> }
>>
>> so apparently in this case public * *..I*Dao+.getSql*(..) != public *
>> *..I*Dao+.getSql(..).
>>
>> I'm not sure it's by design on not ;)
>>
>> Thanks,
>> Simeon
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Leyzerzon,
>> Simeon [ICG-IT]
>> Sent: Tuesday, October 27, 2009 2:55 PM
>> To: '[email protected]'
>> Subject: RE: [aspectj-users] declare @method syntax - is composite signature
>> allowed??
>>
>> Andy,
>>
>> No, I haven't defined another marker interface as you correctly spotted so
>> that's what was breaking it. So NPE is gone, my bad.
>>
>> But now, after the following aspect:
>>
>> public aspect CachingIntroduction {
>>
>> declare @method: public * *..I*Dao+.set*(..): @NonCacheable;
>> declare @method: public * *..I*Dao+.getSql*(..): @NonCacheable;
>> declare @method: !...@noncacheable public * *..I*Dao+.*(..):
>> @Cacheable(modelId="fooModel");
>>
>> }
>>
>> is applied to something like this class:
>>
>>
>> public class ExpenseBaseDao implements IGmaBaseDao {
>>
>> ...
>>
>> public String getSql() {
>> return sql;
>> }
>> ...
>> }
>>
>> in the CrossRef view I'm seeing
>>
>>
>>
>> both for getSql:
>>
>> CachingIntroduction.declare @method:
>> [email protected] public *
>> *..I*Dao+.*(..) : @Cacheable(modelId = "fooModel")
>> CachingIntroduction.declare @method: public *
>> *..I*Dao+.getSql*(..) : @NonCacheable
>>
>> Does it mean getSql() is annotated as both @Cacheable and @NonCacheable,
>> could I apply some precedence here?
>>
>> Thanks,
>> Simeon
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Andy Clement
>> Sent: Tuesday, October 27, 2009 11:29 AM
>> To: [email protected]
>> Subject: Re: [aspectj-users] declare @method syntax - is composite signature
>> allowed??
>>
>> Hey,
>>
>> Any NPE from the compiler is a bug. I presume you have defined the
>> Setter annotation? (ie. it must exist as a definition in order to
>> succeed)
>>
>> I raised this problem as
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=293457
>>
>> Due to it failing in the hierarchy building code, it may behave better on
>> the command line where the model does not get constructed.
>>
>> cheers,
>> Andy
>>
>> 2009/10/27 Leyzerzon, Simeon <[email protected]>:
>>> Hi Andy,
>>>
>>> Thanks for responding. I tried the approach you are suggesting,
>>> unfortunately I'm getting the following:
>>>
>>> java.lang.NullPointerException
>>> at
>>> org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder.visit(AsmH
>>> i
>>> erarchyBuilder.java:548) at
>>> org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.t
>>> r
>>> averse(MethodDeclaration.java:214)
>>> at
>>> org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.tra
>>> v
>>> erse(TypeDeclaration.java:1246) at
>>> org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDecl
>>> a ration.traverse(Compilatio ... oBuildJob.run(AutoBuildJob.java:238)
>>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>>>
>>> Compile error: NullPointerException thrown: null
>>>
>>>
>>> Here's the aspect I'm using:
>>>
>>> package com.citi.gdos.smart.applib.service.cache;
>>>
>>> import org.springmodules.cache.annotations.Cacheable;
>>>
>>> public aspect CachingIntroduction {
>>>
>>> declare @method: public * *..I*Dao+.set*(..): @Setter; declare
>>> @method: !...@setter public * *..I*Dao+.*(..):
>>> �...@cacheable(modelId="fooModel");
>>>
>>> }
>>>
>>>
>>> Am I doing something wrong? Do I need a nightly build perhaps for this to
>>> work?
>>>
>>> Thanks,
>>> Simeon
>>>
>>> -----Original Message-----
>>> From: [email protected]
>>> [mailto:[email protected]] On Behalf Of Andy Clement
>>> Sent: Tuesday, October 27, 2009 9:58 AM
>>> To: [email protected]
>>> Subject: Re: [aspectj-users] declare @method syntax - is composite
>>> signature allowed??
>>>
>>> Hi Simeon,
>>>
>>> This restriction you've uncovered was actually only recently raised as this
>>> enhancement:
>>>
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=287613
>>>
>>> To support it I need to change the serialized form of the attributes - I
>>> try not to do this often but for other reasons (optimization) I may be
>>> changing the format in 1.6.7 so I will be looking at it in that timeframe.
>>>
>>>> declare @method :
>>>> public * *..I*Dao+.*(..) && !public * *..I*Dao+.set*(..):
>>>> �...@cacheable(modelId="fooModel");
>>>
>>> a clunky approach might be:
>>>
>>> declare @method: public * *..I*Dao+.set*(..): @Setter; declare @method:
>>> !...@setter public * *..I*Dao+.*(..):
>>> @Cacheable(modelId="fooModel");
>>>
>>> but I know that's not great...
>>>
>>> Andy
>>>
>>> 2009/10/26 Leyzerzon, Simeon <[email protected]>:
>>>> I have a hierarchy of DAO classes into which I'm introducing an @Cacheable
>>>> annotation via something like this:
>>>>
>>>> declare @method :
>>>> public * *..I*Dao+.*(..) :
>>>> �...@cacheable(modelId="fooModel");
>>>>
>>>> The problem is, we need to filter out more than is specified by this one
>>>> signature pattern, and I'm not sure that a composite pattern is allowed in
>>>> this type of expression. When I tried something like this:
>>>>
>>>> declare @method :
>>>> public * *..I*Dao+.*(..) && !public * *..I*Dao+.set*(..):
>>>> �...@cacheable(modelId="fooModel");
>>>>
>>>> I'm getting compile errors saying:
>>>>
>>>> Syntax error on token "&&", ";" expected
>>>>
>>>> I also tried to define composite pointcuts representing the joint points
>>>> I'm interested in (basically I want to exclude 'jdbcTemplate' and 'slq'
>>>> Spring specific setters from the places where annotation is introduced)
>>>> but declaration syntax doesn't seem to like it either.
>>>>
>>>> What would be a good approach in the use case I described?
>>>>
>>>> I'm using compile time weaving via Ant. AspectJ version is 1.6
>>>>
>>>> Thank you in advance,
>>>> Simeon
>>>>
>>>> _______________________________________________
>>>> aspectj-users mailing list
>>>> [email protected]
>>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>>
>>> _______________________________________________
>>> aspectj-users mailing list
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>> _______________________________________________
>>> aspectj-users mailing list
>>> [email protected]
>>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>>
>> _______________________________________________
>> aspectj-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> _______________________________________________
>> aspectj-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> _______________________________________________
>> aspectj-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users