summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-10-28 20:24:12 +0100
committerAndrey Loskutov <loskutov@gmx.de>2015-10-28 20:24:12 +0100
commitdf876d2e0f4a3d4b99249ae03f901adcb9175c36 (patch)
tree763279312565c853bbd1525a92d1deb38771c5e5 /org.eclipse.jgit
parent79a7dd026fa393fa3c66e945839e9faef744be2f (diff)
downloadjgit-df876d2e0f4a3d4b99249ae03f901adcb9175c36.tar.gz
jgit-df876d2e0f4a3d4b99249ae03f901adcb9175c36.zip
[performance] Remove synthetic access$ methods in transport package
Java compiler must generate synthetic access methods for private methods and fields of the enclosing class if they are accessed from inner classes and vice versa. While invisible in the code, those synthetic access methods exist in the bytecode and seem to produce some extra execution overhead at runtime (compared with the direct access to this fields or methods), see https://git.eclipse.org/r/58948/. By removing the "private" access modifier from affected methods and fields we help compiler to avoid generation of synthetic access methods and hope to improve execution performance. To validate changes, one can either use javap or use Bytecode Outline plugin in Eclipse. In both cases one should look for "synthetic access$<number>" methods at the end of the class and inner class files in question - there should be none. NB: don't mix this "synthetic access$" methods up with "public synthetic bridge" methods generated to allow generic method override return types. Change-Id: I0ebaeb2bc454cd8051b901addb102c1a6688688b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java2
12 files changed, 51 insertions, 51 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index 0c8ee5d4b6..4069a64535 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -175,7 +175,7 @@ public class AmazonS3 {
private final String acl;
/** Maximum number of times to try an operation. */
- private final int maxAttempts;
+ final int maxAttempts;
/** Encryption algorithm, may be a null instance that provides pass-through. */
private final WalkEncryption encryption;
@@ -483,7 +483,7 @@ public class AmazonS3 {
return encryption.encrypt(new DigestOutputStream(buffer, md5));
}
- private void putImpl(final String bucket, final String key,
+ void putImpl(final String bucket, final String key,
final byte[] csum, final TemporaryBuffer buf,
ProgressMonitor monitor, String monitorTask) throws IOException {
if (monitor == null)
@@ -522,7 +522,7 @@ public class AmazonS3 {
throw maxAttempts(JGitText.get().s3ActionWriting, key);
}
- private IOException error(final String action, final String key,
+ IOException error(final String action, final String key,
final HttpURLConnection c) throws IOException {
final IOException err = new IOException(MessageFormat.format(
JGitText.get().amazonS3ActionFailed, action, key,
@@ -547,7 +547,7 @@ public class AmazonS3 {
return err;
}
- private IOException maxAttempts(final String action, final String key) {
+ IOException maxAttempts(final String action, final String key) {
return new IOException(MessageFormat.format(
JGitText.get().amazonS3ActionFailedGivingUp, action, key,
Integer.valueOf(maxAttempts)));
@@ -559,7 +559,7 @@ public class AmazonS3 {
return open(method, bucket, key, noArgs);
}
- private HttpURLConnection open(final String method, final String bucket,
+ HttpURLConnection open(final String method, final String bucket,
final String key, final Map<String, String> args)
throws IOException {
final StringBuilder urlstr = new StringBuilder();
@@ -596,7 +596,7 @@ public class AmazonS3 {
return c;
}
- private void authorize(final HttpURLConnection c) throws IOException {
+ void authorize(final HttpURLConnection c) throws IOException {
final Map<String, List<String>> reqHdr = c.getRequestProperties();
final SortedMap<String, String> sigHdr = new TreeMap<String, String>();
for (final Map.Entry<String, List<String>> entry : reqHdr.entrySet()) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
index 03f7c72835..d9e0b937e8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
@@ -79,7 +79,7 @@ public class Daemon {
private boolean run;
- private Thread acceptThread;
+ Thread acceptThread;
private int timeout;
@@ -87,9 +87,9 @@ public class Daemon {
private volatile RepositoryResolver<DaemonClient> repositoryResolver;
- private volatile UploadPackFactory<DaemonClient> uploadPackFactory;
+ volatile UploadPackFactory<DaemonClient> uploadPackFactory;
- private volatile ReceivePackFactory<DaemonClient> receivePackFactory;
+ volatile ReceivePackFactory<DaemonClient> receivePackFactory;
/** Configure a daemon to listen on any available network port. */
public Daemon() {
@@ -326,7 +326,7 @@ public class Daemon {
}
}
- private void startClient(final Socket s) {
+ void startClient(final Socket s) {
final DaemonClient dc = new DaemonClient(this);
final SocketAddress peer = s.getRemoteSocketAddress();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java
index b4a09020b5..85109a5bf0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java
@@ -71,8 +71,8 @@ import com.jcraft.jsch.Session;
* to the constructor.
*/
public class JschSession implements RemoteSession {
- private final Session sock;
- private final URIish uri;
+ final Session sock;
+ final URIish uri;
/**
* Create a new session object by passing the real Jsch session and the URI
@@ -119,7 +119,7 @@ public class JschSession implements RemoteSession {
private class JschProcess extends Process {
private ChannelExec channel;
- private final int timeout;
+ final int timeout;
private InputStream inputStream;
@@ -141,7 +141,7 @@ public class JschSession implements RemoteSession {
* @throws IOException
* on problems opening streams
*/
- private JschProcess(final String commandName, int tms)
+ JschProcess(final String commandName, int tms)
throws TransportException, IOException {
timeout = tms;
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
index 918df94de9..6e5fc9f009 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
@@ -122,14 +122,14 @@ public abstract class PackParser {
private InputStream in;
- private byte[] buf;
+ byte[] buf;
/** Position in the input stream of {@code buf[0]}. */
private long bBase;
private int bOffset;
- private int bAvail;
+ int bAvail;
private ObjectChecker objCheck;
@@ -1141,13 +1141,13 @@ public abstract class PackParser {
}
// Consume cnt bytes from the buffer.
- private void use(final int cnt) {
+ void use(final int cnt) {
bOffset += cnt;
bAvail -= cnt;
}
// Ensure at least need bytes are available in in {@link #buf}.
- private int fill(final Source src, final int need) throws IOException {
+ int fill(final Source src, final int need) throws IOException {
while (bAvail < need) {
int next = bOffset + bAvail;
int free = buf.length - next;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
index d8672d5a2b..8947f2779d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushCertificateStore.java
@@ -107,11 +107,11 @@ public class PushCertificateStore implements AutoCloseable {
Constants.R_REFS + "meta/push-certs"; //$NON-NLS-1$
private static class PendingCert {
- private PushCertificate cert;
- private PersonIdent ident;
- private Collection<ReceiveCommand> matching;
+ PushCertificate cert;
+ PersonIdent ident;
+ Collection<ReceiveCommand> matching;
- private PendingCert(PushCertificate cert, PersonIdent ident,
+ PendingCert(PushCertificate cert, PersonIdent ident,
Collection<ReceiveCommand> matching) {
this.cert = cert;
this.ident = ident;
@@ -121,8 +121,8 @@ public class PushCertificateStore implements AutoCloseable {
private final Repository db;
private final List<PendingCert> pending;
- private ObjectReader reader;
- private RevCommit commit;
+ ObjectReader reader;
+ RevCommit commit;
/**
* Create a new store backed by the given repository.
@@ -270,7 +270,7 @@ public class PushCertificateStore implements AutoCloseable {
};
}
- private void load() throws IOException {
+ void load() throws IOException {
close();
reader = db.newObjectReader();
Ref ref = db.getRefDatabase().exactRef(REF_NAME);
@@ -283,7 +283,7 @@ public class PushCertificateStore implements AutoCloseable {
}
}
- private static PushCertificate read(TreeWalk tw) throws IOException {
+ static PushCertificate read(TreeWalk tw) throws IOException {
if (tw == null || (tw.getRawMode(0) & TYPE_FILE) != TYPE_FILE) {
return null;
}
@@ -532,7 +532,7 @@ public class PushCertificateStore implements AutoCloseable {
return TreeWalk.forPath(reader, pathName(refName), commit.getTree());
}
- private static String pathName(String refName) {
+ static String pathName(String refName) {
return refName + "@{cert}"; //$NON-NLS-1$
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java
index 5243010502..5fd2f84b7e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java
@@ -78,17 +78,17 @@ public class TestProtocol<C> extends TransportProtocol {
private static final String SCHEME = "test"; //$NON-NLS-1$
private class Handle {
- private final C req;
- private final Repository remote;
+ final C req;
+ final Repository remote;
- private Handle(C req, Repository remote) {
+ Handle(C req, Repository remote) {
this.req = req;
this.remote = remote;
}
}
- private final UploadPackFactory<C> uploadPackFactory;
- private final ReceivePackFactory<C> receivePackFactory;
+ final UploadPackFactory<C> uploadPackFactory;
+ final ReceivePackFactory<C> receivePackFactory;
private final HashMap<URIish, Handle> handles;
/**
@@ -165,7 +165,7 @@ public class TestProtocol<C> extends TransportProtocol {
private class TransportInternal extends Transport implements PackTransport {
private final Handle handle;
- private TransportInternal(Repository local, URIish uri, Handle handle) {
+ TransportInternal(Repository local, URIish uri, Handle handle) {
super(local, uri);
this.handle = handle;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java
index 1ef3fbf627..5aae5ea21a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TrackingRefUpdate.java
@@ -52,10 +52,10 @@ import org.eclipse.jgit.lib.RefUpdate;
/** Update of a locally stored tracking branch. */
public class TrackingRefUpdate {
private final String remoteName;
- private final String localName;
- private boolean forceUpdate;
- private ObjectId oldObjectId;
- private ObjectId newObjectId;
+ final String localName;
+ boolean forceUpdate;
+ ObjectId oldObjectId;
+ ObjectId newObjectId;
private RefUpdate.Result result;
private ReceiveCommand cmd;
@@ -142,7 +142,7 @@ public class TrackingRefUpdate {
}
final class Command extends ReceiveCommand {
- private Command() {
+ Command() {
super(oldObjectId, newObjectId, localName);
}
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 f4de82147d..f0c513427a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
@@ -72,13 +72,13 @@ public class TransferConfig {
private final boolean safeForMacOS;
private final boolean allowTipSha1InWant;
private final boolean allowReachableSha1InWant;
- private final String[] hideRefs;
+ final String[] hideRefs;
TransferConfig(final Repository db) {
this(db.getConfig());
}
- private TransferConfig(final Config rc) {
+ TransferConfig(final Config rc) {
checkReceivedObjects = rc.getBoolean(
"fetch", "fsckobjects", //$NON-NLS-1$ //$NON-NLS-2$
rc.getBoolean("transfer", "fsckobjects", false)); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
index 745cdb72d5..7729c11ff9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
@@ -125,10 +125,10 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
};
/** User information necessary to connect to S3. */
- private final AmazonS3 s3;
+ final AmazonS3 s3;
/** Bucket the remote repository is stored in. */
- private final String bucket;
+ final String bucket;
/**
* Key prefix which all objects related to the repository start with.
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 b23771e952..594827886b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -218,16 +218,16 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
sslVerify = rc.getBoolean("http", "sslVerify", true); //$NON-NLS-1$ //$NON-NLS-2$
}
- private HttpConfig() {
+ HttpConfig() {
this(new Config());
}
}
- private final URL baseUrl;
+ final URL baseUrl;
private final URL objectsUrl;
- private final HttpConfig http;
+ final HttpConfig http;
private final ProxySelector proxySelector;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
index dc9dee55a4..1c6b8b7363 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
@@ -115,10 +115,10 @@ import org.eclipse.jgit.util.FileUtils;
*/
class WalkFetchConnection extends BaseFetchConnection {
/** The repository this transport fetches into, or pushes out of. */
- private final Repository local;
+ final Repository local;
/** If not null the validator for received objects. */
- private final ObjectChecker objCheck;
+ final ObjectChecker objCheck;
/**
* List of all remote repositories we may need to get objects out of.
@@ -180,12 +180,12 @@ class WalkFetchConnection extends BaseFetchConnection {
*/
private final HashMap<ObjectId, List<Throwable>> fetchErrors;
- private String lockMessage;
+ String lockMessage;
- private final List<PackLock> packLocks;
+ final List<PackLock> packLocks;
/** Inserter to write objects onto {@link #local}. */
- private final ObjectInserter inserter;
+ final ObjectInserter inserter;
/** Inserter to read objects from {@link #local}. */
private final ObjectReader reader;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
index deecb8e15f..4eaf3f9d8a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
@@ -103,7 +103,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
private final URIish uri;
/** Database connection to the remote repository. */
- private final WalkRemoteObjectDatabase dest;
+ final WalkRemoteObjectDatabase dest;
/** The configured transport we were constructed by. */
private final Transport transport;