Bug 39993 - ajc stack trace on declaring hashcode() method in aspect
Summary: ajc stack trace on declaring hashcode() method in aspect
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P2 major (vote)
Target Milestone: 1.1.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 40589 43163 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-13 15:02 EDT by Wes Isberg CLA
Modified: 2003-09-16 13:08 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wes Isberg CLA 2003-07-13 15:02:03 EDT
From an email sent to the user's list 6/26/2003:
------------------------------------------
ajc 1.1 NPE when an aspect declares hashcode() as follows:

     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();
         }
     }

A workaround for callers the compiler controls is to replace the declaration
with around advice:

     int around(Identifiable i): target(i)
         && call(public int hashCode())
     {
         return (i.getId() == null)
             ? proceed(i)
             : i.getId().hashCode();
     }
Comment 1 Jim Hugunin CLA 2003-07-22 13:32:01 EDT
*** Bug 40589 has been marked as a duplicate of this bug. ***
Comment 2 Jim Hugunin CLA 2003-07-22 13:34:26 EDT
Raising to P2 based on second independent report of problem.  I'm working on a 
fix.
Comment 3 Jim Hugunin CLA 2003-07-22 19:11:57 EDT
tests and fix in tree

Handle use of super inside of inter-type declaration on an interface.  If the 
interface has more than one super interface, that is a compile-time error
because super can not be resolved.
Comment 4 Adrian Colyer CLA 2003-08-28 08:06:39 EDT
updated target milestone field to 1.1.1
Comment 5 Jim Hugunin CLA 2003-09-16 13:08:39 EDT
*** Bug 43163 has been marked as a duplicate of this bug. ***