Beispiel #1
0
 /*
  * Is invoked by CtClassType.setName() and methods in this class.
  * This method throws an exception if the class is already frozen or
  * if this class pool cannot edit the class since it is in a parent
  * class pool.
  *
  * @see checkNotExists(String)
  */
 void checkNotFrozen(String classname) throws RuntimeException {
   CtClass clazz = getCached(classname);
   if (clazz == null) {
     if (!childFirstLookup && parent != null) {
       try {
         clazz = parent.get0(classname, true);
       } catch (NotFoundException e) {
       }
       if (clazz != null)
         throw new RuntimeException(classname + " is in a parent ClassPool.  Use the parent.");
     }
   } else if (clazz.isFrozen())
     throw new RuntimeException(classname + ": frozen class (cannot edit)");
 }