diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java index 378c90699..8b45a312e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java @@ -94,7 +94,9 @@ import org.eclipse.jgit.revwalk.RevWalk; */ public abstract class RevFilter { /** Default filter that always returns true (thread safe). */ - public static final RevFilter ALL = new RevFilter() { + public static final RevFilter ALL = new AllFilter(); + + private static final class AllFilter extends RevFilter { @Override public boolean include(final RevWalk walker, final RevCommit c) { return true; @@ -109,10 +111,12 @@ public abstract class RevFilter { public String toString() { return "ALL"; } - }; + } /** Default filter that always returns false (thread safe). */ - public static final RevFilter NONE = new RevFilter() { + public static final RevFilter NONE = new NoneFilter(); + + private static final class NoneFilter extends RevFilter { @Override public boolean include(final RevWalk walker, final RevCommit c) { return false; @@ -127,10 +131,12 @@ public abstract class RevFilter { public String toString() { return "NONE"; } - }; + } /** Excludes commits with more than one parent (thread safe). */ - public static final RevFilter NO_MERGES = new RevFilter() { + public static final RevFilter NO_MERGES = new NoMergesFilter(); + + private static final class NoMergesFilter extends RevFilter { @Override public boolean include(final RevWalk walker, final RevCommit c) { return c.getParentCount() < 2; @@ -145,7 +151,7 @@ public abstract class RevFilter { public String toString() { return "NO_MERGES"; } - }; + } /** * Selects only merge bases of the starting points (thread safe). @@ -155,7 +161,9 @@ public abstract class RevFilter { * information beyond the arguments is necessary to determine if the * supplied commit is a merge base. */ - public static final RevFilter MERGE_BASE = new RevFilter() { + public static final RevFilter MERGE_BASE = new MergeBaseFilter(); + + private static final class MergeBaseFilter extends RevFilter { @Override public boolean include(final RevWalk walker, final RevCommit c) { throw new UnsupportedOperationException(JGitText.get().cannotBeCombined); @@ -170,7 +178,7 @@ public abstract class RevFilter { public String toString() { return "MERGE_BASE"; } - }; + } /** * Create a new filter that does the opposite of this filter. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java index 50421fe7a..9348afc8a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java @@ -84,7 +84,9 @@ import org.eclipse.jgit.treewalk.TreeWalk; */ public abstract class TreeFilter { /** Selects all tree entries. */ - public static final TreeFilter ALL = new TreeFilter() { + public static final TreeFilter ALL = new AllFilter(); + + private static final class AllFilter extends TreeFilter { @Override public boolean include(final TreeWalk walker) { return true; @@ -104,7 +106,7 @@ public abstract class TreeFilter { public String toString() { return "ALL"; } - }; + } /** * Selects only tree entries which differ between at least 2 trees. @@ -119,7 +121,9 @@ public abstract class TreeFilter { * against the single tree it was actually given. Applications may wish to * treat such a difference as "all names added". */ - public static final TreeFilter ANY_DIFF = new TreeFilter() { + public static final TreeFilter ANY_DIFF = new AnyDiffFilter(); + + private static final class AnyDiffFilter extends TreeFilter { private static final int baseTree = 0; @Override @@ -149,7 +153,7 @@ public abstract class TreeFilter { public String toString() { return "ANY_DIFF"; } - }; + } /** * Create a new filter that does the opposite of this filter.