Bug 64262 - ClassCastException at BcelRenderer.java:169
Summary: ClassCastException at BcelRenderer.java:169
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 1.2.1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-26 19:38 EDT by Ganesh Sittampalam CLA
Modified: 2004-10-21 04:31 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ganesh Sittampalam CLA 2004-05-26 19:38:45 EDT
The following program causes a compiler exception for me.

public class Test  {
   double foo(double x) {
      return x;
   }
}

aspect Aspect {

pointcut foo(int b): args(b);

before(Object i) : foo(i) 
   {
   }
}
Comment 1 Adrian Colyer CLA 2004-07-28 14:02:24 EDT
The bug occurs when AspectJ attempts to weave a runtime instanceof test against 
a primitive type. We get into this situation when a pointcut matches via an
isCoercible() test as opposed to an isAssignable() from test.

The following simpler program will also reproduce the bug:

public class Test {
  void foo(double x) {}
}

aspect Aspect {
  // double coerced to int
  pointcut foo(int i) : execution(* foo(..)) && args(i);

  before() : foo(int) {}
}

Whereas this variation compiles happily:

public class Test {
  void foo(int x) {}
}

aspect Aspect {
  // int assigned to double
  pointcut foo(double d) : execution(* foo(..)) && args(d);

  before() : foo(double) {}
}

Will look into the solution more in the morning...
Comment 2 Adrian Colyer CLA 2004-07-29 06:52:10 EDT
Fix committed to tree, will close the defect report once it is available in a 
public build.
Comment 3 Adrian Colyer CLA 2004-07-29 09:49:28 EDT
Fix now available in latest build.
Comment 4 Adrian Colyer CLA 2004-10-21 04:31:29 EDT
Fix released as part of AspectJ 1.2.1