core: replace switch labels with matched static final fields, searching up to root ClassNode