Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ ITD generic static method is not working

Hi,

It actually works on the command line, but it fails in the IDE (AJDT).
 I've raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=332457 to
cover it.

cheers
Andy

On 13 December 2010 07:24, Mamun <mamuninfo@xxxxxxxxx> wrote:
> Hi,
> In AspectJ doc, the syntax of static method declaration is-
>
> AspectJ 5 Doc
> static <E> E Utils.first(List<E> elements) {...}
>
> I tried to access the method from sub class. But it show compiler error. Am
> I doing anything working here?
>
> public class Purchase{
> }
> //
> aspect PurchaseFinder{
>     //Compile error code
>     static <U extends Purchase> U Purchase.find(){
>         ......
>      }
> }
>
> public class HardwarePurchase extend Purchase{
>   public static test(){
>      HardwarePurchase test =  HardwarePurchase .<HardwarePurchase >find();
> // this code is not working
>   }
> }
>
> Error- The method find() of type Purchase is not generic; it cannot be
> parameterized with arguments <HardwarePurchase >.
>
> But if I move the static function (find) code to the Purchase class from
> PurchaseFinder aspect then it works fine.
>
> Working code-
> public class Purchase{
>      static <U extends Purchase> U find(){
>         ......
>      }
> }
>
>
>
> Kind regards,
> Mamun
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top