Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for git client plugin 2.0.0 coexistence
The git client plugin 2.0.0 release will switch from delivering JGit 3 to JGit 4. JGit 4 requires Java 7 and provides Closeable implementations of its methods that open external resources (like files). JGit 4 removes certain methods (like release()) because they are superseded by the JGit 4 Closeable implementation. The gerrit trigger plugin depends on the git client plugin implementation of JGit. It correctly assumes the JGit provided by the git client plugin is JGit 3. If no changes are made to the plugins which depend on the JGit provided by the git client plugin, those plugins will be broken by the upgrade from JGit 3 to JGit 4. They will report NoSuchMethodError exceptions at run time or may report LinkageError exceptions during class loading on some JVM implementations. This change adapts the plugin to run with either git client plugin 1.x (JGit 3) to git client plugin 2.x (JGit 4). This is a temporary change until the plugin depends on git client plugin 2.0. Once it depends on git client plugin 2.0 (and JDK 7), this change can be reverted. Uses reflection to find the close method of RevWalk if needed. When RevWalk and TreeWalk from JGit 3 are loaded, their release() methods are called. When RevWalk and TreeWalk from JGit 4 are loaded, their close() methods are called.
- Loading branch information