Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to declare an error when implementations of an interface doesn't supply a certain constructor

Awesome... Thanks :)

/Jeppe

Andy Clement wrote:
I've just put the fix for this into the AJ codebase, your program now works for me.  It will appear in an AspectJ build imminently, and then in an AJDT in the next few days.

Andy.

On 17/01/06, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Aha, just received your code - it isnt the same as mine, is it .... your types are in *packages*.  If you move them all to the default package you should see it works fine ;)

This is a bug.

Andy.

ps. Adrian did say caveat emptor... :)


On 17/01/06, Andy Clement < andrew.clement@xxxxxxxxx> wrote:
Yes, you can send it to me and I'll try it - andrew.clement AT gmail.com


Andy.

On 17/01/06, Jeppe Cramon < jeppe@xxxxxxxxx> wrote:
Hi

No, it's basically the same code as yours (only the name of the broken class differs).
Could I try and send it to you? I dunno if this mailling list will allow attachments?

/Jeppe


Andy Clement wrote:
I cut my program from the previous email and pasted it into an AspectJ project.  AJDT version 1.3.0.20051220093604 running in Eclipse 3.1.1 - and again it only flagged MyBrokenOption (all I did in the AspectJ project was activate hasMember).  there must be some difference between your program and mine - do you define constructors elsewhere in the hierarchy?

Andy.

On 17/01/06, Jeppe Cramon <jeppe@xxxxxxxxx> wrote:
Hi

This is very strange. The same code in Eclipse 3.1.1 with the latest AJDT 1.3 shows an error for MyXOption but not for MyBrokenOption.

I also tried under Eclipse 3.2M4 with the latest AJDT 1.4  and it showed the same result.

Can anyone reproduce this under Eclipse?


/Jeppe

Andy Clement wrote:
Sorry if I've come to this late and am missing some context.... I typed in your program, added some missing types and added a type that broke the rule:

-------------8<---------------
public aspect OptionAspect {

   interface IBadOptionSubtype {};

    declare parents : (IOption+ && !IOption && !IXOption && !IYOption && !IZOption) && !hasmethod(new(OptionType))
                             implements IBadOptionSubtype;

    declare error : staticinitialization(IOption+ && IBadOptionSubtype+)
        : "IOption implementations must provide a constructor which accepts an OptionType";

}

interface IOption {}
interface IXOption extends IOption {}
interface IYOption extends IOption {}
interface IZOption extends IOption {}

class OptionType {}

class MyXOption implements IXOption {
    public MyXOption(OptionType type) { }
}

class MyBrokenOption implements IXOption {
}
-----------------8<----------------

I then compiled it:

C:\aspectj1.5>ajc -XhasMember -showWeaveInfo OptionAspect.java
Extending interface set for type 'MyBrokenOption' ( OptionAspect.java) to include 'OptionAspect$IBadOptionSubtype' (OptionAspect.java)

C:\aspectj1.5\OptionAspect.java:24 [error] IOption implementations must provide a constructor which accepts an OptionType
class MyBrokenOption implements IXOption {
      ^^^^^^^^^^^^^
        staticinitialization(void MyBrokenOption.<clinit>())
        see also: C:\aspectj1.5\OptionAspect.java:8::0

1 error

-showWeaveInfo just shows me which is being marked as a bad option.  My correct class that implements the ctor is not flagged and my broken one that doesn't implement it is marked with the declare error.  Now I presume I must have made some incorrect assumption in my definition of the missing types since its working ok for me...


Andy.

_______________________________________________ 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-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

Back to the top