when i was searching the android source code, i have found something i can not understand or bear. you can see all onSetLayoutParams in the frameworks source code bellow:
./base/core/java/android/widget/Toolbar.java: protected void onSetLayoutParams(View child, ViewGroup.LayoutParams lp) {
./base/core/java/android/widget/GridLayout.java: protected void onSetLayoutParams(View child, ViewGroup.LayoutParams layoutParams) {
./base/core/java/android/widget/GridLayout.java: super.onSetLayoutParams(child, layoutParams);
./base/core/java/android/view/View.java: ((ViewGroup) mParent).onSetLayoutParams(this, params);
./base/core/java/android/view/ViewGroup.java: protected void onSetLayoutParams(View child, LayoutParams layoutParams) {
every define of onSetLayoutParams is proected, yet View.setLayoutParams cast its parent to a ViewGroup, then call ViewGroup's onSetLayoutParams. i don not think this is right in java, but all android seems running very well.
sorry for my poor english.