]> source.dussan.org Git - aspectj.git/commitdiff
change all relevant DataOutputStream usage to use CompressingDataOutputStream
authoraclement <aclement>
Tue, 18 May 2010 16:20:15 +0000 (16:20 +0000)
committeraclement <aclement>
Tue, 18 May 2010 16:20:15 +0000 (16:20 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java
weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java
weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java

index 8ca8ae963926094a1e9b63d9e993263ccbf9fabb..b4448162125b6d991e019d16db06f92e6bf7ecf5 100644 (file)
@@ -9,7 +9,6 @@
 package org.aspectj.weaver.bcel;
 
 import java.io.ByteArrayInputStream;
-import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
@@ -54,6 +53,7 @@ import org.aspectj.weaver.AdviceKind;
 import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.AnnotationOnTypeMunger;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ConcreteTypeMunger;
 import org.aspectj.weaver.CrosscuttingMembersSet;
 import org.aspectj.weaver.CustomMungerFactory;
@@ -1884,7 +1884,7 @@ public class BcelWeaver {
                }
        }
 
-       public void write(DataOutputStream dos) throws IOException {
+       public void write(CompressingDataOutputStream dos) throws IOException {
                xcutSet.write(dos);
        }
 
index 3d0e2edbd70527b018d90648ca7419d3c60de846..4f25936b2a40b53e513e6f75c22245e13963280c 100644 (file)
@@ -14,11 +14,11 @@ package org.aspectj.weaver.bcel;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.VersionedDataInputStream;
@@ -106,7 +106,7 @@ public class PatternWeaveTestCase extends WeaveTestCase {
 
        public void checkSerialize(Pointcut p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
 
index 14b5240e39398bb53666db39a63d95aa53382ebe..f0432ffa3b8a044c83380ba28c71238a9b0d5f64 100644 (file)
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.bcel;
 
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.lang.reflect.Modifier;
-import java.util.*;
-
-import org.aspectj.weaver.*;
-import org.aspectj.weaver.patterns.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.aspectj.weaver.AdviceKind;
+import org.aspectj.weaver.CompressingDataOutputStream;
+import org.aspectj.weaver.CrosscuttingMembers;
+import org.aspectj.weaver.MemberImpl;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.ShadowMunger;
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.VersionedDataInputStream;
+import org.aspectj.weaver.patterns.Pointcut;
+import org.aspectj.weaver.patterns.SimpleScope;
 
 public class PointcutResidueTestCase extends WeaveTestCase {
        {
                regenerate = false;
        }
+
        public PointcutResidueTestCase(String name) {
                super(name);
        }
-               
-    String[] none = new String[0];
-    
-    
-    // -----
-    
-    
-    
-    
-    
-    // ----   
-    
-    
-       
+
+       String[] none = new String[0];
+
+       // -----
+
+       // ----
+
        public void testArgResidue1() throws IOException {
-               checkMultiArgWeave(
-                       "StringResidue1", 
-                       "call(* *(java.lang.Object, java.lang.Object)) && args(java.lang.String, java.lang.String)");
+               checkMultiArgWeave("StringResidue1",
+                               "call(* *(java.lang.Object, java.lang.Object)) && args(java.lang.String, java.lang.String)");
        }
-       
+
        public void testArgResidue2() throws IOException {
-               checkMultiArgWeave(
-                       "StringResidue2", 
-                       "call(* *(java.lang.Object, java.lang.Object)) && args(.., java.lang.String)");
-       }
-    public void testArgResidue3() throws IOException {
-               checkMultiArgWeave(
-                       "StringResidue3", 
-                       "call(* *(java.lang.Object, java.lang.Object)) && args(java.lang.String, ..)");
-       }       
-       
-       // BETAX this is a beta feature.    
-//    public void testArgResidue4() throws IOException {
-//        checkMultiArgWeave(
-//            "StringResidue4",
-//            "call(* *(java.lang.Object, java.lang.Object)) && args(.., java.lang.String, ..)");
-//    }
-    
-    public void testMultiArgState() throws IOException {
-        checkWeave(
-            "StateResidue",
-            "MultiArgHelloWorld",
-            "call(* *(java.lang.Object, java.lang.Object)) && args(s, ..)",
-            new String[] { "java.lang.String" },
-            new String[] { "s" });
-        checkWeave(
-            "StateResidue",
-            "MultiArgHelloWorld",
-            "call(* *(java.lang.Object, java.lang.Object)) && args(s, *)",
-            new String[] { "java.lang.String" },
-            new String[] { "s" });
-    }
+               checkMultiArgWeave("StringResidue2", "call(* *(java.lang.Object, java.lang.Object)) && args(.., java.lang.String)");
+       }
 
+       public void testArgResidue3() throws IOException {
+               checkMultiArgWeave("StringResidue3", "call(* *(java.lang.Object, java.lang.Object)) && args(java.lang.String, ..)");
+       }
 
+       // BETAX this is a beta feature.
+       // public void testArgResidue4() throws IOException {
+       // checkMultiArgWeave(
+       // "StringResidue4",
+       // "call(* *(java.lang.Object, java.lang.Object)) && args(.., java.lang.String, ..)");
+       // }
+
+       public void testMultiArgState() throws IOException {
+               checkWeave("StateResidue", "MultiArgHelloWorld", "call(* *(java.lang.Object, java.lang.Object)) && args(s, ..)",
+                               new String[] { "java.lang.String" }, new String[] { "s" });
+               checkWeave("StateResidue", "MultiArgHelloWorld", "call(* *(java.lang.Object, java.lang.Object)) && args(s, *)",
+                               new String[] { "java.lang.String" }, new String[] { "s" });
+       }
 
        public void testAdd() throws IOException {
                checkDynamicWeave("AddResidue", "call(public * add(..)) && target(java.util.ArrayList)");
                checkDynamicWeave("AddResidue", "call(public * add(..)) && (target(java.util.ArrayList) || target(java.lang.String))");
-               checkDynamicWeave("AddResidue", "call(public * add(..)) && this(java.io.Serializable) && target(java.util.ArrayList) && !this(java.lang.Integer)");
-       }       
-       
+               checkDynamicWeave("AddResidue",
+                               "call(public * add(..)) && this(java.io.Serializable) && target(java.util.ArrayList) && !this(java.lang.Integer)");
+       }
+
        public void testNot() throws IOException {
                checkDynamicWeave("AddNotResidue", "call(public * add(..)) && !target(java.util.ArrayList)");
                checkDynamicWeave("AddNotResidue", "call(public * add(..)) && !(target(java.util.ArrayList) || target(java.lang.String)) ");
                checkDynamicWeave("AddNotResidue", "call(public * add(..)) && target(java.lang.Object) && !target(java.util.ArrayList)");
        }
 
-    public void testState() throws IOException {
-        checkWeave(
-            "AddStateResidue",
-            "DynamicHelloWorld",
-            "call(public * add(..)) && target(list)",
-            new String[] { "java.util.ArrayList" },
-            new String[] { "list" });
-        checkWeave(
-            "AddStateResidue",
-            "DynamicHelloWorld",
-            "target(foo) && !target(java.lang.Integer) && call(public * add(..))",
-            new String[] { "java.util.ArrayList" },
-            new String[] { "foo" });
-        checkDynamicWeave(
-            "AddResidue",
-            "call(public * add(..)) && (target(java.util.ArrayList) || target(java.lang.String))");
-        checkDynamicWeave(
-            "AddResidue",
-            "call(public * add(..)) && this(java.io.Serializable) && target(java.util.ArrayList) && !this(java.lang.Integer)");
-    }
-       
+       public void testState() throws IOException {
+               checkWeave("AddStateResidue", "DynamicHelloWorld", "call(public * add(..)) && target(list)",
+                               new String[] { "java.util.ArrayList" }, new String[] { "list" });
+               checkWeave("AddStateResidue", "DynamicHelloWorld", "target(foo) && !target(java.lang.Integer) && call(public * add(..))",
+                               new String[] { "java.util.ArrayList" }, new String[] { "foo" });
+               checkDynamicWeave("AddResidue", "call(public * add(..)) && (target(java.util.ArrayList) || target(java.lang.String))");
+               checkDynamicWeave("AddResidue",
+                               "call(public * add(..)) && this(java.io.Serializable) && target(java.util.ArrayList) && !this(java.lang.Integer)");
+       }
+
        public void testNoResidueArgs() throws IOException {
                checkDynamicWeave("NoResidue", "call(public * add(..)) && args(java.lang.Object)");
                checkDynamicWeave("NoResidue", "call(public * add(..)) && args(*)");
@@ -122,114 +102,85 @@ public class PointcutResidueTestCase extends WeaveTestCase {
        }
 
        // ---- cflow tests
-       
-    public void testCflowState() throws IOException {
-        checkWeave(
-            "CflowStateResidue",
-            "DynamicHelloWorld",
-            "cflow(call(public * add(..)) && target(list)) && execution(public void main(..))",
-            new String[] { "java.util.ArrayList" },
-            new String[] { "list" });
-//        checkWeave(
-//            "CflowStateResidue",
-//            "DynamicHelloWorld",
-//            "cflow(call(public * add(..)) && target(list)) && this(obj) && execution(public void doit(..))",
-//            new String[] { "java.lang.Object", "java.util.ArrayList" },
-//            new String[] { "obj", "list" });
-//        checkWeave(
-//            "AddStateResidue",
-//            "DynamicHelloWorld",
-//            "target(foo) && !target(java.lang.Integer) && call(public * add(..))",
-//            new String[] { "java.util.ArrayList" },
-//            new String[] { "foo" });
-//        checkDynamicWeave(
-//            "AddResidue",
-//            "call(public * add(..)) && (target(java.util.ArrayList) || target(java.lang.String))");
-//        checkDynamicWeave(
-//            "AddResidue",
-//            "call(public * add(..)) && this(java.io.Serializable) && target(java.util.ArrayList) && !this(java.lang.Integer)");
-    }
-       
-
-
 
+       public void testCflowState() throws IOException {
+               checkWeave("CflowStateResidue", "DynamicHelloWorld",
+                               "cflow(call(public * add(..)) && target(list)) && execution(public void main(..))",
+                               new String[] { "java.util.ArrayList" }, new String[] { "list" });
+               // checkWeave(
+               // "CflowStateResidue",
+               // "DynamicHelloWorld",
+               // "cflow(call(public * add(..)) && target(list)) && this(obj) && execution(public void doit(..))",
+               // new String[] { "java.lang.Object", "java.util.ArrayList" },
+               // new String[] { "obj", "list" });
+               // checkWeave(
+               // "AddStateResidue",
+               // "DynamicHelloWorld",
+               // "target(foo) && !target(java.lang.Integer) && call(public * add(..))",
+               // new String[] { "java.util.ArrayList" },
+               // new String[] { "foo" });
+               // checkDynamicWeave(
+               // "AddResidue",
+               // "call(public * add(..)) && (target(java.util.ArrayList) || target(java.lang.String))");
+               // checkDynamicWeave(
+               // "AddResidue",
+               // "call(public * add(..)) && this(java.io.Serializable) && target(java.util.ArrayList) && !this(java.lang.Integer)");
+       }
 
        // ----
-       
-    private void checkDynamicWeave(String label, String pointcutSource) throws IOException {
+
+       private void checkDynamicWeave(String label, String pointcutSource) throws IOException {
                checkWeave(label, "DynamicHelloWorld", pointcutSource, new String[0], new String[0]);
        }
-       
-    private void checkMultiArgWeave(String label, String pointcutSource) throws IOException {
+
+       private void checkMultiArgWeave(String label, String pointcutSource) throws IOException {
                checkWeave(label, "MultiArgHelloWorld", pointcutSource, new String[0], new String[0]);
-       }               
-       
-    private void checkWeave(
-        String label,
-        String filename,
-        String pointcutSource,
-        String[] formalTypes,
-        String[] formalNames)
-        throws IOException 
-    {
-        final Pointcut sp = Pointcut.fromString(pointcutSource);
-        final Pointcut rp =
-            sp.resolve(
-               new SimpleScope(
-               world,
-                SimpleScope.makeFormalBindings(UnresolvedType.forNames(formalTypes),
-                formalNames)
-                ));
-
-        ShadowMunger pp =
-            new BcelAdvice(
-                AdviceKind.Before,
-                rp,
-                MemberImpl.method(
-                    UnresolvedType.forName("Aspect"),
-                    Modifier.STATIC,
-                    "ajc_before_0",
-                    MemberImpl.typesToSignature(
-                        ResolvedType.VOID,
-                        UnresolvedType.forNames(formalTypes),false)),
-               0, -1, -1, null, null);
+       }
+
+       private void checkWeave(String label, String filename, String pointcutSource, String[] formalTypes, String[] formalNames)
+                       throws IOException {
+               final Pointcut sp = Pointcut.fromString(pointcutSource);
+               final Pointcut rp = sp.resolve(new SimpleScope(world, SimpleScope.makeFormalBindings(UnresolvedType.forNames(formalTypes),
+                               formalNames)));
+
+               ShadowMunger pp = new BcelAdvice(AdviceKind.Before, rp, MemberImpl.method(UnresolvedType.forName("Aspect"),
+                               Modifier.STATIC, "ajc_before_0", MemberImpl.typesToSignature(ResolvedType.VOID, UnresolvedType
+                                               .forNames(formalTypes), false)), 0, -1, -1, null, null);
 
                ResolvedType inAspect = world.resolve("Aspect");
-               CrosscuttingMembers xcut = new CrosscuttingMembers(inAspect,true);
+               CrosscuttingMembers xcut = new CrosscuttingMembers(inAspect, true);
                inAspect.crosscuttingMembers = xcut;
-               
-        ShadowMunger cp = pp.concretize(inAspect, world, null);
-        
-        xcut.addConcreteShadowMunger(cp);
-        
-        //System.out.println("extras: " + inAspect.getExtraConcreteShadowMungers());
-//        List advice = new ArrayList();
-//        advice.add(cp);
-//        advice.addAll(inAspect.getExtraConcreteShadowMungers());
-        weaveTest(new String[] { filename }, label, xcut.getShadowMungers());
-
-        checkSerialize(rp);
-    }
-       
-       public void weaveTest(String name, String outName, ShadowMunger planner) throws IOException {
-        List l = new ArrayList(1);
-        l.add(planner);
-        weaveTest(name, outName, l);
-    }
 
+               ShadowMunger cp = pp.concretize(inAspect, world, null);
+
+               xcut.addConcreteShadowMunger(cp);
+
+               // System.out.println("extras: " + inAspect.getExtraConcreteShadowMungers());
+               // List advice = new ArrayList();
+               // advice.add(cp);
+               // advice.addAll(inAspect.getExtraConcreteShadowMungers());
+               weaveTest(new String[] { filename }, label, xcut.getShadowMungers());
+
+               checkSerialize(rp);
+       }
+
+       public void weaveTest(String name, String outName, ShadowMunger planner) throws IOException {
+               List l = new ArrayList(1);
+               l.add(planner);
+               weaveTest(name, outName, l);
+       }
 
        public void checkSerialize(Pointcut p) throws IOException {
                ByteArrayOutputStream bo = new ByteArrayOutputStream();
-               DataOutputStream out = new DataOutputStream(bo);
+               CompressingDataOutputStream out = new CompressingDataOutputStream(bo);
                p.write(out);
                out.close();
-               
+
                ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
                VersionedDataInputStream in = new VersionedDataInputStream(bi);
                Pointcut newP = Pointcut.read(in, null);
-               
-               assertEquals("write/read", p, newP);    
-       }
 
+               assertEquals("write/read", p, newP);
+       }
 
 }
index 0ac1ca7042252964f0bdf56aeadeeb9496c8d2ed..d0b4c255182d1495a958c2f6e9d785f505c3d1a4 100644 (file)
@@ -13,12 +13,12 @@ package org.aspectj.weaver.patterns;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 
 import junit.framework.TestCase;
 
 import org.aspectj.weaver.BoundedReferenceType;
+import org.aspectj.weaver.CompressingDataOutputStream;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.TypeFactory;
 import org.aspectj.weaver.UnresolvedType;
@@ -29,445 +29,395 @@ import org.aspectj.weaver.bcel.BcelWorld;
 
 // TODO write test cases for instanceof matching
 
- public class WildTypePatternResolutionTestCase extends TestCase {
-
-        private World world;
-        private Bindings bindings;
-        private SimpleScope scope;
-        private ResolvedType javaUtilList;
-        private ResolvedType javaLangString;
-        private ResolvedType javaUtilListOfString;
-        private ResolvedType javaUtilListOfDouble;
-        private ResolvedType javaUtilListOfSomething;
-        
-        /**
-         * Foo where Foo exists and is generic
-         *    Parser creates WildTypePattern namePatterns={Foo}
-         *    resolveBindings resolves Foo to RT(Foo - raw)
-         *                    return ExactTypePattern(LFoo;)
-         */
-        public void testSimpleFoo() {
-                TypePattern rtp = resolveWildTypePattern("List", false);
-                
-                assertTrue("resolves to exact type",rtp instanceof ExactTypePattern);
-                UnresolvedType exactType = rtp.getExactType();
-                assertTrue(exactType.isRawType());
-                assertEquals("Ljava/util/List;",exactType.getSignature());
-                
-                ResolvedType rt = exactType.resolve(world);
-                assertEquals("Ljava/util/List;",rt.getSignature());
-                assertTrue(rt.isRawType());
-                
-                ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
-                exactType = etp.getExactType();
-
-                assertEquals("Ljava/util/List;",exactType.getSignature());
-                
-                rt = exactType.resolve(world);
-                assertEquals("Ljava/util/List;",rt.getSignature());
-                assertTrue(rt.isRawType());             
-                
-                assertTrue("matches List",etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertTrue("matches generic List",etp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertTrue("matches parameterized list",etp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",etp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());
-        }
-        
-        /**
-         * Foo<String> where Foo exists and String meets the bounds
-         *    Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{String}
-         *    resolveBindings resolves typeParameters to ExactTypePattern(String)
-         *                    resolves Foo to RT(Foo)
-         *                    returns ExactTypePattern(PFoo<String>; - parameterized)
-         */
-        public void testParameterized() {
-                TypePattern rtp = resolveWildTypePattern("List<String>", false);
-                
-                assertTrue("resolves to exact type",rtp instanceof ExactTypePattern);
-                UnresolvedType exactType = rtp.getExactType();
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<Ljava/lang/String;>;",exactType.getSignature());
-                
-                ResolvedType rt = exactType.resolve(world);
-                assertEquals("Pjava/util/List<Ljava/lang/String;>;",rt.getSignature());
-                assertTrue(rt.isParameterizedType());
-
-                ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
-                exactType = etp.getExactType();
-
-                assertEquals("Pjava/util/List<Ljava/lang/String;>;",rt.getSignature());
-                assertTrue(rt.isParameterizedType());
-
-                rt = exactType.resolve(world);
-                assertEquals("Pjava/util/List<Ljava/lang/String;>;",rt.getSignature());
-                assertTrue(rt.isParameterizedType());
-
-                assertFalse("does not match List",etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",etp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertTrue("matches parameterized list",etp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",etp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",etp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());
-
-        }
-        
-        /**
-         * Foo<Str*> where Foo exists and takes one bound
-         *    Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{Str*}
-         *    resolveBindings resolves typeParameters to WTP{Str*}
-         *                    resolves Foo to RT(Foo)
-         *                    returns WildTypePattern(name = Foo, typeParameters = WTP{Str*} isGeneric=false)                    
-         */
-        public void testParameterizedWildCard() {
-                TypePattern rtp = resolveWildTypePattern("List<Str*>", false);
-                
-                assertTrue("resolves to WildTypePattern",rtp instanceof WildTypePattern);
-                assertTrue("one type parameter", rtp.typeParameters.size() == 1);
-                assertTrue("missing",ResolvedType.isMissing(rtp.getExactType()));
-                
-                WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
-                assertTrue("one type parameter", wtp.typeParameters.size() == 1);
-                assertTrue("missing",ResolvedType.isMissing(wtp.getExactType()));
-                assertEquals("Str*",wtp.getTypeParameters().getTypePatterns()[0].toString());
-                
-                assertFalse("does not match List",wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",wtp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertTrue("matches parameterized list",wtp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",wtp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",wtp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());               
-        }
-        
-        /**
-         * Fo*<String> 
-         *    Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{String}
-         *    resolveBindings resolves typeParameters to ETP{String}
-         *                    returns WildTypePattern(name = Fo*, typeParameters = ETP{String} isGeneric=false)                    
-         */
-        public void testWildcardParameterized() {
-                TypePattern rtp = resolveWildTypePattern("Li*<String>", false);
-                
-                assertTrue("resolves to WildTypePattern",rtp instanceof WildTypePattern);
-                assertTrue("one type parameter", rtp.typeParameters.size() == 1);
-                assertEquals("Ljava/lang/String;",rtp.typeParameters.getTypePatterns()[0].getExactType().getSignature());
-                
-                WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
-                assertTrue("one type parameter", wtp.typeParameters.size() == 1);
-                assertEquals("Ljava/lang/String;",wtp.typeParameters.getTypePatterns()[0].getExactType().getSignature());
-                
-                assertFalse("does not match List",wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",wtp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertTrue("matches parameterized list",wtp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",wtp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",wtp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());                                               
-        }
-        
-        /**
-         * Foo<?>
-         */
-        public void testSomething() {
-                TypePattern rtp = resolveWildTypePattern("List<?>", false);
-
-                assertTrue("resolves to exact type",rtp instanceof ExactTypePattern);
-                UnresolvedType exactType = rtp.getExactType();
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<*>;",exactType.getSignature());
-
-                ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
-                exactType = etp.getExactType();
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<*>;",exactType.getSignature());
-
-                assertFalse("does not match List",etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",etp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list",etp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",etp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",etp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());                                               
-               
-                assertTrue("matches list of something",etp.matches(javaUtilListOfSomething,TypePattern.STATIC).alwaysTrue());
-        }
-        
-        /**
-         * Foo<? extends Number>
-         */
-        public void testSomethingExtends() {
-                TypePattern rtp = resolveWildTypePattern("List<? extends Number>", false);
-
-                assertTrue("resolves to exact type",rtp instanceof ExactTypePattern);
-                UnresolvedType exactType = rtp.getExactType();
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<+Ljava/lang/Number;>;",exactType.getSignature());
-                assertTrue("got a bounded reference type",exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
-                ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
-                exactType = etp.getExactType();
-                exactType = exactType.resolve(world);
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<+Ljava/lang/Number;>;",exactType.getSignature());
-                assertTrue("got a bounded reference type",exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
-                assertFalse("does not match List",etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",etp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list",etp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",etp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",etp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());                                               
-                assertFalse("does not match list of something",etp.matches(javaUtilListOfSomething,TypePattern.STATIC).alwaysTrue());
-                
-                ResolvedType listOfNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Number").resolve(world)}, 
-                                               world);
-                
-                ResolvedType listOfDouble = 
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Double").resolve(world)}, 
-                                               world);
-                        
-                assertFalse("does not match list of number",etp.matches(listOfNumber,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match list of double",etp.matches(listOfDouble,TypePattern.STATIC).alwaysTrue());
-
-                ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
-                ResolvedType listOfExtendsNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {extendsNumber}, 
-                                               world);
-
-                assertTrue("matches list of ? extends number",etp.matches(listOfExtendsNumber,TypePattern.STATIC).alwaysTrue());
-
-        }
-        
-        /** 
-         * Foo<? extends Number+>
-         */
-        public void testSomethingExtendsPattern() {
-                TypePattern rtp = resolveWildTypePattern("List<? extends Number+>", false);
-
-                assertTrue("resolves to wild type pattern",rtp instanceof WildTypePattern);
-                assertEquals("one type parameter",1,rtp.getTypeParameters().size());
-                TypePattern tp = rtp.getTypeParameters().getTypePatterns()[0];
-                assertTrue("parameter is wild",tp instanceof WildTypePattern);
-                WildTypePattern tpwtp = (WildTypePattern) tp;
-                assertEquals("?",tpwtp.getNamePatterns()[0].maybeGetSimpleName());
-                assertEquals("java.lang.Number+",tpwtp.upperBound.toString());
-                
-                
-                WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
-                assertEquals("one type parameter",1,wtp.getTypeParameters().size());
-                tp = rtp.getTypeParameters().getTypePatterns()[0];
-                assertTrue("parameter is wild",tp instanceof WildTypePattern);
-                tpwtp = (WildTypePattern) tp;
-                assertEquals("?",tpwtp.getNamePatterns()[0].maybeGetSimpleName());
-                assertEquals("java.lang.Number+",tpwtp.upperBound.toString());
-                
-                assertFalse("does not match List",wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",wtp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list",wtp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",wtp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",wtp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());                                               
-                assertFalse("does not match list of something",wtp.matches(javaUtilListOfSomething,TypePattern.STATIC).alwaysTrue());
-                
-                ResolvedType listOfNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Number").resolve(world)}, 
-                                               world);
-                
-                ResolvedType listOfDouble = 
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Double").resolve(world)}, 
-                                               world);
-                        
-                assertFalse("does not match list of number",wtp.matches(listOfNumber,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match list of double",wtp.matches(listOfDouble,TypePattern.STATIC).alwaysTrue());
-
-                ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
-                ResolvedType listOfExtendsNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {extendsNumber}, 
-                                               world);
-
-                assertTrue("matches list of ? extends number",wtp.matches(listOfExtendsNumber,TypePattern.STATIC).alwaysTrue());                
-
-                ResolvedType extendsDouble = TypeFactory.createTypeFromSignature("+Ljava/lang/Double;").resolve(world);
-                ResolvedType listOfExtendsDouble =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {extendsDouble}, 
-                                               world);
-
-                assertTrue("matches list of ? extends double",wtp.matches(listOfExtendsDouble,TypePattern.STATIC).alwaysTrue());
-
-        }
-        
-        
-        /**
-         * Foo<? extends Num*>
-         */
-        public void testSomethingExtendsPatternv2() {
-                TypePattern rtp = resolveWildTypePattern("List<? extends Num*>", false);
-
-                assertTrue("resolves to wild type pattern",rtp instanceof WildTypePattern);
-                assertEquals("one type parameter",1,rtp.getTypeParameters().size());
-                TypePattern tp = rtp.getTypeParameters().getTypePatterns()[0];
-                assertTrue("parameter is wild",tp instanceof WildTypePattern);
-                WildTypePattern tpwtp = (WildTypePattern) tp;
-                assertEquals("?",tpwtp.getNamePatterns()[0].maybeGetSimpleName());
-                assertEquals("Num*",tpwtp.upperBound.toString());
-                
-                
-                WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
-                assertEquals("one type parameter",1,wtp.getTypeParameters().size());
-                tp = rtp.getTypeParameters().getTypePatterns()[0];
-                assertTrue("parameter is wild",tp instanceof WildTypePattern);
-                tpwtp = (WildTypePattern) tp;
-                assertEquals("?",tpwtp.getNamePatterns()[0].maybeGetSimpleName());
-                assertEquals("Num*",tpwtp.upperBound.toString());
-                
-                assertFalse("does not match List",wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",wtp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list",wtp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",wtp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",wtp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());                                               
-                assertFalse("does not match list of something",wtp.matches(javaUtilListOfSomething,TypePattern.STATIC).alwaysTrue());
-                
-                ResolvedType listOfNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Number").resolve(world)}, 
-                                               world);
-                
-                ResolvedType listOfDouble = 
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Double").resolve(world)}, 
-                                               world);
-                        
-                boolean matchesListOfNumber = wtp.matches(listOfNumber,TypePattern.STATIC).alwaysTrue();
-                assertFalse("does not match list of number",matchesListOfNumber);
-                assertFalse("does not match list of double",wtp.matches(listOfDouble,TypePattern.STATIC).alwaysTrue());
-
-                ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
-                ResolvedType listOfExtendsNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {extendsNumber}, 
-                                               world);
-
-                boolean matchesListOfQmarkExtendsNumber = wtp.matches(listOfExtendsNumber,TypePattern.STATIC).alwaysTrue();
-                assertTrue("failed to correctly match list of ? extends number",matchesListOfQmarkExtendsNumber);               
-
-                ResolvedType extendsDouble = TypeFactory.createTypeFromSignature("+Ljava/lang/Double;").resolve(world);
-                ResolvedType listOfExtendsDouble =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {extendsDouble}, 
-                                               world);
-
-                assertFalse("does not match list of ? extends double",wtp.matches(listOfExtendsDouble,TypePattern.STATIC).alwaysTrue());                                                
-        }
-        
-        /**
-         * Foo<? super Number>
-         * 
-         */
-        public void testSomethingSuper() {
-                TypePattern rtp = resolveWildTypePattern("List<? super Double>", false);
-
-                assertTrue("resolves to exact type",rtp instanceof ExactTypePattern);
-                UnresolvedType exactType = rtp.getExactType();
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<-Ljava/lang/Double;>;",exactType.getSignature());
-                assertTrue("got a bounded reference type",exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
-                ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
-                exactType = etp.getExactType();
-                exactType = exactType.resolve(world);
-                assertTrue(exactType.isParameterizedType());
-                assertEquals("Pjava/util/List<-Ljava/lang/Double;>;",exactType.getSignature());
-                assertTrue("got a bounded reference type",exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
-                assertFalse("does not match List",etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match generic List",etp.matches(javaUtilList.getGenericType(),TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list",etp.matches(javaUtilListOfString,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match parameterized list of double",etp.matches(javaUtilListOfDouble,TypePattern.STATIC).alwaysTrue());
-                assertTrue("does not match String",etp.matches(javaLangString,TypePattern.STATIC).alwaysFalse());                                               
-                assertFalse("does not match list of something",etp.matches(javaUtilListOfSomething,TypePattern.STATIC).alwaysTrue());
-                
-                ResolvedType listOfNumber =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Number").resolve(world)}, 
-                                               world);
-                
-                ResolvedType listOfDouble = 
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {UnresolvedType.forName("java.lang.Double").resolve(world)}, 
-                                               world);
-                        
-                assertFalse("does not match list of number",etp.matches(listOfNumber,TypePattern.STATIC).alwaysTrue());
-                assertFalse("does not match list of double",etp.matches(listOfDouble,TypePattern.STATIC).alwaysTrue());
-
-                ResolvedType superDouble = TypeFactory.createTypeFromSignature("-Ljava/lang/Double;").resolve(world);
-                ResolvedType listOfSuperDouble =
-                               TypeFactory.createParameterizedType(
-                                               javaUtilList, 
-                                               new UnresolvedType[] {superDouble}, 
-                                               world);
-
-                assertTrue("matches list of ? super double",etp.matches(listOfSuperDouble,TypePattern.STATIC).alwaysTrue());
-        }
-
-        private TypePattern resolveWildTypePattern(String source, boolean requireExact) {
-                WildTypePattern wtp = makeWildTypePattern(source);
-                return wtp.resolveBindings(scope, bindings, false, requireExact);
-        }
-        
-        private WildTypePattern makeWildTypePattern(String source) {
-                PatternParser parser = new PatternParser(source);
-                return (WildTypePattern) parser.parseTypePattern();
-        }
-        
-        private TypePattern writeAndRead(TypePattern etp) {
-                try {
-                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                        DataOutputStream dos = new DataOutputStream(baos);
-                        etp.write(dos);
-                        dos.flush();
-                        dos.close();
-                        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
-                        VersionedDataInputStream in = new VersionedDataInputStream(bais);
-                        in.setVersion(new WeaverVersionInfo());
-                        TypePattern ret = TypePattern.read(in, null);
-                        return ret;
-                } catch (IOException ioEx) {
-                        fail(ioEx + " thrown during serialization");
-                }
-                return null;
-        }
-        
-        protected void setUp() throws Exception {
+public class WildTypePatternResolutionTestCase extends TestCase {
+
+       private World world;
+       private Bindings bindings;
+       private SimpleScope scope;
+       private ResolvedType javaUtilList;
+       private ResolvedType javaLangString;
+       private ResolvedType javaUtilListOfString;
+       private ResolvedType javaUtilListOfDouble;
+       private ResolvedType javaUtilListOfSomething;
+
+       /**
+        * Foo where Foo exists and is generic Parser creates WildTypePattern namePatterns={Foo} resolveBindings resolves Foo to RT(Foo
+        * - raw) return ExactTypePattern(LFoo;)
+        */
+       public void testSimpleFoo() {
+               TypePattern rtp = resolveWildTypePattern("List", false);
+
+               assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
+               UnresolvedType exactType = rtp.getExactType();
+               assertTrue(exactType.isRawType());
+               assertEquals("Ljava/util/List;", exactType.getSignature());
+
+               ResolvedType rt = exactType.resolve(world);
+               assertEquals("Ljava/util/List;", rt.getSignature());
+               assertTrue(rt.isRawType());
+
+               ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
+               exactType = etp.getExactType();
+
+               assertEquals("Ljava/util/List;", exactType.getSignature());
+
+               rt = exactType.resolve(world);
+               assertEquals("Ljava/util/List;", rt.getSignature());
+               assertTrue(rt.isRawType());
+
+               assertTrue("matches List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertTrue("matches generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertTrue("matches parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+       }
+
+       /**
+        * Foo<String> where Foo exists and String meets the bounds Parser creates WildTypePattern namePatterns = {Foo},
+        * typeParameters=WTP{String} resolveBindings resolves typeParameters to ExactTypePattern(String) resolves Foo to RT(Foo)
+        * returns ExactTypePattern(PFoo<String>; - parameterized)
+        */
+       public void testParameterized() {
+               TypePattern rtp = resolveWildTypePattern("List<String>", false);
+
+               assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
+               UnresolvedType exactType = rtp.getExactType();
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<Ljava/lang/String;>;", exactType.getSignature());
+
+               ResolvedType rt = exactType.resolve(world);
+               assertEquals("Pjava/util/List<Ljava/lang/String;>;", rt.getSignature());
+               assertTrue(rt.isParameterizedType());
+
+               ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
+               exactType = etp.getExactType();
+
+               assertEquals("Pjava/util/List<Ljava/lang/String;>;", rt.getSignature());
+               assertTrue(rt.isParameterizedType());
+
+               rt = exactType.resolve(world);
+               assertEquals("Pjava/util/List<Ljava/lang/String;>;", rt.getSignature());
+               assertTrue(rt.isParameterizedType());
+
+               assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertTrue("matches parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+
+       }
+
+       /**
+        * Foo<Str*> where Foo exists and takes one bound Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{Str*}
+        * resolveBindings resolves typeParameters to WTP{Str*} resolves Foo to RT(Foo) returns WildTypePattern(name = Foo,
+        * typeParameters = WTP{Str*} isGeneric=false)
+        */
+       public void testParameterizedWildCard() {
+               TypePattern rtp = resolveWildTypePattern("List<Str*>", false);
+
+               assertTrue("resolves to WildTypePattern", rtp instanceof WildTypePattern);
+               assertTrue("one type parameter", rtp.typeParameters.size() == 1);
+               assertTrue("missing", ResolvedType.isMissing(rtp.getExactType()));
+
+               WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
+               assertTrue("one type parameter", wtp.typeParameters.size() == 1);
+               assertTrue("missing", ResolvedType.isMissing(wtp.getExactType()));
+               assertEquals("Str*", wtp.getTypeParameters().getTypePatterns()[0].toString());
+
+               assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertTrue("matches parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+       }
+
+       /**
+        * Fo*<String> Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{String} resolveBindings resolves
+        * typeParameters to ETP{String} returns WildTypePattern(name = Fo*, typeParameters = ETP{String} isGeneric=false)
+        */
+       public void testWildcardParameterized() {
+               TypePattern rtp = resolveWildTypePattern("Li*<String>", false);
+
+               assertTrue("resolves to WildTypePattern", rtp instanceof WildTypePattern);
+               assertTrue("one type parameter", rtp.typeParameters.size() == 1);
+               assertEquals("Ljava/lang/String;", rtp.typeParameters.getTypePatterns()[0].getExactType().getSignature());
+
+               WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
+               assertTrue("one type parameter", wtp.typeParameters.size() == 1);
+               assertEquals("Ljava/lang/String;", wtp.typeParameters.getTypePatterns()[0].getExactType().getSignature());
+
+               assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertTrue("matches parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+       }
+
+       /**
+        * Foo<?>
+        */
+       public void testSomething() {
+               TypePattern rtp = resolveWildTypePattern("List<?>", false);
+
+               assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
+               UnresolvedType exactType = rtp.getExactType();
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<*>;", exactType.getSignature());
+
+               ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
+               exactType = etp.getExactType();
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<*>;", exactType.getSignature());
+
+               assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+
+               assertTrue("matches list of something", etp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
+       }
+
+       /**
+        * Foo<? extends Number>
+        */
+       public void testSomethingExtends() {
+               TypePattern rtp = resolveWildTypePattern("List<? extends Number>", false);
+
+               assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
+               UnresolvedType exactType = rtp.getExactType();
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<+Ljava/lang/Number;>;", exactType.getSignature());
+               assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
+
+               ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
+               exactType = etp.getExactType();
+               exactType = exactType.resolve(world);
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<+Ljava/lang/Number;>;", exactType.getSignature());
+               assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
+
+               assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+               assertFalse("does not match list of something", etp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Number").resolve(world) }, world);
+
+               ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Double").resolve(world) }, world);
+
+               assertFalse("does not match list of number", etp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match list of double", etp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
+               ResolvedType listOfExtendsNumber = TypeFactory.createParameterizedType(javaUtilList,
+                               new UnresolvedType[] { extendsNumber }, world);
+
+               assertTrue("matches list of ? extends number", etp.matches(listOfExtendsNumber, TypePattern.STATIC).alwaysTrue());
+
+       }
+
+       /**
+        * Foo<? extends Number+>
+        */
+       public void testSomethingExtendsPattern() {
+               TypePattern rtp = resolveWildTypePattern("List<? extends Number+>", false);
+
+               assertTrue("resolves to wild type pattern", rtp instanceof WildTypePattern);
+               assertEquals("one type parameter", 1, rtp.getTypeParameters().size());
+               TypePattern tp = rtp.getTypeParameters().getTypePatterns()[0];
+               assertTrue("parameter is wild", tp instanceof WildTypePattern);
+               WildTypePattern tpwtp = (WildTypePattern) tp;
+               assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
+               assertEquals("java.lang.Number+", tpwtp.upperBound.toString());
+
+               WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
+               assertEquals("one type parameter", 1, wtp.getTypeParameters().size());
+               tp = rtp.getTypeParameters().getTypePatterns()[0];
+               assertTrue("parameter is wild", tp instanceof WildTypePattern);
+               tpwtp = (WildTypePattern) tp;
+               assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
+               assertEquals("java.lang.Number+", tpwtp.upperBound.toString());
+
+               assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+               assertFalse("does not match list of something", wtp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Number").resolve(world) }, world);
+
+               ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Double").resolve(world) }, world);
+
+               assertFalse("does not match list of number", wtp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match list of double", wtp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
+               ResolvedType listOfExtendsNumber = TypeFactory.createParameterizedType(javaUtilList,
+                               new UnresolvedType[] { extendsNumber }, world);
+
+               assertTrue("matches list of ? extends number", wtp.matches(listOfExtendsNumber, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType extendsDouble = TypeFactory.createTypeFromSignature("+Ljava/lang/Double;").resolve(world);
+               ResolvedType listOfExtendsDouble = TypeFactory.createParameterizedType(javaUtilList,
+                               new UnresolvedType[] { extendsDouble }, world);
+
+               assertTrue("matches list of ? extends double", wtp.matches(listOfExtendsDouble, TypePattern.STATIC).alwaysTrue());
+
+       }
+
+       /**
+        * Foo<? extends Num*>
+        */
+       public void testSomethingExtendsPatternv2() {
+               TypePattern rtp = resolveWildTypePattern("List<? extends Num*>", false);
+
+               assertTrue("resolves to wild type pattern", rtp instanceof WildTypePattern);
+               assertEquals("one type parameter", 1, rtp.getTypeParameters().size());
+               TypePattern tp = rtp.getTypeParameters().getTypePatterns()[0];
+               assertTrue("parameter is wild", tp instanceof WildTypePattern);
+               WildTypePattern tpwtp = (WildTypePattern) tp;
+               assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
+               assertEquals("Num*", tpwtp.upperBound.toString());
+
+               WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
+               assertEquals("one type parameter", 1, wtp.getTypeParameters().size());
+               tp = rtp.getTypeParameters().getTypePatterns()[0];
+               assertTrue("parameter is wild", tp instanceof WildTypePattern);
+               tpwtp = (WildTypePattern) tp;
+               assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
+               assertEquals("Num*", tpwtp.upperBound.toString());
+
+               assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+               assertFalse("does not match list of something", wtp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Number").resolve(world) }, world);
+
+               ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Double").resolve(world) }, world);
+
+               boolean matchesListOfNumber = wtp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue();
+               assertFalse("does not match list of number", matchesListOfNumber);
+               assertFalse("does not match list of double", wtp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
+               ResolvedType listOfExtendsNumber = TypeFactory.createParameterizedType(javaUtilList,
+                               new UnresolvedType[] { extendsNumber }, world);
+
+               boolean matchesListOfQmarkExtendsNumber = wtp.matches(listOfExtendsNumber, TypePattern.STATIC).alwaysTrue();
+               assertTrue("failed to correctly match list of ? extends number", matchesListOfQmarkExtendsNumber);
+
+               ResolvedType extendsDouble = TypeFactory.createTypeFromSignature("+Ljava/lang/Double;").resolve(world);
+               ResolvedType listOfExtendsDouble = TypeFactory.createParameterizedType(javaUtilList,
+                               new UnresolvedType[] { extendsDouble }, world);
+
+               assertFalse("does not match list of ? extends double", wtp.matches(listOfExtendsDouble, TypePattern.STATIC).alwaysTrue());
+       }
+
+       /**
+        * Foo<? super Number>
+        * 
+        */
+       public void testSomethingSuper() {
+               TypePattern rtp = resolveWildTypePattern("List<? super Double>", false);
+
+               assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
+               UnresolvedType exactType = rtp.getExactType();
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<-Ljava/lang/Double;>;", exactType.getSignature());
+               assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
+
+               ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
+               exactType = etp.getExactType();
+               exactType = exactType.resolve(world);
+               assertTrue(exactType.isParameterizedType());
+               assertEquals("Pjava/util/List<-Ljava/lang/Double;>;", exactType.getSignature());
+               assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
+
+               assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
+                               .alwaysTrue());
+               assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
+               assertFalse("does not match list of something", etp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Number").resolve(world) }, world);
+
+               ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Double").resolve(world) }, world);
+
+               assertFalse("does not match list of number", etp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue());
+               assertFalse("does not match list of double", etp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
+
+               ResolvedType superDouble = TypeFactory.createTypeFromSignature("-Ljava/lang/Double;").resolve(world);
+               ResolvedType listOfSuperDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { superDouble },
+                               world);
+
+               assertTrue("matches list of ? super double", etp.matches(listOfSuperDouble, TypePattern.STATIC).alwaysTrue());
+       }
+
+       private TypePattern resolveWildTypePattern(String source, boolean requireExact) {
+               WildTypePattern wtp = makeWildTypePattern(source);
+               return wtp.resolveBindings(scope, bindings, false, requireExact);
+       }
+
+       private WildTypePattern makeWildTypePattern(String source) {
+               PatternParser parser = new PatternParser(source);
+               return (WildTypePattern) parser.parseTypePattern();
+       }
+
+       private TypePattern writeAndRead(TypePattern etp) {
+               try {
+                       ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                       CompressingDataOutputStream dos = new CompressingDataOutputStream(baos);
+                       etp.write(dos);
+                       dos.flush();
+                       dos.close();
+                       ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+                       VersionedDataInputStream in = new VersionedDataInputStream(bais);
+                       in.setVersion(new WeaverVersionInfo());
+                       TypePattern ret = TypePattern.read(in, null);
+                       return ret;
+               } catch (IOException ioEx) {
+                       fail(ioEx + " thrown during serialization");
+               }
+               return null;
+       }
+
+       protected void setUp() throws Exception {
                super.setUp();
                this.world = new BcelWorld();
                this.world.setBehaveInJava5Way(true);
                this.bindings = new Bindings(0);
-               this.scope = new SimpleScope(world , new FormalBinding[] {});           
-               this.scope.setImportedPrefixes(new String[] {"java.io.","java.util.","java.lang."});
+               this.scope = new SimpleScope(world, new FormalBinding[] {});
+               this.scope.setImportedPrefixes(new String[] { "java.io.", "java.util.", "java.lang." });
                this.javaLangString = UnresolvedType.forName("java.lang.String").resolve(world);
                this.javaUtilList = UnresolvedType.forName("java.util.List").resolve(world);
-               this.javaUtilListOfString = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] {javaLangString}, world);
-               this.javaUtilListOfDouble = 
-                       TypeFactory.createParameterizedType(
-                                       javaUtilList, 
-                                       new UnresolvedType[] {UnresolvedType.forName("java.lang.Double").resolve(world)}, 
-                                       world);
-               this.javaUtilListOfSomething = 
-                       TypeFactory.createParameterizedType(
-                                       javaUtilList, 
-                                       new UnresolvedType[] {UnresolvedType.SOMETHING.resolve(world)}, 
-                                       world);
+               this.javaUtilListOfString = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { javaLangString },
+                               world);
+               this.javaUtilListOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
+                               .forName("java.lang.Double").resolve(world) }, world);
+               this.javaUtilListOfSomething = TypeFactory.createParameterizedType(javaUtilList,
+                               new UnresolvedType[] { UnresolvedType.SOMETHING.resolve(world) }, world);
        }
 }