Fix method only exists in java 8.