remove instanceof and other non supported java features