diff options
14 files changed, 16 insertions, 102 deletions
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java index 88ad472acb..d20fe9f27a 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java @@ -47,7 +47,6 @@ import javax.servlet.http.HttpServletRequest; import org.eclipse.jgit.http.server.GitServlet; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; @@ -71,13 +70,6 @@ public class AsIsFileService { } }; - private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() { - @Override - public ServiceConfig parse(final Config cfg) { - return new ServiceConfig(cfg); - } - }; - private static class ServiceConfig { final boolean enabled; @@ -96,7 +88,7 @@ public class AsIsFileService { * {@code true}. */ protected static boolean isEnabled(Repository db) { - return db.getConfig().get(CONFIG).enabled; + return db.getConfig().get(ServiceConfig::new).enabled; } /** diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java index 04e192bcfb..c0ffbb64d7 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java @@ -46,7 +46,6 @@ package org.eclipse.jgit.http.server.resolver; import javax.servlet.http.HttpServletRequest; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.ReceivePack; @@ -68,13 +67,6 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException; */ public class DefaultReceivePackFactory implements ReceivePackFactory<HttpServletRequest> { - private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() { - @Override - public ServiceConfig parse(final Config cfg) { - return new ServiceConfig(cfg); - } - }; - private static class ServiceConfig { final boolean set; @@ -89,7 +81,7 @@ public class DefaultReceivePackFactory implements @Override public ReceivePack create(final HttpServletRequest req, final Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { - final ServiceConfig cfg = db.getConfig().get(CONFIG); + final ServiceConfig cfg = db.getConfig().get(ServiceConfig::new); String user = req.getRemoteUser(); if (cfg.set) { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java index d01e2efca4..642623bdd9 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java @@ -46,7 +46,6 @@ package org.eclipse.jgit.http.server.resolver; import javax.servlet.http.HttpServletRequest; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.transport.UploadPack; import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException; @@ -61,13 +60,6 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory; */ public class DefaultUploadPackFactory implements UploadPackFactory<HttpServletRequest> { - private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() { - @Override - public ServiceConfig parse(final Config cfg) { - return new ServiceConfig(cfg); - } - }; - private static class ServiceConfig { final boolean enabled; @@ -79,7 +71,7 @@ public class DefaultUploadPackFactory implements @Override public UploadPack create(final HttpServletRequest req, final Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { - if (db.getConfig().get(CONFIG).enabled) + if (db.getConfig().get(ServiceConfig::new).enabled) return new UploadPack(db); else throw new ServiceNotEnabledException(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java index 324b99eb58..ee709495e5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffConfig.java @@ -54,12 +54,7 @@ import org.eclipse.jgit.util.StringUtils; /** Keeps track of diff related configuration options. */ public class DiffConfig { /** Key for {@link Config#get(SectionParser)}. */ - public static final Config.SectionParser<DiffConfig> KEY = new SectionParser<DiffConfig>() { - @Override - public DiffConfig parse(final Config cfg) { - return new DiffConfig(cfg); - } - }; + public static final Config.SectionParser<DiffConfig> KEY = DiffConfig::new; /** Permissible values for {@code diff.renames}. */ public static enum RenameDetectionType { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WriteConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WriteConfig.java index 1e2b239324..d9cbbd8f82 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WriteConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WriteConfig.java @@ -49,12 +49,7 @@ import org.eclipse.jgit.lib.CoreConfig; class WriteConfig { /** Key for {@link Config#get(SectionParser)}. */ - static final Config.SectionParser<WriteConfig> KEY = new SectionParser<WriteConfig>() { - @Override - public WriteConfig parse(final Config cfg) { - return new WriteConfig(cfg); - } - }; + static final Config.SectionParser<WriteConfig> KEY = WriteConfig::new; private final int compression; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java index 40aba636d1..fdbbe39393 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java @@ -57,12 +57,7 @@ import org.eclipse.jgit.lib.Config.SectionParser; */ public class CoreConfig { /** Key for {@link Config#get(SectionParser)}. */ - public static final Config.SectionParser<CoreConfig> KEY = new SectionParser<CoreConfig>() { - @Override - public CoreConfig parse(final Config cfg) { - return new CoreConfig(cfg); - } - }; + public static final Config.SectionParser<CoreConfig> KEY = CoreConfig::new; /** Permissible values for {@code core.autocrlf}. */ public static enum AutoCRLF { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java index bd393dd2ff..102a4518f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UserConfig.java @@ -51,12 +51,7 @@ import org.eclipse.jgit.util.SystemReader; /** The standard "user" configuration parameters. */ public class UserConfig { /** Key for {@link Config#get(SectionParser)}. */ - public static final Config.SectionParser<UserConfig> KEY = new SectionParser<UserConfig>() { - @Override - public UserConfig parse(final Config cfg) { - return new UserConfig(cfg); - } - }; + public static final Config.SectionParser<UserConfig> KEY = UserConfig::new; private String authorName; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index e8d18812f6..61c4c4b172 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -63,7 +63,6 @@ import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.storage.file.PackLock; import org.eclipse.jgit.lib.AnyObjectId; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.MutableObjectId; import org.eclipse.jgit.lib.NullProgressMonitor; @@ -250,7 +249,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection super(packTransport); if (local != null) { - final FetchConfig cfg = local.getConfig().get(FetchConfig.KEY); + final FetchConfig cfg = local.getConfig().get(FetchConfig::new); allowOfsDelta = cfg.allowOfsDelta; } else { allowOfsDelta = true; @@ -279,13 +278,6 @@ public abstract class BasePackFetchConnection extends BasePackConnection } private static class FetchConfig { - static final SectionParser<FetchConfig> KEY = new SectionParser<FetchConfig>() { - @Override - public FetchConfig parse(final Config cfg) { - return new FetchConfig(cfg); - } - }; - final boolean allowOfsDelta; FetchConfig(final Config c) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index 6f94dbbfec..6420015bd0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -78,7 +78,6 @@ import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.storage.file.PackLock; import org.eclipse.jgit.lib.BatchRefUpdate; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.NullProgressMonitor; import org.eclipse.jgit.lib.ObjectChecker; @@ -314,7 +313,7 @@ public abstract class BaseReceivePack { TransferConfig tc = db.getConfig().get(TransferConfig.KEY); objectChecker = tc.newReceiveObjectChecker(); - ReceiveConfig rc = db.getConfig().get(ReceiveConfig.KEY); + ReceiveConfig rc = db.getConfig().get(ReceiveConfig::new); allowCreates = rc.allowCreates; allowAnyDeletes = true; allowBranchDeletes = rc.allowDeletes; @@ -332,13 +331,6 @@ public abstract class BaseReceivePack { /** Configuration for receive operations. */ protected static class ReceiveConfig { - static final SectionParser<ReceiveConfig> KEY = new SectionParser<ReceiveConfig>() { - @Override - public ReceiveConfig parse(final Config cfg) { - return new ReceiveConfig(cfg); - } - }; - final boolean allowCreates; final boolean allowDeletes; final boolean allowNonFastForwards; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java index 80b2caebc4..566153a333 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/DaemonService.java @@ -64,12 +64,7 @@ public abstract class DaemonService { DaemonService(final String cmdName, final String cfgName) { command = cmdName.startsWith("git-") ? cmdName : "git-" + cmdName; //$NON-NLS-1$ //$NON-NLS-2$ - configKey = new SectionParser<ServiceConfig>() { - @Override - public ServiceConfig parse(final Config cfg) { - return new ServiceConfig(DaemonService.this, cfg, cfgName); - } - }; + configKey = cfg -> new ServiceConfig(DaemonService.this, cfg, cfgName); overridable = true; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SignedPushConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SignedPushConfig.java index 83b4acaea2..1ecbed95c7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SignedPushConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SignedPushConfig.java @@ -54,12 +54,7 @@ import org.eclipse.jgit.lib.Config.SectionParser; public class SignedPushConfig { /** Key for {@link Config#get(SectionParser)}. */ public static final SectionParser<SignedPushConfig> KEY = - new SectionParser<SignedPushConfig>() { - @Override - public SignedPushConfig parse(Config cfg) { - return new SignedPushConfig(cfg); - } - }; + SignedPushConfig::new; private String certNonceSeed; private int certNonceSlopLimit; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java index d4cd1c367b..099629c056 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java @@ -69,12 +69,8 @@ public class TransferConfig { private static final String FSCK = "fsck"; //$NON-NLS-1$ /** Key for {@link Config#get(SectionParser)}. */ - public static final Config.SectionParser<TransferConfig> KEY = new SectionParser<TransferConfig>() { - @Override - public TransferConfig parse(final Config cfg) { - return new TransferConfig(cfg); - } - }; + public static final Config.SectionParser<TransferConfig> KEY = + TransferConfig::new; /** * A git configuration value for how to handle a fsck failure of a particular kind. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index 26a254d946..1bdecdb182 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -91,7 +91,6 @@ import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.storage.file.RefDirectory; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Config.SectionParser; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectIdRef; @@ -231,13 +230,6 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } }; - private static final Config.SectionParser<HttpConfig> HTTP_KEY = new SectionParser<HttpConfig>() { - @Override - public HttpConfig parse(final Config cfg) { - return new HttpConfig(cfg); - } - }; - private static class HttpConfig { final int postBuffer; @@ -279,7 +271,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } catch (MalformedURLException e) { throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e); } - http = local.getConfig().get(HTTP_KEY); + http = local.getConfig().get(HttpConfig::new); proxySelector = ProxySelector.getDefault(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java index 7d2b33f43d..2b18904a5f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeOptions.java @@ -55,12 +55,8 @@ import org.eclipse.jgit.lib.CoreConfig.SymLinks; /** Options used by the {@link WorkingTreeIterator}. */ public class WorkingTreeOptions { /** Key for {@link Config#get(SectionParser)}. */ - public static final Config.SectionParser<WorkingTreeOptions> KEY = new SectionParser<WorkingTreeOptions>() { - @Override - public WorkingTreeOptions parse(final Config cfg) { - return new WorkingTreeOptions(cfg); - } - }; + public static final Config.SectionParser<WorkingTreeOptions> KEY = + WorkingTreeOptions::new; private final boolean fileMode; |