Fix compile failures in api on 2.6.x with Java5