@Override
    public void lock() {
        TraversalHelper.reIdSteps(stepPosition, this);

        // normalize strategies, side-effects, and Graph through children. obviously ignore the root traversal, since
        // there is no parent to draw data from and ignore stuff wrapped for GraphComputer execution and the root
        // from which to draw child data from is logically the current traversal.
        if (!isRoot() && !(parent instanceof VertexProgramStep)) {
            final TraversalParent parent = getParent();
            final Traversal.Admin parentTraversal = parent.asStep().getTraversal().asAdmin();
            this.setStrategies(parentTraversal.getStrategies());
            this.setSideEffects(parentTraversal.getSideEffects());

            // not sure why java is complaining about generics here that i have to do this??
            if (parentTraversal.getGraph().isPresent())
                this.setGraph((Graph) parentTraversal.getGraph().get());
        }

        this.finalEndStep = this.getEndStep();

        if (this.isRoot()) {
            resetTraverserRequirements();
        }

        // lock the parent before the children
        this.locked = true;

        // now lock all the children
        TraversalHelper.applyTraversalRecursively(Admin::lock, this, true);
    }
Allow the locked property of the traversal to be directly set by those who know what they are doing. Are you
sure you know what you're doing?
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java