Bug 42746 - within() pcd is confused for certain declare softs
Summary: within() pcd is confused for certain declare softs
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: 1.1.1   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-09 00:28 EDT by Ron Bodkin CLA
Modified: 2003-09-09 20:39 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 2003-09-09 00:28:27 EDT
This is an error in cvs head and in 1.1.0. It works correctly (no compiler 
errors) in 1.0.6. If you get rid of the within(..) restriction, the code works.

Output:
C:\eclipse\workspace\atrack>ajc -d debug @narrow.lst
C:\eclipse\workspace\atrack\src\test\NoSoftener.java:17 Unhandled exception 
type
 NoSuchMethodException
Constructor ctor = clazz.getConstructor(keyArgType);
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 error

Source:
/*
 * Created on Sep 8, 2003
 *
 * Copyright (c) 2003 New Aspects of Security. All Rights Reserved.
 */
package org.atrack.model.error.impl;

import test.NoSoftener;

package test;
import java.lang.reflect.Constructor;

/*
 * Created on Sep 8, 2003
 *
 * Copyright (c) 2003 New Aspects of Security. All Rights Reserved.
 */

/**
 * @author Ron Bodkin
 *
 */
public class NoSoftener {
    public void foo(Class clazz) {
        Class[] keyArgType = {};
        Constructor ctor = clazz.getConstructor(keyArgType);
    }
}
/*
 * Created on Sep 8, 2003
 *
 * Copyright (c) 2003 New Aspects of Security. All Rights Reserved.
 */
package org.atrack.model.error.impl;

import test.NoSoftener;

/**
 * @author Ron Bodkin
 *
 */
public aspect Softener {
    public pointcut scope() : within(NoSoftener);

    public pointcut callsThrowingChecked() : call(* *(..)) && scope();
    declare soft: NoSuchMethodException: callsThrowingChecked();
}
Comment 1 Ron Bodkin CLA 2003-09-09 13:08:20 EDT
contributing the sources per the CPL:

package test;
import java.lang.reflect.Constructor;

/**
 * @author Ron Bodkin
 */
public class NoSoftener {
    public void foo(Class clazz) {
        Class[] keyArgType = {};
        Constructor ctor = clazz.getConstructor(keyArgType);
    }
}
---
package org.atrack.model.error.impl;

import test.NoSoftener;

/**
 * @author Ron Bodkin
 */
public aspect Softener {
    public pointcut scope() : within(NoSoftener);

    public pointcut callsThrowingChecked() : call(* *(..)) && scope();
    declare soft: NoSuchMethodException: callsThrowingChecked();
}
Comment 2 Jim Hugunin CLA 2003-09-09 20:39:24 EDT
the test provided below is now in the tree, and this bug should be fixed in the
current cvs head