1 Reply Latest reply on May 16, 2005 12:00 PM by Shigeru Chiba

    I've a problem When checking for null

    Kumar Matcha Newbie

      Hi Chiba,

      I've a method which is as follows.

      public void display(String [] params){
      if(params == null){
      System.out.println("Nothing to display");
      }else{
      int k = params.length - 1;
      if(k >= 0 )
      do
      System.out.println(params[k]);
      while(--k >= 0);
      }
      }


      I'am using CtNewMethod.make(src,CtClass) to define this method in the class. I'am receiving an exception in the line marked bold. The exception is :


      javassist.CannotCompileException: [source error] incompatible array types
      at javassist.CtNewMethod.make(CtNewMethod.java:78)
      at javassist.CtNewMethod.make(CtNewMethod.java:44)

      Can you tell me whats the problem in the code. If there is a way to solve this issue.

      Thanks,
      Kumar Matcha.