commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bali...@apache.org
Subject cvs commit: jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore TestEnhancer.java
Date Tue, 19 Mar 2002 13:50:19 GMT
baliuka     02/03/19 05:50:19

  Modified:    simplestore/src/java/org/apache/commons/simplestore/tools
                        Enhancer.java
               simplestore/src/test/org/apache/commons/simplestore
                        TestEnhancer.java
  Log:
  Fixed bug in Array return type handling
  
  Revision  Changes    Path
  1.18      +9 -3      jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/tools/Enhancer.java
  
  Index: Enhancer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/tools/Enhancer.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Enhancer.java	17 Mar 2002 20:17:43 -0000	1.17
  +++ Enhancer.java	19 Mar 2002 13:50:17 -0000	1.18
  @@ -100,7 +100,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: Enhancer.java,v 1.17 2002/03/17 20:17:43 baliuka Exp $
  + *@version    $Id: Enhancer.java,v 1.18 2002/03/19 13:50:17 baliuka Exp $
    */
   public class Enhancer implements org.apache.bcel.Constants , Constants{
       
  @@ -491,7 +491,11 @@
           }
           il.append(new ASTORE(stack));
           il.append(new ALOAD(stack));
  -        if (returnType instanceof ObjectType) {
  +        if ((returnType instanceof ObjectType) || ( returnType instanceof ArrayType) )
{
  +            if (returnType instanceof ArrayType){
  +                 il.append(new CHECKCAST(cp.addArrayClass((ArrayType)returnType)));
  +                 return il.append(new ARETURN()); 
  +            }
               if (!returnType.equals(Type.OBJECT)){
                    il.append(new CHECKCAST(cp.addClass((ObjectType) returnType)));
                    return il.append(new ARETURN()); 
  @@ -563,7 +567,7 @@
                   return il.append(new IRETURN());
               }
           }
  -        return null;
  +        throw new java.lang.InternalError();
       }
       private static Instruction newWrapper(Type type, ConstantPoolGen cp) {
           if (type instanceof BasicType) {
  @@ -669,6 +673,7 @@
                   return Type.BOOLEAN;
               }
           } else if (cls.isArray()) {
  +            System.out.println(new ArrayType( toType(cls.getComponentType()),cls.getName().lastIndexOf('[')
+ 1));
               return new ArrayType( toType(cls.getComponentType()),cls.getName().lastIndexOf('[')
+ 1);
           } else
               return new ObjectType(cls.getName());
  @@ -728,6 +733,7 @@
           InstructionFactory factory = new InstructionFactory(cg);
           ConstantPoolGen cp = cg.getConstantPool();
           MethodGen mg = toMethodGen(method, cg.getClassName(), il, cp);
  +        
           Type types[] = mg.getArgumentTypes();
           int argCount = types.length;
           addMethodField(fieldName, cg);
  
  
  
  1.13      +5 -4      jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestEnhancer.java
  
  Index: TestEnhancer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/test/org/apache/commons/simplestore/TestEnhancer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestEnhancer.java	17 Mar 2002 13:36:25 -0000	1.12
  +++ TestEnhancer.java	19 Mar 2002 13:50:18 -0000	1.13
  @@ -64,7 +64,7 @@
   /**
    *@author     Juozas Baliuka <a href="mailto:baliuka@mwm.lt">
    *      baliuka@mwm.lt</a>
  - *@version    $Id: TestEnhancer.java,v 1.12 2002/03/17 13:36:25 baliuka Exp $
  + *@version    $Id: TestEnhancer.java,v 1.13 2002/03/19 13:50:18 baliuka Exp $
    */
   public class TestEnhancer  extends TestCase {
       
  @@ -111,8 +111,6 @@
               public boolean invokeSuper( Object obj,java.lang.reflect.Method method,
               Object args[], Object retValFromBefore )
               throws java.lang.Throwable{
  -                
  -           
                   return true;
               }
               
  @@ -131,7 +129,8 @@
       //TODO : Add meanigful asserts
       
       String value = "VALUE";
  -    //vector.add(null);
  +    vector.add(null);
  +    
       vector.elements();
       vector.size();
       vector.add(value);
  @@ -139,6 +138,8 @@
       vector.remove(value);
       vector.contains(value);
       vector.get(0);
  +    vector.contains(value);
  +    vector.toArray(new Object[]{});
       
       
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message