Fix spelling in strings and comments
diff --git a/java/README.md b/java/README.md
index 83f91e1..0e0fba6 100644
--- a/java/README.md
+++ b/java/README.md
@@ -88,7 +88,7 @@
 
 * Protobuf minor version releases are backwards-compatible. If your code
   can build/run against the old version, it's expected to build/run against
-  the new version as well. Both binary compatibility and source compatbility
+  the new version as well. Both binary compatibility and source compatibility
   are guaranteed for minor version releases if the user follows the guideline
   described in this section.
 
@@ -98,7 +98,7 @@
 
 * APIs marked with the @ExperimentalApi annotation are subject to change. They
   can be modified in any way, or even removed, at any time. Don't use them if
-  compatiblity is needed. If your code is a library itself (i.e. it is used on
+  compatibility is needed. If your code is a library itself (i.e. it is used on
   the CLASSPATH of users outside your own control), you should not use
   experimental APIs, unless you repackage them (e.g. using ProGuard).
 
diff --git a/java/compatibility_tests/README.md b/java/compatibility_tests/README.md
index 2465941..72c6034 100644
--- a/java/compatibility_tests/README.md
+++ b/java/compatibility_tests/README.md
@@ -5,7 +5,7 @@
 
 ## Directory Layout
 
-For each released protobuf version we are testing compatiblity with, there
+For each released protobuf version we are testing compatibility with, there
 is a sub-directory with the following layout (take v2.5.0 as an example):
 
   * v2.5.0
@@ -47,4 +47,4 @@
   * only upgrading more_protos to the new version
 
 and see whether everything builds/runs fine. Both source compatibility and
-binary compatiblity will be tested.
+binary compatibility will be tested.
diff --git a/java/compatibility_tests/v2.5.0/test.sh b/java/compatibility_tests/v2.5.0/test.sh
index 05503bb..b7922b1 100755
--- a/java/compatibility_tests/v2.5.0/test.sh
+++ b/java/compatibility_tests/v2.5.0/test.sh
@@ -11,7 +11,7 @@
 
 # The old version of protobuf that we are testing compatibility against. This
 # is usually the same as TEST_VERSION (i.e., we use the tests extracted from
-# that version to test compatibilty of the newest runtime against it), but it
+# that version to test compatibility of the newest runtime against it), but it
 # is also possible to use this same test set to test the compatibiilty of the
 # latest version against other versions.
 case "$1" in
@@ -40,7 +40,7 @@
 # Extract the latest protobuf version number.
 VERSION_NUMBER=`grep "^  <version>.*</version>" ../../pom.xml | sed "s|  <version>\(.*\)</version>|\1|"`
 
-echo "Running compatibilty tests between $VERSION_NUMBER and $OLD_VERSION"
+echo "Running compatibility tests between $VERSION_NUMBER and $OLD_VERSION"
 
 # Check protoc
 [ -f ../../../src/protoc ] || {
@@ -55,7 +55,7 @@
   popd
 }
 
-# Download old version source for the compatiblity test
+# Download old version source for the compatibility test
 [ -d protobuf ] || {
   git clone https://github.com/google/protobuf.git
   cd protobuf
@@ -92,7 +92,7 @@
 # jar against the new runtime directly without recompile.
 
 # Collect all test dependencies in a single jar file (except for protobuf) to
-# make it easier to run binary compatibilty test (where we will need to run
+# make it easier to run binary compatibility test (where we will need to run
 # the jar files directly).
 cd deps
 mvn assembly:single
diff --git a/java/core/src/main/java/com/google/protobuf/AbstractMessage.java b/java/core/src/main/java/com/google/protobuf/AbstractMessage.java
index b8fdb2b..46ddbf4 100644
--- a/java/core/src/main/java/com/google/protobuf/AbstractMessage.java
+++ b/java/core/src/main/java/com/google/protobuf/AbstractMessage.java
@@ -498,7 +498,7 @@
      * override this method.
      */
     void markClean() {
-      throw new IllegalStateException("Should be overriden by subclasses.");
+      throw new IllegalStateException("Should be overridden by subclasses.");
     }
 
     /**
@@ -510,7 +510,7 @@
      * override this method.
      */
     void dispose() {
-      throw new IllegalStateException("Should be overriden by subclasses.");
+      throw new IllegalStateException("Should be overridden by subclasses.");
     }
 
     // ===============================================================
@@ -605,7 +605,7 @@
   }
 
   /**
-   * @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
+   * @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
    * generated code.
    */
   @Deprecated
@@ -614,7 +614,7 @@
   }
   //
   /**
-   * @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
+   * @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
    * generated code.
    */
   @Deprecated
@@ -623,7 +623,7 @@
   }
   //
   /**
-   * @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
+   * @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
    * generated code.
    */
   @Deprecated
@@ -632,7 +632,7 @@
   }
   //
   /**
-   * @deprecated from v3.0.0-beta-3+, for compatiblity with v2.5.0 and v2.6.1
+   * @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
    * generated code.
    */
   @Deprecated
diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java
index 62c9450..4965389 100644
--- a/java/core/src/main/java/com/google/protobuf/ByteString.java
+++ b/java/core/src/main/java/com/google/protobuf/ByteString.java
@@ -87,17 +87,17 @@
    * Empty {@code ByteString}.
    */
   public static final ByteString EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY);
-  
-  /** 
+
+  /**
    * An interface to efficiently copy {@code byte[]}.
-   * 
-   * <p>One of the noticable costs of copying a byte[] into a new array using 
-   * {@code System.arraycopy} is nullification of a new buffer before the copy. It has been shown 
+   *
+   * <p>One of the noticeable costs of copying a byte[] into a new array using
+   * {@code System.arraycopy} is nullification of a new buffer before the copy. It has been shown
    * the Hotspot VM is capable to intrisicfy {@code Arrays.copyOfRange} operation to avoid this
    * expensive nullification and provide substantial performance gain. Unfortunately this does not
    * hold on Android runtimes and could make the copy slightly slower due to additional code in
    * the {@code Arrays.copyOfRange}. Thus we provide two different implementation for array copier
-   * for Hotspot and Android runtimes. 
+   * for Hotspot and Android runtimes.
    */
   private interface ByteArrayCopier {
     /**
@@ -105,7 +105,7 @@
      */
     byte[] copyFrom(byte[] bytes, int offset, int size);
   }
-  
+
   /** Implementation of {@code ByteArrayCopier} which uses {@link System#arraycopy}. */
   private static final class SystemByteArrayCopier implements ByteArrayCopier {
     @Override
@@ -115,7 +115,7 @@
       return copy;
     }
   }
-  
+
   /** Implementation of {@code ByteArrayCopier} which uses {@link Arrays#copyOfRange}. */
   private static final class ArraysByteArrayCopier implements ByteArrayCopier {
     @Override
@@ -123,7 +123,7 @@
       return Arrays.copyOfRange(bytes, offset, offset + size);
     }
   }
-  
+
   private static final ByteArrayCopier byteArrayCopier;
   static {
     boolean isAndroid = true;
@@ -132,7 +132,7 @@
     } catch (ClassNotFoundException e) {
       isAndroid = false;
     }
-    
+
     byteArrayCopier = isAndroid ? new SystemByteArrayCopier() : new ArraysByteArrayCopier();
   }
 
@@ -309,7 +309,7 @@
   public static ByteString copyFrom(byte[] bytes) {
     return copyFrom(bytes, 0, bytes.length);
   }
-  
+
   /**
    * Wraps the given bytes into a {@code ByteString}. Intended for internal only
    * usage to force a classload of ByteString before LiteralByteString.
@@ -402,7 +402,7 @@
    * immutable tree of byte arrays ("chunks") of the stream data.  The
    * first chunk is small, with subsequent chunks each being double
    * the size, up to 8K.
-   * 
+   *
    * <p>Each byte read from the input stream will be copied twice to ensure
    * that the resulting ByteString is truly immutable.
    *
@@ -1226,7 +1226,7 @@
     return String.format("<ByteString@%s size=%d>",
         Integer.toHexString(System.identityHashCode(this)), size());
   }
-  
+
   /**
    * This class implements a {@link com.google.protobuf.ByteString} backed by a
    * single array of bytes, contiguous in memory. It supports substring by
@@ -1450,7 +1450,7 @@
       return 0;
     }
   }
-  
+
   /**
    * This class is used to represent the substring of a {@link ByteString} over a
    * single byte array. In terms of the public API of {@link ByteString}, you end
diff --git a/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java b/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
index 29e8d87..4764ca1 100644
--- a/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
+++ b/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java
@@ -55,7 +55,7 @@
     // correctly when linked only against the lite library.
 
     // We do however do some basic testing to make sure that equals is actually
-    // overriden to test for value equality rather than simple object equality.
+    // overridden to test for value equality rather than simple object equality.
 
     // Check that two identical objs are equal.
     Foo foo1a = Foo.newBuilder()