return;
  public void writeExpression(Expression expr)  {    // Implementation note: Why is this method overwritten and nearly exactly    // reimplemented as in Encoder?    // The Encoder class can (and should be) subclassed by users outside of the    // java.beans package. While I have doubts that this is possible from an    // API design point of view I tried to replicate the Encoder's behavior    // in the JDK as exactly as possible. This strictness however made it    // extremely complicated to implement the XMLEncoder's backend. Therefore    // I decided to copy the Encoder's implementation and make all changes    // I needed for a succesfull operation of XMLEncoder.    //    // The same is true for the writeStatement method.        //  Silently ignore out of bounds calls.    if (accessCounter <= 0)      return;        scanEngine.writeExpression(expr);    Object target = expr.getTarget();    Object value = null;    Object newValue = null;    try      {        value = expr.getValue();      }    catch (Exception e)      {        getExceptionListener().exceptionThrown(e);        return;      }            newValue = get(value);    if (newValue == null)      {        Object newTarget = get(target);        if (newTarget == null)          {            writeObject(target);            newTarget = get(target);            // May happen if exception was thrown.            if (newTarget == null)              {                return;              }          }        Object[] args = expr.getArguments();        Object[] newArgs = new Object[args.length];        for (int i = 0; i < args.length; i++)          {            newArgs[i] = get(args[i]);            if (newArgs[i] == null || isImmutableType(args[i].getClass()))              {                writeObject(args[i]);                newArgs[i] = get(args[i]);              }          }                Expression newExpr = new Expression(newTarget, expr.getMethodName(),                                            newArgs);                // Fakes the result of Class.forName(<primitiveType>) to make it possible        // to hand such a type to the encoding process.        if (value instanceof Class && ((Class) value).isPrimitive())          newExpr.setValue(value);                // Instantiates the new object.        try          {            newValue = newExpr.getValue();            putCandidate(value, newValue);          }        catch (Exception e)          {            getExceptionListener().exceptionThrown(e);                        // In Statement.writeExpression we had no possibility to flags            // an erroneous state to the ScanEngine without behaving different            // to the JDK.                        scanEngine.revoke();          }                writeObject(value);      }    else if(value.getClass() == String.class || value.getClass() == Class.class)      {        writeObject(value);      }    scanEngine.end();  }