diff options
author | acolyer <acolyer> | 2005-09-27 15:00:24 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-09-27 15:00:24 +0000 |
commit | e76b37012601cf67a069b4a78f60f183efad563d (patch) | |
tree | 3148225993d764b6389b0d360e618e73ad0e0042 /tests/bugs150 | |
parent | c6567597adac0d457cdab8df3c24f9044f21e0e8 (diff) | |
download | aspectj-e76b37012601cf67a069b4a78f60f183efad563d.tar.gz aspectj-e76b37012601cf67a069b4a78f60f183efad563d.zip |
tests and fix for pr88900, unneccessary warning
Diffstat (limited to 'tests/bugs150')
-rw-r--r-- | tests/bugs150/pr104229.aj | 132 | ||||
-rw-r--r-- | tests/bugs150/pr88900.aj | 5 |
2 files changed, 137 insertions, 0 deletions
diff --git a/tests/bugs150/pr104229.aj b/tests/bugs150/pr104229.aj new file mode 100644 index 000000000..d3feb328b --- /dev/null +++ b/tests/bugs150/pr104229.aj @@ -0,0 +1,132 @@ +import java.lang.annotation.*; +import javax.swing.*; +import javax.swing.event.*; +import java.awt.*; + +interface GoalSelectedNotice { + public void goalSelected(Object goal); +} + +@Retention(RetentionPolicy.RUNTIME) +@interface DefaultImplementation {} + +aspect X { + /** + * Watch for goalSelected(..) method being called when + * not within this aspect. + */ + pointcut goalSelectedPointcut(GoalSelectedNotice _this, Object goal): + call(void GoalSelectedNotice.goalSelected(Object)) + && target(_this) && args(goal) && !cflow(adviceexecution()); + + declare warning : call(void GoalSelectedNotice.goalSelected(Object)) : "bingo"; + + after(Object caller, Object o) returning : call(void GoalSelectedNotice.goalSelected(Object)) && args(o) && target(caller){ + System.out.println("call match " + caller.getClass()); + } + + after(GoalSelectedNotice _this, Object goal) returning: + goalSelectedPointcut(_this, goal){ + System.out.println("OK it worked!"); + } + /** + * Empty body, can be overriden by classes implementing + * {@link GoalSelectedNotice}. + */ + @DefaultImplementation + public void GoalSelectedNotice.goalSelected(Object goal){ + } +} + +public class pr104229 implements GoalSelectedNotice { + + interface CallMe { void doIt(); } + + public static void main(String[] args) { + pr104229 pr = new pr104229(); + pr.callInner(); + } + + public void callInner() { + + CallMe callMe = new CallMe() { + public void doIt() { + pr104229.this.goalSelected("MyGoal"); + } + }; + + callMe.doIt(); + + } + + +} + +class ListPanel extends JPanel implements GoalSelectedNotice{ + + private JComboBox jComboBox = null; + private JList jList = null; + /** + * This is the default constructor + */ + public ListPanel() { + super(); + initialize(); + } + /** + * This method initializes this + * + * @return void + */ + private void initialize() { + this.setLayout(new BorderLayout()); + this.setSize(300,200); + this.add(getJComboBox(), java.awt.BorderLayout.NORTH); + this.add(getJList(), java.awt.BorderLayout.CENTER); + } + /** + * This method initializes jComboBox + * + * @return javax.swing.JComboBox + */ + private JComboBox getJComboBox() { + if (jComboBox == null) { + jComboBox = new JComboBox((ComboBoxModel)null); + } + return jComboBox; + } + /** + * This method initializes jList + * + * @return javax.swing.JList + */ + private JList getJList() { + if (jList == null) { + jList = new JList((ListModel)null); + jList.addListSelectionListener( + new ListSelectionListener(){ + public void valueChanged(ListSelectionEvent e){ + if(!e.getValueIsAdjusting()){ + JList list = (JList)e.getSource(); + Object goal = list.getSelectedValue(); + System.out.println(goal); + +// If I replace the line below with... + ListPanel.this.goalSelected(goal); //the join point is not seen!; +// This was working before a switched to source level 5! + ListPanel.this.sendGoalSelectedNotice(goal); // this is workaround! + + } + } + } + ); + } + return jList; + } + + // this is part of workaround + protected void sendGoalSelectedNotice(Object goal){ + // join point is found by pointcut here! This is ok! + goalSelected(goal); + } +}
\ No newline at end of file diff --git a/tests/bugs150/pr88900.aj b/tests/bugs150/pr88900.aj new file mode 100644 index 000000000..4f3e65bc8 --- /dev/null +++ b/tests/bugs150/pr88900.aj @@ -0,0 +1,5 @@ +aspect RunnableDefaultImpl { + + public void Runnable.run() {} + +} |