Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Changes in introduction for aspectj compiler 1.1

This is useful information for users, and I'm very happy you could find a work-around and share it with others.  However, this is also a 1.1 compiler bug.  You've already done the hard work of reducing this to a small self-contained test case that reproduces the problem.  Could you please submit this to the bug report system so that it will be fixed in a future release?

FYI - If you find any bugs, please submit a reproducible test case to https://dev.eclipse.org (-> Bug Reports) (product AspectJ, component Compiler).

Thanks - Jim

> -----Original Message-----
> From: William DeMoss II [mailto:wdemoss@xxxxxxxxxxxx]
> Sent: Thursday, June 26, 2003 8:47 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] Changes in introduction for aspectj compiler 1.1
> 
> I was playing around with porting over our current project witch uses
> 1.0.6 to the new compiler and looking into the little differences that
> would need to be addressed. I came across a obscure difference between
> the two concerning introduction. I thought it would be of help to pass
> it along. Here is the example.
> 
>     interface Identifiable {
>         void setId(Id id);
>         Id getId();
>     }
> 
>     aspect IdentifiableAspect {
>         private Id Identifiable.id = null;
>         public Id Identifiable.getId() {
> 		return this.id;
> 	  }
>         public void Identifiable.setId(Id id) {
>             this.id = id;
>         }
> 
>         public int Identifiable.hashCode() {
>             return (this.getId() == null)
>                 ? super.hashCode()
>                 : this.getId().hashCode();
>         }
>     }
> 
> The method of interest is the introduction of hashCode. Proir to the new
> compiler this worked fine. Now it throws a NullPointer exception in the
> compiler w/o a good error message. However, if you change the
> functionallity to the following:
> 
>     int around(Identifiable i): target(i)
>         && call(public int hashCode())
>     {
>         return (i.getId() == null)
>             ? proceed(i)
>             : i.getId().hashCode();
>     }
> 
> It accomplishes the same goal. I believe this has to do with the new
> compiler  bytecode weaving as opposed to the source code weaving done
> with the prior version. Hope that can save someone some trouble.
> 
> - wd
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top