Bug #33823 public interface ResultSetInternalMethods with nonpublic CachedResultSetMetaData
Submitted: 11 Jan 2008 17:11 Modified: 1 Mar 2008 12:30
Reporter: Eric Jensen Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: CachedResultSetMetaData, interface, ResultSetInternalMethods, StatementInterceptor

[11 Jan 2008 17:11] Eric Jensen
Description:
ResultSetInternalMethods is a public interface, but it requires implementing the following two methods that depend on CachedResultSetMetaData, which is a package-private class:

populateCachedMetaData(CachedResultSetMetaData cachedMetaData)
initializeFromCachedMetaData(CachedResultSetMetaData cachedMetaData)

This effectively makes it impossible to implement that interface outside the com.mysql.jdbc package, voiding its utility as a public interface.  This is a problem when implementing StatementInterceptors because as the comments of ResultSetInternalMethods say, it is "intended to be used by implementors of statement interceptors so that implementors can create static ... proxy instances of ResultSets".  This is not actually possible without introducing a class into the com.mysql.jdbc package.

How to repeat:
Implementing the ResultSetInternalMethods interface in a package other than com.mysql.jdbc will cause these compiler errors:

- The type com.mysql.jdbc.CachedResultSetMetaData is not visible
- The type ExampleResultSetInternalMethodsImpl must implement the 
	 inherited abstract method 
ResultSetInternalMethods.initializeFromCachedMetaData(CachedResultSetMeta
	 Data)
- The type ExampleResultSetInternalMethodsImpl must implement the 
	 inherited abstract method 
	ResultSetInternalMethods.populateCachedMetaData(CachedResultSetMetaData)

Suggested fix:
make CachedResultSetMetaData a public class
[20 Jan 2008 3:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41075
[31 Jan 2008 5:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41474
[1 Mar 2008 12:30] MC Brown
A note has been added to the 5.1.6 changelog: 

The internal class ResultSetInternalMethods referenced the non-public class com.mysql.jdbc.CachedResultSetMetaData.