Let A be a finite or countable alphabet and let $\theta$ be a literal (anti-)automorphism onto A * (by definition, such a correspondence is determinated by a permutation of the alphabet). This paper deals with sets which are invariant under $\theta$ ($\theta$-invariant for short) that is, languages L such that $\theta$ (L) is a subset of L.We establish an extension of the famous defect theorem. With regards to the so-called notion of completeness, we provide a series of examples of finite complete $\theta$-invariant codes. Moreover, we establish a formula which allows to embed any non-complete $\theta$-invariant code into a complete one. As a consequence, in the family of the so-called thin $\theta$--invariant codes, maximality and completeness are two equivalent notions.