Bug 94167 - NPE in reflect implementation
Summary: NPE in reflect implementation
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0 M3   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-09 13:37 EDT by Ron Bodkin CLA
Modified: 2005-06-14 12:07 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 Ron Bodkin CLA 2005-05-09 13:37:42 EDT
Proposed fix (I'd like input on how to best add test cases for this so I can 
submit a tested patch); I believe this will work because if you uncomment the 
work-around line, it works):

Change line 63 from:
				method = declaringType.getDeclaredMethod
(getName(),getParameterTypes());

to

				method = getDeclaringType().getDeclaredMethod
(getName(),getParameterTypes());

Test source:

package reflect;

import org.aspectj.lang.*;
import org.aspectj.lang.reflect.*;
import java.lang.reflect.*;

aspect Test {
    before() : call(* *(..)) && !within(Test) {
       MethodSignature sig = (MethodSignature)thisJoinPoint.getSignature();
       //sig.getDeclaringType(); // uncomment to work-around
       Method method = sig.getMethod();
   }
}

public class MinimalErr {
    public static void main(String args[]) {
	try {
	    Inner.foo();
	} catch (Throwable t) {
	    t.printStackTrace();
	}
    }
    public static class Inner {
	public static void foo() {}
    }
}
Comment 1 Andrew Clement CLA 2005-06-07 08:19:30 EDT
Fix integrated.  Test put in as follows:

Test program put into tests/bugs150/PR94167.java

Added test spec to XML file: tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

JUnit test added to: tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java

Thanks for the simple testcase Ron :)

waiting on dev build before closing.
Comment 2 Andrew Clement CLA 2005-06-14 12:07:10 EDT
Fix available, see aspectj download page: aspectj-DEVELOPMENT-20050614164300.jar