title: implementing interface across multiple versions
body: <p>I am trying to create a class that implements an interface from the Java library. ResultSet to be specific, though the particular interface shouldn't be relevant to the question. (I need to put a layer on top of a regular ResultSet that provides some additional functionality, but I'd like the "regular" functions to pass through, and I have a couple of functions that should be able to take either a regular ResultSet or my "enhanced" ResultSet.)</p>
  
  <p>My problem is: Is there a way that I can do this so that the class will successfully compile in both Java 5 and Java 6?</p>
  
  <p>There are a number of functions declared in the ResultSet interface in Java 6 that return objects not defined in Java 5. If I include these functions, my class won't compile in Java 5 because I'm referencing undefined types. But if I don't include these functions, then my class won't compile in Java 6 because I don't completely implement the interface. I seem to be stuck in something of a catch-22. I don't actually need any of these functions -- in fact my implementation just throws a "not implemented" exception for all of them.</p>
  
  <p>Some of our programmers are running Java 5 and some are running Java 6. Our production environment is Java 5. I suppose in a more-perfect world we would all be running the same version. But even if I can modify our environment to make the problem moot in this case, surely this issue comes up with open source projects. And if I do modify my code to work with Java 5, then when, sooner or later, we upgrade to Java 6, the class will break, which seems pretty annoying.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Well, thanks for the answers given. I was rather hoping that someone would tell me, "Oh, if you just add this annotation or type the letter 'W' here, it will all work magically." No such luck, I guess.</p>
  
  <p>All the answers received (as of this update, anyway) make good points so I've upvoted all of them and I've given the "best answer" award to the one that best expresses my frustation. :-)</p>
  
  <p>I think my real solution is going to be to abandon the idea of implementing ResultSet and instead create a new interface that includes just the functions from ResultSet that have to be implemented for the beast to work. I find this emotionally unsatisfying but, it appears, better than the alternatives.</p>