diff options
author | aclement <aclement> | 2007-11-28 11:19:32 +0000 |
---|---|---|
committer | aclement <aclement> | 2007-11-28 11:19:32 +0000 |
commit | 646b77427bf44ec097829a18ec4336bcd7b2e67f (patch) | |
tree | 770f5411708c1d4a37cbf030757ab3f40bbfd0fa /tests/bugs154/pr176991/AspectJBugTestCase.java | |
parent | 3d5c7ab0bff432c50f2634e6c149aa1e640786fc (diff) | |
download | aspectj-646b77427bf44ec097829a18ec4336bcd7b2e67f.tar.gz aspectj-646b77427bf44ec097829a18ec4336bcd7b2e67f.zip |
testcode for 162539 and 176991
Diffstat (limited to 'tests/bugs154/pr176991/AspectJBugTestCase.java')
-rw-r--r-- | tests/bugs154/pr176991/AspectJBugTestCase.java | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/tests/bugs154/pr176991/AspectJBugTestCase.java b/tests/bugs154/pr176991/AspectJBugTestCase.java new file mode 100644 index 000000000..9b9b27d78 --- /dev/null +++ b/tests/bugs154/pr176991/AspectJBugTestCase.java @@ -0,0 +1,91 @@ +package com.ihg.dec.framework.commons.utils.cow; + +import java.util.AbstractSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.Map.Entry; + +public class AspectJBugTestCase { + class Value<V> { + private V value; + public Value(V value) { + this.value = value; + } + public V getValue() { + return value; + } + public void setValue(V value) { + this.value = value; + } + } + + class EntrySetEntry<K, V> implements Entry<K, V> { + private Entry<K, Value<V>> wrapped; + + public EntrySetEntry(Entry<K, Value<V>> wrapped) { + this.wrapped = wrapped; + } + + public K getKey() { + return wrapped.getKey(); + } + + public V getValue() { + return wrapped.getValue().getValue(); + } + + public V setValue(V value) { + Value<V> old = wrapped.setValue(new Value<V>(value)); + return old == null ? null : old.getValue(); + } + + } + + class EntrySetIterator<K, V> implements Iterator<Entry<K, V>> { + private Iterator<Entry<K, Value<V>>> wrapped; + + public EntrySetIterator(Iterator<Entry<K, Value<V>>> wrapped) { + this.wrapped = wrapped; + } + + public boolean hasNext() { + return wrapped.hasNext(); + } + + public Entry<K, V> next() { + return new EntrySetEntry<K, V>(wrapped.next()); + } + + public void remove() { + throw new UnsupportedOperationException("Not implemented."); + } + } + + class EntrySet<K, V> extends AbstractSet<Entry<K, V>> implements + Set<Entry<K, V>> { + private Set<Entry<K, Value<V>>> wrapped; + + public EntrySet(Set<Entry<K, Value<V>>> wrapped) { + this.wrapped = wrapped; + } + + @Override + public Iterator<Entry<K, V>> iterator() { + return new EntrySetIterator<K, V>(wrapped.iterator()); + } + + @Override + public int size() { + return wrapped.size(); + } + } + + public void testIt() { + new EntrySet<String, String>( new HashSet<Entry<String, Value<String>>>()); + } +} + +aspect X { + declare parents: *.Entry* implements java.io.Serializable; +} |