The Church has always taught that the death penalty for crimes that are grevious is intrinsically just and that it is up to the state to determine the appropriate application of the penalty.
The primary purpose of all punishment, including capital punishment, is retributive. Paul says clearly in Romans,
“For rulers are not a terror to good conduct, but to bad. Would you have no fear of him who is in authority? Then do what is good, and you will receive his approval, for he is God’s servant for your good. But if you do wrong, be afraid, for he does not bear the sword in vain; he is the servant of God to execute his wrath on the wrongdoer. Therefore one must be subject, not only to avoid God’s wrath but also for the sake of conscience.”
Notice that the state is God’s agent of wrath. This is the teaching of the New Testament. In Genesis, God establishes the death penalty for murder. Notice that God establishes the death penalty with all of humanity, not just Israel. It is part of the universal Noadic covenant never revoked by the New Testament.
The Church’s current fixation on opposing the death penalty is highly mistaken in my opinion. It has no basis in Scripture or tradition. The Catechism’s elevation of “self defense” to the primary purpose of capital punishment has no good warrant. Therefore, it cannot bind on conscience. Were the Church someday to say that one may not use the death penalty, then the Church would be doing the equivalent of saying that one may use contraception. In either case, the Church would be violating Scripture, Tradition, and natural law.
With all due respect to the late Holy Father Pope John Paul II (who is a Saint and was a great Pope), his view on the death penalty can only be considered a private opinion when it is not backed by Scripture and Tradition.