Dharma: that which upholds or sustains the positive order of the world - family, community, nation and the entire universe.
Laws may be used to uphold Dharma; but Dharma is not same as Law.
There is no written rule of Dharma or Adharma. It really depends on situation. Krishna's actions were not according to Law; but they were very much according to Dharma (as they were meant to uphold Dharma) and so cannot be called Adharma. You can call them unlawful though.
Please do not intrepet this as "ends justify the means". Ends can ONLY justify the means if the end goal is establishment of Dharma.
As an eg: the phrase "Ahimsa Parmo Dharma" is construed as meaning non-violence is ultimate dharma. But the full phrase is "Ahimsa Parmo Dharma, Dharm Hinsa Tathiv Cha"; ie
"non-violence is ultimate dharma; so too is violence in the service of Dharma"
Check out this written by Sadhguru