diff options
author | aclement <aclement> | 2006-06-03 08:27:06 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-06-03 08:27:06 +0000 |
commit | f821ca3dae5681758d23a2a0531d0d42f017152e (patch) | |
tree | 3491c922fb391517009f0ffec94535bbbdaa9a77 /runtime/testsrc | |
parent | 73d96a5cf3bb38a2fbda7f8ae00a7725c9728ec6 (diff) | |
download | aspectj-f821ca3dae5681758d23a2a0531d0d42f017152e.tar.gz aspectj-f821ca3dae5681758d23a2a0531d0d42f017152e.zip |
test and fix for 145086
Diffstat (limited to 'runtime/testsrc')
-rw-r--r-- | runtime/testsrc/org/aspectj/runtime/reflect/JoinPointImplTest.java | 2 | ||||
-rw-r--r-- | runtime/testsrc/org/aspectj/runtime/reflect/SignatureTest.java | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/runtime/testsrc/org/aspectj/runtime/reflect/JoinPointImplTest.java b/runtime/testsrc/org/aspectj/runtime/reflect/JoinPointImplTest.java index 98a5a2374..2a17ad998 100644 --- a/runtime/testsrc/org/aspectj/runtime/reflect/JoinPointImplTest.java +++ b/runtime/testsrc/org/aspectj/runtime/reflect/JoinPointImplTest.java @@ -15,8 +15,6 @@ import junit.framework.TestCase; /** * @author colyer * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates */ public class JoinPointImplTest extends TestCase { diff --git a/runtime/testsrc/org/aspectj/runtime/reflect/SignatureTest.java b/runtime/testsrc/org/aspectj/runtime/reflect/SignatureTest.java index 6cb43f7e0..7a66a5b39 100644 --- a/runtime/testsrc/org/aspectj/runtime/reflect/SignatureTest.java +++ b/runtime/testsrc/org/aspectj/runtime/reflect/SignatureTest.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.aspectj.runtime.reflect; +import java.lang.ref.Reference; +import java.lang.reflect.Field; + import junit.framework.TestCase; /** @@ -31,4 +34,24 @@ public class SignatureTest extends TestCase { assertSame(longString,msi.toLongString()); // should be cached. assertTrue("String representations should be different",!(shortString.equals(middleString) || middleString.equals(longString) || longString.equals(shortString))); } + + public void testClearCache() throws Exception { + MethodSignatureImpl msi = new MethodSignatureImpl(0,"test",SignatureTest.class,new Class[] { String.class, Integer.TYPE }, new String[] { "s", "i" }, new Class[] {}, Runnable.class); + String shortString = msi.toShortString(); + assertSame(shortString,msi.toShortString()); + + Field field = SignatureImpl.class.getDeclaredField("stringCache"); + field.setAccessible(true); + Object res = field.get(msi); + + field = res.getClass().getDeclaredField("toStringCacheRef"); + field.setAccessible(true); + Reference ref = (Reference)field.get(res); + + ref.clear(); + assertEquals(shortString,msi.toShortString()); + + String longString = msi.toLongString(); + assertSame(longString,msi.toLongString()); // should be cached. + } } |