improving shared class creation for final internal classes