private Object optimizeFieldMethodProperty(Object ctx, String property, Class<?> cls, Member member)
    throws IllegalAccessException
{
    Object o = ((Field) member).get(ctx);

      if (((member.getModifiers() & STATIC) != 0)) {
        // Check if the static field reference is a constant and a primitive.
        if ((member.getModifiers() & FINAL) != 0 && (o instanceof String || ((Field) member).getType().isPrimitive())) {
          o = ((Field) member).get(null);
          assert debug("LDC " + valueOf(o));
          mv.visitLdcInsn(o);
          wrapPrimitive(o.getClass());

          if (hasNullPropertyHandler()) {
            if (o == null) {
              o = getNullPropertyHandler().getProperty(member.getName(), ctx, variableFactory);
            }

            writeOutNullHandler(member, 0);
          }
          return o;
        }
        else {
          assert debug("GETSTATIC " + getDescriptor(member.getDeclaringClass()) + "."
              + member.getName() + "::" + getDescriptor(((Field) member).getType()));

          mv.visitFieldInsn(GETSTATIC, getInternalName(member.getDeclaringClass()),
              member.getName(), getDescriptor(returnType = ((Field) member).getType()));
        }
      }
      else {
        assert debug("CHECKCAST " + getInternalName(cls));
        mv.visitTypeInsn(CHECKCAST, getInternalName(cls));

        assert debug("GETFIELD " + property + ":" + getDescriptor(((Field) member).getType()));
        mv.visitFieldInsn(GETFIELD, getInternalName(cls), property, getDescriptor(returnType = ((Field) member)
            .getType()));
      }

      returnType = ((Field) member).getType();

      if (hasNullPropertyHandler()) {
        if (o == null) {
          o = getNullPropertyHandler().getProperty(member.getName(), ctx, variableFactory);
        }

        writeOutNullHandler(member, 0);
      }

      currType = toNonPrimitiveType(returnType);
      return o;
}