summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-10-26 12:28:26 +0000
committeraclement <aclement>2005-10-26 12:28:26 +0000
commitea305990eec2a76cfd286d060b52cab76f47def6 (patch)
treec5d9352bee75dbbb8d8297ef7847808942fae26c /tests
parent56766b766a7b1f8f1b3b382bd5c586881738dc60 (diff)
downloadaspectj-ea305990eec2a76cfd286d060b52cab76f47def6.tar.gz
aspectj-ea305990eec2a76cfd286d060b52cab76f47def6.zip
pr113630 testcase added - commented out.
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs150/pr113630/Bean.java17
-rw-r--r--tests/bugs150/pr113630/BeanSupportAspectj.aj10
-rw-r--r--tests/bugs150/pr113630/BeanTestCase.java34
-rw-r--r--tests/bugs150/pr113630/PropertySupportAspect5.aj90
-rw-r--r--tests/bugs150/pr113630/javaBean.java9
-rw-r--r--tests/bugs150/pr113630/propertyChanger.java10
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml5
8 files changed, 179 insertions, 0 deletions
diff --git a/tests/bugs150/pr113630/Bean.java b/tests/bugs150/pr113630/Bean.java
new file mode 100644
index 000000000..fafad796c
--- /dev/null
+++ b/tests/bugs150/pr113630/Bean.java
@@ -0,0 +1,17 @@
+package com.blueprint.util.aspectj5.test;
+
+import java.io.Serializable;
+
+@javaBean()
+public class Bean implements Serializable{
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+ @propertyChanger()
+ public void setName( String name ) {
+ this.name = name;
+ }
+} \ No newline at end of file
diff --git a/tests/bugs150/pr113630/BeanSupportAspectj.aj b/tests/bugs150/pr113630/BeanSupportAspectj.aj
new file mode 100644
index 000000000..8262ad6bf
--- /dev/null
+++ b/tests/bugs150/pr113630/BeanSupportAspectj.aj
@@ -0,0 +1,10 @@
+/**
+ *
+ */
+package com.blueprint.util.aspectj5.test;
+
+import com.blueprint.util.aspectj5.test.PropertySupportAspect5.PropertySupport;
+
+public aspect BeanSupportAspectj {
+ declare parents: @javaBean * implements PropertySupport;
+}
diff --git a/tests/bugs150/pr113630/BeanTestCase.java b/tests/bugs150/pr113630/BeanTestCase.java
new file mode 100644
index 000000000..0df22721a
--- /dev/null
+++ b/tests/bugs150/pr113630/BeanTestCase.java
@@ -0,0 +1,34 @@
+package com.blueprint.util.aspectj5.test;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import junit.framework.TestCase;
+
+public class BeanTestCase extends TestCase implements PropertyChangeListener{
+
+ public void setUp() throws Exception{
+ super.setUp();
+ }
+
+ public void TearDown() throws Exception{
+ super.setUp();
+ }
+
+ public void propertyChange(PropertyChangeEvent e){
+ System.out.println("Property [" + e.getPropertyName() + "[ changed from " +
+ e.getOldValue() + " to " + e.getNewValue() );
+ }
+
+ public static void main(String [] argv) {
+ new BeanTestCase().testPropertyChange();
+ }
+ public void testPropertyChange(){
+ Bean b = new Bean();
+ b.addPropertyChangeListener( "name", this );
+ b.setName( "Test" );
+ assertEquals( b.getName() , "Test" );
+ b.setName( "Test1" );
+ assertEquals( b.getName() , "Test1" );
+ }
+}
diff --git a/tests/bugs150/pr113630/PropertySupportAspect5.aj b/tests/bugs150/pr113630/PropertySupportAspect5.aj
new file mode 100644
index 000000000..10e4388c5
--- /dev/null
+++ b/tests/bugs150/pr113630/PropertySupportAspect5.aj
@@ -0,0 +1,90 @@
+package com.blueprint.util.aspectj5.test;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.lang.reflect.Field;
+import org.aspectj.lang.Signature;
+
+public aspect PropertySupportAspect5 {
+
+ PropertyChangeSupport PropertySupport.support = new PropertyChangeSupport(this);
+
+ public interface PropertySupport{
+ public void addPropertyChangeListener( PropertyChangeListener listener );
+ public void addPropertyChangeListener( String propertyName,
+ PropertyChangeListener listener );
+ public void removePropertyChangeListener( String propertyName,
+ PropertyChangeListener listener );
+ public void removePropertyChangeListener( PropertyChangeListener listener );
+ public void hasListeners( String propertyName );
+ public void firePropertyChange( Bean b,
+ String property,
+ String oldval,
+ String newval );
+ }
+
+ public void PropertySupport.addPropertyChangeListener(PropertyChangeListener listener){
+ support.addPropertyChangeListener(listener);
+ }
+
+ public void PropertySupport.addPropertyChangeListener( String propertyName,
+ PropertyChangeListener listener){
+
+ support.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void PropertySupport.removePropertyChangeListener( String propertyName,
+ PropertyChangeListener listener) {
+ support.removePropertyChangeListener(propertyName, listener);
+ }
+
+ public void PropertySupport.removePropertyChangeListener(PropertyChangeListener listener) {
+ support.removePropertyChangeListener(listener);
+ }
+
+ public void PropertySupport.hasListeners(String propertyName) {
+ support.hasListeners(propertyName);
+ }
+
+ pointcut callSetter( Bean b )
+ : call( @propertyChanger * *(..) ) && target( b );
+
+ void around( Bean b ) : callSetter( b ) {
+ String propertyName = getField( thisJoinPointStaticPart.getSignature() ).
+ getName();
+ System.out.println( "The property is [" + propertyName + "]" );
+ String oldValue = b.getName();
+ proceed( b );
+ b.firePropertyChange( b, propertyName, oldValue, b.getName());
+ }
+
+ private Field getField( Signature signature ){
+ Field field = null;
+ System.out.println( "Getting the field name of [" +signature.getName() + "]" );
+
+ try{
+ String methodName = signature.getName();
+ field = signature.getDeclaringType().
+ getDeclaredField( methodName.
+ substring( 3,
+ methodName.length() ).
+ toLowerCase());
+ field.setAccessible(true);
+ }catch( NoSuchFieldException nsfe ){
+ nsfe.printStackTrace();
+ }
+ return field;
+ }
+
+ public void PropertySupport.firePropertyChange( Bean b,
+ String property,
+ String oldval,
+ String newval) {
+ System.out.println( "The property is [" + property + "]");
+ System.out.println( "The old value is [" + oldval + "]");
+ System.out.println( "The new value is [" + newval + "]");
+ b.support.firePropertyChange( property,
+ ( oldval == null ) ? oldval : new String(oldval),
+ new String(newval));
+ }
+} \ No newline at end of file
diff --git a/tests/bugs150/pr113630/javaBean.java b/tests/bugs150/pr113630/javaBean.java
new file mode 100644
index 000000000..ae2663ecc
--- /dev/null
+++ b/tests/bugs150/pr113630/javaBean.java
@@ -0,0 +1,9 @@
+package com.blueprint.util.aspectj5.test;
+
+import java.lang.annotation.*;
+import java.lang.*;
+
+@Retention(RetentionPolicy.SOURCE)
+@Target({ ElementType.TYPE })
+public @interface javaBean {
+}
diff --git a/tests/bugs150/pr113630/propertyChanger.java b/tests/bugs150/pr113630/propertyChanger.java
new file mode 100644
index 000000000..9fb87b5b6
--- /dev/null
+++ b/tests/bugs150/pr113630/propertyChanger.java
@@ -0,0 +1,10 @@
+package com.blueprint.util.aspectj5.test;
+
+import java.lang.annotation.*;
+import java.lang.*;
+
+@Retention( RetentionPolicy.RUNTIME )
+@Target({ ElementType.METHOD })
+public @interface propertyChanger {
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
index b61e75437..28ac28c5e 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/GenericsTests.java
@@ -217,6 +217,10 @@ public class GenericsTests extends XMLBasedAjcTestCase {
public void testGenericsBang_pr95993() {
runTest("NPE at ClassScope.java:660 when compiling generic class");
}
+
+// public void testIncompatibleClassChangeError_pr113630() {
+// runTest("IncompatibleClassChangeError");
+// }
// generic aspects
public void testPR96220_GenericAspects1() {runTest("generic aspects - 1");}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 703204ab0..c825b5c95 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -10,6 +10,11 @@
<ajc-test dir="bugs150" title="Problem with constructor ITDs">
<compile files="pr112783.aj" options="-1.5"/>
</ajc-test>
+
+ <ajc-test dir="bugs150/pr113630" title="IncompatibleClassChangeError">
+ <compile files="Bean.java,BeanSupportAspectj.aj,BeanTestCase.java,javaBean.java,propertyChanger.java,PropertySupportAspect5.aj" options="-1.5"/>
+ <run class="com.blueprint.util.aspectj5.test.BeanTestCase"/>
+ </ajc-test>
<ajc-test dir="bugs150" title="Generics ClassCastException">
<compile files="pr113445.aj" options="-1.5,-emacssym"/>