The courts have made this declaration, and the law was modified in 1986 in accordance, however the law in place at the time Obama was in Indonesia did not specifically prevent a minor from renouncing his own citizenship.
From Immigration and Nationality Act of 1952: "A person who is a national of the United States whether by birth or naturalization, shall lose his nationality by voluntarily performing any of the following acts with the intention of relinquishing United States nationality -
"(1)obtaining naturalization in a foreign state upon his own application, upon an application filed in his behalf by a parent, guardian, or duly authorized agent, or through the naturalization of a parent having legal custody of such person: Provided, That nationality shall not be lost by any person under this section as the result of the naturalization of a parent or parents while such person is under the age of twenty-one years, or as the result of a naturalization obtained on behalf of a person under twenty-one years of age by a parent, guardian, or duly authorized agent, unless such person shall fail to enter the United States to establish a permanent residence prior to his twenty-fifth birthday: And provided further That a person who shall have lost nationality prior to January 1, 1948, through the naturalization in a foreign state of a parent or parents, may, within one year from the effective date of this Act, apply for a visa and for admission to the United States as a nonquota immigrant under the provisions of section 101 (a) (27)(E); or
"(2) taking an oath or making an affirmation or other formal declaration of allegiance to a foreign state or a political subdivision thereof;"
This was amended in 1986 to say: "or upon an application filed by a duly authorized agent, after having attained the age of eighteen years" in part 1 and "after having attained the age of eighteen years" in part 2. So, when Obama would have been in Indonesia, U.S. law didn't not specifically prevent him from renouncing his citizenship, and it only prevented his loss of citizenship if his parents naturalized. Keep in mind, that Lolo Soetoro did not need to naturalize and in Indonesia, citizenship by adoption is considered the same as citizenship at birth (not naturalization). At a state department site on intercountry adoption it notes for outgoing adoptions to Hague convention countries, that children retain their U.S. citizenship. Indonesia is not one of the countries (and did not recognize dual citizenship), so there's a question as to whether U.S. citizenship is retained.
"A child being adopted from the United States to another Convention country retains his/her U.S. citizenship. He or she may also acquire the citizenship of the prospective adoptive parents depending on the citizenship status of the parents and the laws of the other Convention country.
Indonesia is non-Hague Convention country.
Indonesia was ruled as a dictatorship when Barry was living there. He absolutely would not have been allowed to become an Indonesian National if he had not renounced his US citizenship first.
He could have recovered his US citizenship at any time before he reached the age of 18 years and 6 months, but he would not have been able to attend college as a foreign national if he had done that.