Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] can't compile anymore with generic in pointcut

On the generics problem, I was trying to recreate in a standalone case, but it won't fail for me:

---
import java.util.*;

public aspect Generics {

  pointcut p(HashMap<String,FieldModel<?>> hm): call (* foo(..)) && args(hm);

  void around(HashMap<String,FieldModel<?>> hm): p(hm) {
    proceed(hm);
  }

  public static void main(String[] argv) {
    HashMap hm = new HashMap<String,FieldModel<String>>();
    foo(hm);
  }

  public static void foo(HashMap<String,FieldModel<?>> a) {}
}

class FieldModel<T> {
}
---

am i doing something obviously different to you, do you think?




2009/3/20 Justin Case <send_lotsa_spam_here@xxxxxxxxx>

--- On Fri, 3/20/09, Andy Clement wrote:
> I'd raise a bug for that - and
> attach more code to the bug if you can, I don't think I
> have enough to go on from the message with all those
> generics flying around - what pointcut are you matching
> with? what is the joinpoint you are matching on?

At the end of this message there are the relevant snippets, I'll save them in the bug as well if you confirm I should.

> Err, AJDT doesn't ship aspectjtools.jar.  That is
> available as part of the corresponding AspectJ
> distribution.

Sorry for the confusion but I only installed AJDT via Eclipse update - so I thought it got some AspectJ by itself. To my surprise, the AspectJ JAR offered as separate download on the AJDT site (the AspectJ site says nothing about 1.6.4) DOES contain aspectjtools.jar. How come then my Eclipse was missing it??? For that matter, I was missing aspectjweaver and the matcher as well (which might explain why once JDT weaving enabled everything started to break, but I will come again with that later)

Thanks a lot,
JM
...and here the aspect code:

 pointcut syncFields( DataStorage theData, HashMap<String, FieldModel<?>> changedMap, HashMap<String, FieldModel<?>> outputMap, boolean runRules ) : call (private * com.myapp.model.DataStorage.syncFieldChanges(..))
                                       && target(theData)
                                       && args(changedMap, outputMap, runRules)
                                       && !within(DataAccess);

 void around( DataStorage theData, HashMap<String, FieldModel<?>> changedMap, HashMap<String, FieldModel<?>> outputMap, boolean runRules ) throws DataModellException
 : syncFields(theData, changedMap, outputMap, runRules)
 {
 ...
 }

...and the java:

 private void syncFieldChanges( HashMap<String, FieldModel<?>> changedMap, HashMap<String, FieldModel<?>> outputMap, boolean runRules ) throws DataModelException
 {
   throw new DataModelException( "Never supposed to go through syncFieldChanges!" );
 }




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


Back to the top