libcore: Add a libcore-patch-style script
Checks style against recommendations in http://go/libcore-patch-style
and could be used a repohook.
Update sources based on issues found with script.
Bug: 111597837
Test: cd tools/patch-style/ && awk -f libcore-patch-style.awk test-input.txt
Test: find . -type f | xargs awk -f tools/patch-style/libcore-patch-style.awk
Change-Id: I641ed2951d00b848dec7a713e08b4b9fc076baea
diff --git a/jsr166-tests/src/test/java/jsr166/JSR166TestCase.java b/jsr166-tests/src/test/java/jsr166/JSR166TestCase.java
index ea6e576..c073f1d 100644
--- a/jsr166-tests/src/test/java/jsr166/JSR166TestCase.java
+++ b/jsr166-tests/src/test/java/jsr166/JSR166TestCase.java
@@ -956,7 +956,7 @@
* Uninteresting threads are filtered out.
*/
static void dumpTestThreads() {
- // Android-change no ThreadMXBean
+ // Android-removed: no ThreadMXBean.
// ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
// System.err.println("------ stacktrace dump start ------");
// for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
@@ -1089,7 +1089,7 @@
* getPolicy/setPolicy.
*/
public void runWithPermissions(Runnable r, Permission... permissions) {
- // Android-changed: no SecurityManager
+ // Android-removed: no SecurityManager.
// SecurityManager sm = System.getSecurityManager();
// if (sm == null) {
// r.run();
@@ -1107,7 +1107,7 @@
*/
public void runWithSecurityManagerWithPermissions(Runnable r,
Permission... permissions) {
- // Android-changed: no SecurityManager
+ // Android-removed: no SecurityManager.
// SecurityManager sm = System.getSecurityManager();
// if (sm == null) {
// Policy savedPolicy = Policy.getPolicy();
diff --git a/luni/src/test/java/libcore/java/lang/OldClassTest.java b/luni/src/test/java/libcore/java/lang/OldClassTest.java
index f5bc787..e0955bc 100644
--- a/luni/src/test/java/libcore/java/lang/OldClassTest.java
+++ b/luni/src/test/java/libcore/java/lang/OldClassTest.java
@@ -306,7 +306,7 @@
}
}
- // AndroidOnly: Class.forName method throws ClassNotFoundException on Android.
+ // Android-note: Class.forName method throws ClassNotFoundException on Android.
public void test_forNameLjava_lang_StringLbooleanLClassLoader_AndroidOnly() throws Exception {
// Android doesn't support loading class files from a jar.
@@ -460,7 +460,7 @@
assertEquals(AbstractList.class, type.getRawType());
}
- // AndroidOnly: Uses dalvik.system.PathClassLoader.
+ // Android-note: Uses dalvik.system.PathClassLoader.
// Different behavior between cts host and run-core-test")
public void test_getPackage() {
diff --git a/luni/src/test/java/libcore/java/lang/SystemTest.java b/luni/src/test/java/libcore/java/lang/SystemTest.java
index 56b6558..939a9f3 100644
--- a/luni/src/test/java/libcore/java/lang/SystemTest.java
+++ b/luni/src/test/java/libcore/java/lang/SystemTest.java
@@ -160,7 +160,7 @@
}
public void testSystemProperties_immutable() {
- // Android-specific: The RI does not have a concept of immutable properties.
+ // Android-note: The RI does not have a concept of immutable properties.
// user.dir is an immutable property
String userDir = System.getProperty("user.dir");
@@ -223,10 +223,10 @@
System.setProperties(newProperties);
- // Android-specific: The RI makes the setProperties() argument the system properties object,
+ // Android-note: The RI makes the setProperties() argument the system properties object.
// Android makes a new Properties object and copies the properties.
assertNotSame(newProperties, System.getProperties());
- // Android-specific: The RI does not have a concept of immutable properties.
+ // Android-note: The RI does not have a concept of immutable properties.
assertEquals(userDir, System.getProperty("user.dir"));
assertEquals("v2", System.getProperty("p1"));
@@ -242,7 +242,7 @@
properties.clear();
- // Android-specific: The RI clears everything, Android resets to immutable defaults.
+ // Android-note: The RI clears everything, Android resets to immutable defaults.
assertEquals(userDir, System.getProperty("user.dir"));
assertNull(System.getProperty("p1"));
}
diff --git a/luni/src/test/java/libcore/java/text/OldDecimalFormatTestICU.java b/luni/src/test/java/libcore/java/text/OldDecimalFormatTestICU.java
index eb3f4ca..75344af 100644
--- a/luni/src/test/java/libcore/java/text/OldDecimalFormatTestICU.java
+++ b/luni/src/test/java/libcore/java/text/OldDecimalFormatTestICU.java
@@ -35,7 +35,7 @@
format = (DecimalFormat) NumberFormat.getNumberInstance();
}
- // AndroidOnly: special feature of icu4c
+ // Android-note: special feature of icu4c.
public void test_sigDigitPatterns() throws Exception {
DecimalFormat format = (DecimalFormat) NumberFormat
.getInstance(Locale.US);
@@ -62,7 +62,7 @@
}
}
- // AndroidOnly: special feature of icu4c
+ // Android-note: special feature of icu4c.
public void test_paddingPattern() throws Exception {
format.applyPattern("*x##,##,#,##0.0#");
assertEquals("xxxxxxxxx123.0", format.format(123));
@@ -95,7 +95,7 @@
}
}
- // AndroidOnly: special feature of icu4c
+ // Android-note: special feature of icu4c.
public void test_positiveExponentSign() throws Exception {
format.applyPattern("0.###E+0");
assertEquals("1E+2", format.format(100));
@@ -124,7 +124,7 @@
}
}
- // AndroidOnly: special feature of icu4c
+ // Android-note: special feature of icu4c.
public void test_secondaryGroupingSize() throws Exception {
format.applyPattern("#,##,###,####");
assertEquals("123,456,7890", format.format(1234567890));
diff --git a/ojluni/src/main/java/java/io/File.java b/ojluni/src/main/java/java/io/File.java
index 98956ca..0037534 100644
--- a/ojluni/src/main/java/java/io/File.java
+++ b/ojluni/src/main/java/java/io/File.java
@@ -518,7 +518,7 @@
/* -- Path operations -- */
- // Android-changed: Android-specific path information
+ // Android-changed: Android-specific path information.
/**
* Tests whether this abstract pathname is absolute. The definition of
* absolute pathname is system dependent. On Android, absolute paths start with
@@ -531,7 +531,7 @@
return fs.isAbsolute(this);
}
- // Android-changed: Android-specific path information
+ // Android-changed: Android-specific path information.
/**
* Returns the absolute path of this file. An absolute path is a path that starts at a root
* of the file system. On Android, there is only one root: {@code /}.
@@ -737,8 +737,7 @@
/* -- Attribute accessors -- */
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on android
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Tests whether the application can read the file denoted by this
* abstract pathname.
@@ -763,8 +762,7 @@
return fs.checkAccess(this, FileSystem.ACCESS_READ);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on android
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Tests whether the application can modify the file denoted by this
* abstract pathname.
@@ -1450,8 +1448,7 @@
return fs.setLastModifiedTime(this, time);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Marks the file or directory named by this abstract pathname so that
* only read operations are allowed. After invoking this method the file
@@ -1480,8 +1477,7 @@
return fs.setReadOnly(this);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Sets the owner's or everybody's write permission for this abstract
* pathname.
@@ -1523,8 +1519,7 @@
return fs.setPermission(this, FileSystem.ACCESS_WRITE, writable, ownerOnly);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* A convenience method to set the owner's write permission for this abstract
* pathname.
@@ -1554,8 +1549,7 @@
return setWritable(writable, true);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Sets the owner's or everybody's read permission for this abstract
* pathname.
@@ -1600,8 +1594,7 @@
return fs.setPermission(this, FileSystem.ACCESS_READ, readable, ownerOnly);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* A convenience method to set the owner's read permission for this abstract
* pathname.
@@ -1634,8 +1627,7 @@
return setReadable(readable, true);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Sets the owner's or everybody's execute permission for this abstract
* pathname.
@@ -1680,8 +1672,7 @@
return fs.setPermission(this, FileSystem.ACCESS_EXECUTE, executable, ownerOnly);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* A convenience method to set the owner's execute permission for this
* abstract pathname.
@@ -1714,8 +1705,7 @@
return setExecutable(executable, true);
}
- // Android-changed. Removed javadoc comment about special privileges
- // that doesn't make sense on Android.
+ // Android-changed: Removed inapplicable javadoc comment about special privileges.
/**
* Tests whether the application can execute the file denoted by this
* abstract pathname.
@@ -1873,8 +1863,7 @@
private static class TempDirectory {
private TempDirectory() { }
- // Android-changed: Don't cache java.io.tmpdir value
- // temporary directory location.
+ // Android-changed: Don't cache java.io.tmpdir value temporary directory location.
/*
private static final File tmpdir = new File(AccessController
.doPrivileged(new GetPropertyAction("java.io.tmpdir")));
@@ -1888,8 +1877,8 @@
static File generateFile(String prefix, String suffix, File dir)
throws IOException
{
- // Android-changed: Use Math.randomIntInternal. This (pseudo) random number
- // is initialized post-fork
+ // Android-changed: Use Math.randomIntInternal.
+ // This (pseudo) random number is initialized post-fork.
long n = Math.randomLongInternal();
if (n == Long.MIN_VALUE) {
@@ -1898,7 +1887,7 @@
n = Math.abs(n);
}
- // Android-changed: Reject invalid file prefixes
+ // Android-changed: Reject invalid file prefixes.
// Use only the file name from the supplied prefix
// prefix = (new File(prefix)).getName();
diff --git a/ojluni/src/main/java/java/io/FileDescriptor.java b/ojluni/src/main/java/java/io/FileDescriptor.java
index 98db443..8584020 100644
--- a/ojluni/src/main/java/java/io/FileDescriptor.java
+++ b/ojluni/src/main/java/java/io/FileDescriptor.java
@@ -47,11 +47,11 @@
* @since JDK1.0
*/
public final class FileDescriptor {
- // Android-changed: Removed parent reference counting. Creator is responsible for closing
- // the file descriptor.
+ // Android-changed: Removed parent reference counting.
+ // The creator is responsible for closing the file descriptor.
- // Android-changed: Renamed fd to descriptor to avoid issues with JNI/reflection
- // fetching the descriptor value.
+ // Android-changed: Renamed fd to descriptor.
+ // Renaming is to avoid issues with JNI/reflection fetching the descriptor value.
private int descriptor;
// Android-added: Track fd owner to guard against accidental closure. http://b/110100358
@@ -142,11 +142,11 @@
*/
public native void sync() throws SyncFailedException;
- // Android-removed: initIDs not used to allow compile-time intialization
+ // Android-removed: initIDs not used to allow compile-time initialization.
/* This routine initializes JNI field offsets for the class */
//private static native void initIDs();
- // Android-added: Needed for framework to access descriptor value
+ // Android-added: Needed for framework to access descriptor value.
/**
* Returns the int descriptor. It's highly unlikely you should be calling this. Please discuss
* your needs with a libcore maintainer before using this method.
@@ -156,7 +156,7 @@
return descriptor;
}
- // Android-added: Needed for framework to access descriptor value
+ // Android-added: Needed for framework to access descriptor value.
/**
* Sets the int descriptor. It's highly unlikely you should be calling this. Please discuss
* your needs with a libcore maintainer before using this method.
@@ -223,7 +223,7 @@
}
// END Android-added: Methods to enable ownership enforcement of Unix file descriptors.
- // Android-added: Needed for framework to test if it's a socket
+ // Android-added: Needed for framework to test if it's a socket.
/**
* @hide internal use only
*/
@@ -254,5 +254,5 @@
}
);
}
-// Android-removed: Removed method required for parents reference counting
+// Android-removed: Removed method required for parents reference counting.
}
diff --git a/ojluni/src/main/java/java/io/ObjectOutputStream.java b/ojluni/src/main/java/java/io/ObjectOutputStream.java
index ccec944..1f7f901 100644
--- a/ojluni/src/main/java/java/io/ObjectOutputStream.java
+++ b/ojluni/src/main/java/java/io/ObjectOutputStream.java
@@ -1223,7 +1223,7 @@
writeClass((Class) obj, unshared);
} else if (obj instanceof ObjectStreamClass) {
writeClassDesc((ObjectStreamClass) obj, unshared);
- // END Android-changed: Make Class and ObjectStreamClass replaceable.
+ // END Android-changed: Make Class and ObjectStreamClass replaceable.
} else if (obj instanceof String) {
writeString((String) obj, unshared);
} else if (cl.isArray()) {
@@ -1865,7 +1865,7 @@
return blkmode;
}
- // BEGIN Android-added: Warning about writing to closed ObjectOutputStream
+ // BEGIN Android-added: Warning about writing to closed ObjectOutputStream.
/**
* Warns if the stream has been closed.
*
@@ -1884,7 +1884,7 @@
warnOnceWhenWriting = false;
}
}
- // END Android-added: Warning about writing to closed ObjectOutputStream
+ // END Android-added: Warning about writing to closed ObjectOutputStream.
/* ----------------- generic output stream methods ----------------- */
/*
@@ -1916,7 +1916,7 @@
public void close() throws IOException {
flush();
out.close();
- // Android-added: Warning about writing to closed ObjectOutputStream
+ // Android-added: Warning about writing to closed ObjectOutputStream.
warnOnceWhenWriting = true;
}
@@ -1932,7 +1932,7 @@
if (!(copy || blkmode)) { // write directly
drain();
out.write(b, off, len);
- // Android-added: Warning about writing to closed ObjectOutputStream
+ // Android-added: Warning about writing to closed ObjectOutputStream.
warnIfClosed();
return;
}
@@ -1955,7 +1955,7 @@
len -= wlen;
}
}
- // Android-added: Warning about writing to closed ObjectOutputStream
+ // Android-added: Warning about writing to closed ObjectOutputStream.
warnIfClosed();
}
@@ -1972,7 +1972,7 @@
}
out.write(buf, 0, pos);
pos = 0;
- // Android-added: Warning about writing to closed ObjectOutputStream
+ // Android-added: Warning about writing to closed ObjectOutputStream.
warnIfClosed();
}
@@ -1991,7 +1991,7 @@
Bits.putInt(hbuf, 1, len);
out.write(hbuf, 0, 5);
}
- // Android-added: Warning about writing to closed ObjectOutputStream
+ // Android-added: Warning about writing to closed ObjectOutputStream.
warnIfClosed();
}
diff --git a/ojluni/src/main/java/java/io/ObjectStreamClass.java b/ojluni/src/main/java/java/io/ObjectStreamClass.java
index a88ad63..9a1a48f 100644
--- a/ojluni/src/main/java/java/io/ObjectStreamClass.java
+++ b/ojluni/src/main/java/java/io/ObjectStreamClass.java
@@ -1425,12 +1425,12 @@
{
return null;
}
- // BEGIN Android-changed: Serialization constructor obtained differently
+ // BEGIN Android-changed: Serialization constructor obtained differently.
// cons = reflFactory.newConstructorForSerialization(cl, cons);
if (cons.getDeclaringClass() != cl) {
cons = cons.serializationCopy(cons.getDeclaringClass(), cl);
}
- // END Android-changed: Serialization constructor obtained differently
+ // END Android-changed: Serialization constructor obtained differently.
cons.setAccessible(true);
return cons;
} catch (NoSuchMethodException ex) {
@@ -1797,7 +1797,7 @@
}
}
- // BEGIN Android-changed: Fix/log clinit serialization workaround b/29064453
+ // BEGIN Android-changed: Fix/log clinit serialization workaround. b/29064453
// Prior to SDK 24 hasStaticInitializer() would return true if the superclass had a
// static initializer, that was contrary to the specification. In SDK 24 the default
// behavior was corrected but the old behavior was preserved for apps that targeted 23
@@ -1817,7 +1817,7 @@
// instructions to the developer on how to fix the problems.
warnIncompatibleSUIDChange = true;
}
- // END Android-changed: Fix/log clinit serialization workaround b/29064453
+ // END Android-changed: Fix/log clinit serialization workaround. b/29064453
dout.writeUTF("<clinit>");
dout.writeInt(Modifier.STATIC);
dout.writeUTF("()V");
@@ -1882,14 +1882,14 @@
for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) {
hash = (hash << 8) | (hashBytes[i] & 0xFF);
}
- // BEGIN Android-added: Fix/log clinit serialization workaround b/29064453
+ // BEGIN Android-added: Fix/log clinit serialization workaround. b/29064453
// ObjectStreamClass instances are cached per Class and caches its default
// serialVersionUID so it will only log one message per class per app process
// irrespective of the number of times the class is serialized.
if (warnIncompatibleSUIDChange) {
suidCompatibilityListener.warnDefaultSUIDTargetVersionDependent(cl, hash);
}
- // END Android-added: Fix/log clinit serialization workaround b/29064453
+ // END Android-added: Fix/log clinit serialization workaround. b/29064453
return hash;
} catch (IOException ex) {
throw new InternalError(ex);
@@ -1898,7 +1898,7 @@
}
}
- // BEGIN Android-changed: Fix/log clinit serialization workaround b/29064453
+ // BEGIN Android-changed: Fix/log clinit serialization workaround. b/29064453
/**
* Created for testing as there is no nice way to detect when a message is logged.
*
@@ -1943,7 +1943,7 @@
*/
private native static boolean hasStaticInitializer(
Class<?> cl, boolean inheritStaticInitializer);
- // END Android-changed: Fix/log clinit serialization workaround b/29064453
+ // END Android-changed: Fix/log clinit serialization workaround. b/29064453
/**
* Class for computing and caching field/constructor/method signatures
diff --git a/ojluni/src/main/java/java/lang/Class.java b/ojluni/src/main/java/java/lang/Class.java
index f792248..478c339 100644
--- a/ojluni/src/main/java/java/lang/Class.java
+++ b/ojluni/src/main/java/java/lang/Class.java
@@ -1135,7 +1135,7 @@
* that class is a local or anonymous class; otherwise {@code null}.
* @since 1.5
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
public Method getEnclosingMethod() {
if (classNameImpliesTopLevel()) {
return null;
@@ -1157,7 +1157,7 @@
* that class is a local or anonymous class; otherwise {@code null}.
* @since 1.5
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
public Constructor<?> getEnclosingConstructor() {
if (classNameImpliesTopLevel()) {
return null;
@@ -1184,7 +1184,7 @@
* @return the declaring class for this class
* @since JDK1.1
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
@FastNative
public native Class<?> getDeclaringClass();
@@ -1195,7 +1195,7 @@
* @return the immediately enclosing class of the underlying class
* @since 1.5
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
@FastNative
public native Class<?> getEnclosingClass();
@@ -1593,7 +1593,7 @@
* @jls 8.2 Class Members
* @jls 8.3 Field Declarations
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
public Field getField(String name)
throws NoSuchFieldException {
if (name == null) {
@@ -1764,7 +1764,7 @@
*
* @since JDK1.1
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
@FastNative
public native Class<?>[] getDeclaredClasses();
@@ -1810,7 +1810,7 @@
* @jls 8.2 Class Members
* @jls 8.3 Field Declarations
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
@FastNative
public native Field[] getDeclaredFields();
@@ -1986,7 +1986,7 @@
* @jls 8.2 Class Members
* @jls 8.3 Field Declarations
*/
- // Android-changed: Removed SecurityException
+ // Android-changed: Removed SecurityException.
@FastNative
public native Field getDeclaredField(String name) throws NoSuchFieldException;
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index d06db86..0ff38a6 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -485,10 +485,10 @@
this.name = name;
Thread parent = currentThread();
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
// SecurityManager security = System.getSecurityManager();
if (g == null) {
- // Android-changed: SecurityManager stubbed out on Android
+ // Android-changed: SecurityManager stubbed out on Android.
/*
/* Determine if it's an applet or not *
@@ -506,7 +506,7 @@
// }
}
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
/*
/* checkAccess regardless of whether or not threadgroup is
explicitly passed in. *
@@ -1579,7 +1579,7 @@
* @see SecurityManager#checkAccess(Thread)
*/
public final void checkAccess() {
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
// SecurityManager security = System.getSecurityManager();
// if (security != null) {
// security.checkAccess(this);
@@ -1631,7 +1631,7 @@
*/
@CallerSensitive
public ClassLoader getContextClassLoader() {
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
/*
if (contextClassLoader == null)
return null;
@@ -1667,7 +1667,7 @@
* @since 1.2
*/
public void setContextClassLoader(ClassLoader cl) {
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
// SecurityManager sm = System.getSecurityManager();
// if (sm != null) {
// sm.checkPermission(new RuntimePermission("setContextClassLoader"));
@@ -1774,7 +1774,7 @@
* @since 1.5
*/
public static Map<Thread, StackTraceElement[]> getAllStackTraces() {
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
/*
// check for getStackTrace permission
SecurityManager security = System.getSecurityManager();
@@ -2098,7 +2098,7 @@
* @since 1.5
*/
public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh) {
- // Android-removed: SecurityManager stubbed out on Android
+ // Android-removed: SecurityManager stubbed out on Android.
/*
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
diff --git a/ojluni/src/main/java/java/lang/Throwable.java b/ojluni/src/main/java/java/lang/Throwable.java
index 5a3f8a8..7596681 100644
--- a/ojluni/src/main/java/java/lang/Throwable.java
+++ b/ojluni/src/main/java/java/lang/Throwable.java
@@ -155,7 +155,7 @@
new StackTraceElement[] {STACK_TRACE_ELEMENT_SENTINEL};
}
- // Android-removed: Use libcore.util.EmptyArray for the empty stack trace
+ // Android-removed: Use libcore.util.EmptyArray for the empty stack trace.
// Adding the constant UNASSIGNED_STACK breaks serialization of some subclasses
// /**
// * A shared value for an empty stack.
@@ -211,11 +211,11 @@
* @serial
* @since 1.4
*/
- // Android-changed: Use libcore.util.EmptyArray for the empty stack trace
+ // Android-changed: Use libcore.util.EmptyArray for the empty stack trace.
// private StackTraceElement[] stackTrace = UNASSIGNED_STACK;
private StackTraceElement[] stackTrace = libcore.util.EmptyArray.STACK_TRACE_ELEMENT;
- // Android-removed: Use empty collection in place of SUPPRESSED_SENTINEL
+ // Android-removed: Use empty collection in place of SUPPRESSED_SENTINEL.
// Adding this constant breaks serialization of some subclasses
/*
// Setting this static field introduces an acceptable
@@ -234,7 +234,7 @@
* @serial
* @since 1.7
*/
- // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL
+ // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL.
// private List<Throwable> suppressedExceptions = SUPPRESSED_SENTINEL;
private List<Throwable> suppressedExceptions = Collections.emptyList();
@@ -689,7 +689,7 @@
String caption,
String prefix,
Set<Throwable> dejaVu) {
- // Android-removed: Use of assert keyword which breaks serialization of some subclasses
+ // Android-removed: Use of assert keyword which breaks serialization of some subclasses.
// (Using assert adds a static field that determines whether assertions are enabled.)
// assert Thread.holdsLock(s.lock());
if (dejaVu.contains(this)) {
@@ -794,17 +794,17 @@
public synchronized Throwable fillInStackTrace() {
if (stackTrace != null ||
backtrace != null /* Out of protocol state */ ) {
- // Android-changed: Use Android-specific nativeFillInStackTrace
+ // Android-changed: Use Android-specific nativeFillInStackTrace.
// fillInStackTrace(0);
backtrace = nativeFillInStackTrace();
- // Android-changed: Use libcore.util.EmptyArray for the empty stack trace
+ // Android-changed: Use libcore.util.EmptyArray for the empty stack trace.
// stackTrace = UNASSIGNED_STACK;
stackTrace = libcore.util.EmptyArray.STACK_TRACE_ELEMENT;
}
return this;
}
- // Android-changed: Use Android-specific nativeFillInStackTrace
+ // Android-changed: Use Android-specific nativeFillInStackTrace.
// private native Throwable fillInStackTrace(int dummy);
@FastNative
private static native Object nativeFillInStackTrace();
@@ -840,11 +840,11 @@
private synchronized StackTraceElement[] getOurStackTrace() {
// Initialize stack trace field with information from
// backtrace if this is the first call to this method
- // Android-changed: Use libcore.util.EmptyArray for the empty stack trace
+ // Android-changed: Use libcore.util.EmptyArray for the empty stack trace.
// if (stackTrace == UNASSIGNED_STACK ||
if (stackTrace == libcore.util.EmptyArray.STACK_TRACE_ELEMENT ||
(stackTrace == null && backtrace != null) /* Out of protocol state */) {
- // BEGIN Android-changed: Use Android-specific nativeGetStackTrace
+ // BEGIN Android-changed: Use Android-specific nativeGetStackTrace.
// int depth = getStackTraceDepth();
// stackTrace = new StackTraceElement[depth];
// for (int i=0; i < depth; i++)
@@ -854,9 +854,9 @@
if (stackTrace == null) {
return libcore.util.EmptyArray.STACK_TRACE_ELEMENT;
}
- // END Android-changed: Use Android-specific nativeGetStackTrace
+ // END Android-changed: Use Android-specific nativeGetStackTrace.
} else if (stackTrace == null) {
- // Android-changed: Use libcore.util.EmptyArray for the empty stack trace
+ // Android-changed: Use libcore.util.EmptyArray for the empty stack trace.
// return UNASSIGNED_STACK;
return libcore.util.EmptyArray.STACK_TRACE_ELEMENT;
}
@@ -907,7 +907,7 @@
}
}
- // Android-removed: Unused native method getStackTraceDepth()
+ // Android-removed: Unused native method getStackTraceDepth().
// /**
// * Returns the number of elements in the stack trace (or 0 if the stack
// * trace is unavailable).
@@ -925,7 +925,7 @@
* @throws IndexOutOfBoundsException if {@code index < 0 ||
* index >= getStackTraceDepth() }
*/
- // Android-changed: Use Android-specific nativeGetStackTrace
+ // Android-changed: Use Android-specific nativeGetStackTrace.
// native StackTraceElement getStackTraceElement(int index);
@FastNative
private static native StackTraceElement[] nativeGetStackTrace(Object stackState);
@@ -953,7 +953,7 @@
List<Throwable> suppressed = null;
if (suppressedExceptions.isEmpty()) {
// Use the sentinel for a zero-length list
- // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL
+ // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL.
// suppressed = SUPPRESSED_SENTINEL;
suppressed = Collections.emptyList();
} else { // Copy Throwables to new list
@@ -982,7 +982,7 @@
*/
if (stackTrace != null) {
if (stackTrace.length == 0) {
- // Android-removed: clone() call not needed because of libcore.util.EmptyArray usage
+ // Android-removed: clone() call unneeded because of libcore.util.EmptyArray usage.
// stackTrace = UNASSIGNED_STACK.clone();
} else if (stackTrace.length == 1 &&
// Check for the marker of an immutable stack trace
@@ -999,7 +999,7 @@
// from an exception serialized without that field in
// older JDK releases; treat such exceptions as having
// empty stack traces.
- // Android-changed: Directly create empty array instead of cloning UNASSIGNED_STACK
+ // Android-changed: Directly create empty array instead of cloning UNASSIGNED_STACK.
// stackTrace = UNASSIGNED_STACK.clone();
stackTrace = new StackTraceElement[0];
}
@@ -1090,7 +1090,7 @@
if (suppressedExceptions == null) // Suppressed exceptions not recorded
return;
- // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL
+ // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL.
// if (suppressedExceptions == SUPPRESSED_SENTINEL)
if (suppressedExceptions.isEmpty())
suppressedExceptions = new ArrayList<>(1);
@@ -1098,7 +1098,7 @@
suppressedExceptions.add(exception);
}
- // Android-changed: Lazily initialize EMPTY_THROWABLE_ARRAY
+ // Android-changed: Lazily initialize EMPTY_THROWABLE_ARRAY.
// private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];
private static Throwable[] EMPTY_THROWABLE_ARRAY;
@@ -1118,12 +1118,12 @@
* @since 1.7
*/
public final synchronized Throwable[] getSuppressed() {
- // Android-added: Lazily initialize EMPTY_THROWABLE_ARRAY
+ // Android-added: Lazily initialize EMPTY_THROWABLE_ARRAY.
if (EMPTY_THROWABLE_ARRAY == null) {
EMPTY_THROWABLE_ARRAY = new Throwable[0];
}
- // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL
+ // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL.
// if (suppressedExceptions == SUPPRESSED_SENTINEL ||
// suppressedExceptions == null)
if (suppressedExceptions == null || suppressedExceptions.isEmpty())
diff --git a/ojluni/src/main/java/java/lang/invoke/CallSite.java b/ojluni/src/main/java/java/lang/invoke/CallSite.java
index 85b4bb9..069b2fd 100644
--- a/ojluni/src/main/java/java/lang/invoke/CallSite.java
+++ b/ojluni/src/main/java/java/lang/invoke/CallSite.java
@@ -25,7 +25,7 @@
package java.lang.invoke;
-// Android-changed: Not using Empty
+// Android-changed: Not using Empty.
//import sun.invoke.empty.Empty;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
@@ -104,9 +104,10 @@
*/
/*package-private*/
CallSite(MethodType type) {
- // Android-changed: No cache for these so create uninitializedCallSite target here using
- // method handle transformations to create a method handle that has the expected method
- // type but throws an IllegalStateException.
+ // Android-changed: No cache for these.
+ // Instead create uninitializedCallSite target here using method handle transformations
+ // to create a method handle that has the expected method type but throws an
+ // IllegalStateException.
// target = makeUninitializedCallSite(type);
this.target = MethodHandles.throwException(type.returnType(), IllegalStateException.class);
this.target = MethodHandles.insertArguments(
@@ -115,8 +116,7 @@
this.target = MethodHandles.dropArguments(this.target, 0, type.ptypes());
}
- // Android-changed: Using initializer method for GET_TARGET
- // rather than complex static initializer.
+ // Android-changed: Using initializer method for GET_TARGET instead of static initializer.
initializeGetTarget();
}
@@ -130,8 +130,7 @@
target.type(); // null check
this.target = target;
- // Android-changed: Using initializer method for GET_TARGET
- // rather than complex static initializer.
+ // Android-changed: Using initializer method for GET_TARGET instead of static initializer.
initializeGetTarget();
}
@@ -153,8 +152,7 @@
checkTargetChange(this.target, boundTarget);
this.target = boundTarget;
- // Android-changed: Using initializer method for GET_TARGET
- // rather than complex static initializer.
+ // Android-changed: Using initializer method for GET_TARGET instead of static initializer.
initializeGetTarget();
}
@@ -244,9 +242,9 @@
private static MethodHandle GET_TARGET = null;
private void initializeGetTarget() {
- // Android-changed: moved from static initializer for
- // GET_TARGET to avoid issues with running early. Called from
- // constructors. CallSite creation is not performance critical.
+ // Android-changed: moved from static initializer for GET_TARGET.
+ // This avoids issues with running early. Called from constructors.
+ // CallSite creation is not performance critical.
synchronized (CallSite.class) {
if (GET_TARGET == null) {
try {
diff --git a/ojluni/src/main/java/java/lang/reflect/Array.java b/ojluni/src/main/java/java/lang/reflect/Array.java
index 95a8091..db7e9a2 100644
--- a/ojluni/src/main/java/java/lang/reflect/Array.java
+++ b/ojluni/src/main/java/java/lang/reflect/Array.java
@@ -111,7 +111,7 @@
*/
public static Object newInstance(Class<?> componentType, int... dimensions)
throws IllegalArgumentException, NegativeArraySizeException {
- // Android-changed: New implementation of newInstance(Class, int...)
+ // Android-changed: New implementation of newInstance(Class, int...).
if (dimensions.length <= 0 || dimensions.length > 255) {
throw new IllegalArgumentException("Bad number of dimensions: " + dimensions.length);
}
@@ -132,7 +132,7 @@
* @exception IllegalArgumentException if the object argument is not
* an array
*/
- // Android-changed: Non-native implementation of getLength(Object)
+ // Android-changed: Non-native implementation of getLength(Object).
// Android-changed: Removal of explicit throws IllegalArgumentException from method signature.
public static int getLength(Object array)
/* throws IllegalArgumentException */ {
@@ -174,7 +174,7 @@
* argument is negative, or if it is greater than or equal to the
* length of the specified array
*/
- // Android-changed: Non-native implementation of get(Object, int)
+ // Android-changed: Non-native implementation of get(Object, int).
public static Object get(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof Object[]) {
@@ -226,7 +226,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getBoolean(Object, int)
+ // Android-changed: Non-native implementation of getBoolean(Object, int).
public static boolean getBoolean(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof boolean[]) {
@@ -251,7 +251,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getByte(Object, int)
+ // Android-changed: Non-native implementation of getByte(Object, int).
public static byte getByte(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof byte[]) {
@@ -276,7 +276,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getChar(Object, int)
+ // Android-changed: Non-native implementation of getChar(Object, int).
public static char getChar(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof char[]) {
@@ -301,7 +301,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getShort(Object, int)
+ // Android-changed: Non-native implementation of getShort(Object, int).
public static short getShort(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof short[]) {
@@ -328,7 +328,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getInt(Object, int)
+ // Android-changed: Non-native implementation of getInt(Object, int).
public static int getInt(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof int[]) {
@@ -359,7 +359,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getLong(Object, int)
+ // Android-changed: Non-native implementation of getLong(Object, int).
public static long getLong(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof long[]) {
@@ -392,7 +392,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getFloat(Object, int)
+ // Android-changed: Non-native implementation of getFloat(Object, int).
public static float getFloat(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof float[]) {
@@ -427,7 +427,7 @@
* length of the specified array
* @see Array#get
*/
- // Android-changed: Non-native implementation of getDouble(Object, int)
+ // Android-changed: Non-native implementation of getDouble(Object, int).
public static double getDouble(Object array, int index)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof double[]) {
@@ -465,7 +465,7 @@
* argument is negative, or if it is greater than or equal to
* the length of the specified array
*/
- // Android-changed: Non-native implementation of set(Object, int, Object)
+ // Android-changed: Non-native implementation of set(Object, int, Object).
public static void set(Object array, int index, Object value)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (!array.getClass().isArray()) {
@@ -518,8 +518,8 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setBoolean(Object, int, boolean)
- // Android-changed: Removal of explicit runtime exceptions throws clause
+ // Android-changed: Non-native implementation of setBoolean(Object, int, boolean).
+ // Android-changed: Removal of explicit runtime exceptions throws clause.
public static void setBoolean(Object array, int index, boolean z)
/* throws IllegalArgumentException, ArrayIndexOutOfBoundsException */ {
if (array instanceof boolean[]) {
@@ -546,7 +546,7 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setByte(Object, int, byte)
+ // Android-changed: Non-native implementation of setByte(Object, int, byte).
public static void setByte(Object array, int index, byte b)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof byte[]) {
@@ -583,7 +583,7 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setChar(Object, int, char)
+ // Android-changed: Non-native implementation of setChar(Object, int, char).
public static void setChar(Object array, int index, char c)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof char[]) {
@@ -618,7 +618,7 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setShort(Object, int, short)
+ // Android-changed: Non-native implementation of setShort(Object, int, short).
public static void setShort(Object array, int index, short s)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof short[]) {
@@ -653,7 +653,7 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setInt(Object, int, int)
+ // Android-changed: Non-native implementation of setInt(Object, int, int).
public static void setInt(Object array, int index, int i)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof int[]) {
@@ -686,7 +686,7 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setBoolean(Object, int, long)
+ // Android-changed: Non-native implementation of setBoolean(Object, int, long).
public static void setLong(Object array, int index, long l)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof long[]) {
@@ -745,7 +745,7 @@
* the length of the specified array
* @see Array#set
*/
- // Android-changed: Non-native implementation of setDouble(Object, int, double)
+ // Android-changed: Non-native implementation of setDouble(Object, int, double).
public static void setDouble(Object array, int index, double d)
throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
if (array instanceof double[]) {
@@ -759,7 +759,7 @@
* Private
*/
- // Android-added: Added javadocs for newArray(Class, int)
+ // Android-added: Added javadocs for newArray(Class, int).
/**
* Returns a new array of the specified component type and length.
* Equivalent to {@code new componentType[size]}.
@@ -769,7 +769,7 @@
* @throws NegativeArraySizeException
* if {@code size < 0}
*/
- // Android-changed: Non-native implementation of newArray(Class, int)
+ // Android-changed: Non-native implementation of newArray(Class, int).
private static Object newArray(Class<?> componentType, int length)
throws NegativeArraySizeException {
if (!componentType.isPrimitive()) {
@@ -803,7 +803,7 @@
throws IllegalArgumentException, NegativeArraySizeException;
*/
- // Android-added: createMultiArray(Class, int[]) method. Used instead of multiNewArray
+ // Android-added: createMultiArray(Class, int[]) method. Used instead of multiNewArray.
/*
* Create a multi-dimensional array of objects with the specified type.
*/
diff --git a/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java b/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java
index a3c738a..df3b6ed 100644
--- a/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java
+++ b/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java
@@ -55,7 +55,7 @@
protected InetAddress connectedAddress = null;
private int connectedPort = -1;
- // Android-added: CloseGuard
+ // Android-added: CloseGuard.
private final CloseGuard guard = CloseGuard.get();
private static final String os = AccessController.doPrivileged(
@@ -67,7 +67,7 @@
*/
private final static boolean connectDisabled = os.contains("OS X");
- // BEGIN Android-removed: Android doesn't need to load native net library
+ // BEGIN Android-removed: Android doesn't need to load native net library.
/**
* Load net library into runtime.
*
@@ -81,7 +81,7 @@
});
}
*/
- // END Android-removed: Android doesn't need to load native net library
+ // END Android-removed: Android doesn't need to load native net library.
/**
* Creates a datagram socket
@@ -97,7 +97,7 @@
throw ioe;
}
- // Android-added: CloseGuard/fdsan
+ // Android-added: CloseGuard/fdsan.
if (fd != null && fd.valid()) {
guard.open("close");
IoUtils.setFdOwner(fd, this);
@@ -130,7 +130,7 @@
* @param port the remote port number
*/
protected void connect(InetAddress address, int port) throws SocketException {
- // Android-added: BlockGuard
+ // Android-added: BlockGuard.
BlockGuard.getThreadPolicy().onNetwork();
connect0(address, port);
connectedAddress = address;
@@ -248,7 +248,7 @@
* Close the socket.
*/
protected void close() {
- // Android-added: CloseGuard
+ // Android-added: CloseGuard.
guard.close();
if (fd != null) {
@@ -263,7 +263,7 @@
}
protected void finalize() {
- // Android-added: CloseGuard
+ // Android-added: CloseGuard.
if (guard != null) {
guard.warnIfOpen();
}
@@ -375,7 +375,7 @@
case SO_REUSEADDR:
case SO_BROADCAST:
result = socketGetOption(optID);
- // Android-added: Added for app compat reason. See methodgetNIFirstAddress
+ // Android-added: Added for app compat reason. See methodgetNIFirstAddress.
if (optID == IP_MULTICAST_IF) {
return getNIFirstAddress((Integer)result);
}
@@ -422,7 +422,7 @@
return connectDisabled;
}
- // Android-changed: rewritten on the top of IoBridge
+ // Android-changed: rewritten on the top of IoBridge.
int dataAvailable() {
try {
return IoBridge.available(fd);
diff --git a/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java b/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java
index 0500811..963b2ac 100644
--- a/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java
+++ b/ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java
@@ -50,7 +50,7 @@
{
/* instance variable for SO_TIMEOUT */
int timeout; // timeout in millisec
- // Android-removed: traffic class is set through socket
+ // Android-removed: traffic class is set through socket.
// private int trafficClass;
private boolean shut_rd = false;
@@ -63,7 +63,7 @@
protected int fdUseCount = 0;
/* lock when increment/decrementing fdUseCount */
- // Android-added: @ReachabilitySensitive
+ // Android-added: @ReachabilitySensitive.
// Marked mostly because it's used where fd is, and fd isn't declared here.
// This adds reachabilityFences where we would if fd were annotated.
@ReachabilitySensitive
@@ -83,7 +83,7 @@
*/
protected boolean stream;
- // BEGIN Android-removed: Android doesn't need to load native net library
+ // BEGIN Android-removed: Android doesn't need to load native net library.
/*
/**
* Load net library into runtime.
@@ -98,9 +98,9 @@
});
}
*/
- // END Android-removed: Android doesn't need to load native net library
+ // END Android-removed: Android doesn't need to load native net library.
- // Android-added: logs a warning if socket is not closed
+ // Android-added: logs a warning if socket is not closed.
@ReachabilitySensitive
private final CloseGuard guard = CloseGuard.get();
@@ -112,18 +112,18 @@
this.stream = stream;
if (!stream) {
ResourceManager.beforeUdpCreate();
- // Android-removed: socketCreate should set fd if it succeeds
+ // Android-removed: socketCreate should set fd if it succeeds.
// fd = new FileDescriptor();
try {
socketCreate(false);
} catch (IOException ioe) {
ResourceManager.afterUdpClose();
- // Android-removed: b/26470377 Represent closed sockets with invalid fd, not null.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
// fd = null;
throw ioe;
}
} else {
- // Android-removed: socketCreate should set fd if it succeeds
+ // Android-removed: socketCreate should set fd if it succeeds.
// fd = new FileDescriptor();
socketCreate(true);
}
@@ -132,7 +132,7 @@
if (serverSocket != null)
serverSocket.setCreated();
- // Android-added: CloseGuard
+ // Android-added: CloseGuard.
if (fd != null && fd.valid()) {
guard.open("close");
}
@@ -301,7 +301,7 @@
socketSetOption(opt, on, val);
*/
// END Android-removed: Logic dealing with value type moved to socketSetOption.
- // Android-added: Keep track of timeout value not handled by socketSetOption
+ // Android-added: Keep track of timeout value not handled by socketSetOption.
if (opt == SO_TIMEOUT) {
timeout = (Integer) val;
}
@@ -385,7 +385,7 @@
try {
acquireFD();
try {
- // Android-added: BlockGuard
+ // Android-added: BlockGuard.
BlockGuard.getThreadPolicy().onNetwork();
socketConnect(address, port, timeout);
/* socket may have been closed during poll/select */
@@ -446,7 +446,7 @@
protected void accept(SocketImpl s) throws IOException {
acquireFD();
try {
- // Android-added: BlockGuard
+ // Android-added: BlockGuard.
BlockGuard.getThreadPolicy().onNetwork();
socketAccept(s);
} finally {
@@ -558,10 +558,9 @@
if (!stream) {
ResourceManager.afterUdpClose();
}
- // Android-changed:
- // Socket should be untagged before the preclose. After preclose,
- // socket will dup2-ed to marker_fd, therefore, it won't describe the same file.
- // If closingPending is true, then the socket has been preclosed.
+ // Android-changed: Socket should be untagged before the preclose.
+ // After preclose, socket will dup2-ed to marker_fd, therefore, it won't describe
+ // the same file. If closingPending is true, then the socket has been preclosed.
//
// Also, close the CloseGuard when the #close is called.
if (!closePending) {
@@ -582,8 +581,8 @@
} finally {
socketClose();
}
- // Android-changed(http://b/26470377): Some Android code doesn't expect file
- // descriptor to be null. socketClose invalidates the fd by closing the fd.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
+ // socketClose invalidates the fd by closing the fd.
// fd = null;
return;
} else {
@@ -607,7 +606,7 @@
// Android-changed: Notified the CloseGuard object as the fd has been released.
guard.close();
}
- // Android-removed: b/26470377 Represent closed sockets with invalid fd, not null.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
// fd = null;
super.reset();
}
@@ -617,7 +616,7 @@
* Shutdown read-half of the socket connection;
*/
protected void shutdownInput() throws IOException {
- // Android-changed: b/26470377 Represent closed sockets with invalid fd, not null.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
if (fd != null && fd.valid()) {
socketShutdown(SHUT_RD);
if (socketInputStream != null) {
@@ -631,7 +630,7 @@
* Shutdown write-half of the socket connection;
*/
protected void shutdownOutput() throws IOException {
- // Android-changed: b/26470377 Represent closed sockets with invalid fd, not null.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
if (fd != null && fd.valid()) {
socketShutdown(SHUT_WR);
shut_wr = true;
@@ -643,7 +642,7 @@
}
protected void sendUrgentData (int data) throws IOException {
- // Android-changed: b/26470377 Represent closed sockets with invalid fd, not null.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
if (fd == null || !fd.valid()) {
throw new IOException("Socket Closed");
}
@@ -654,7 +653,7 @@
* Cleans up if the user forgets to close it.
*/
protected void finalize() throws IOException {
- // Android-added: CloseGuard
+ // Android-added: CloseGuard.
if (guard != null) {
guard.warnIfOpen();
}
@@ -688,8 +687,8 @@
try {
socketClose();
} catch (IOException e) {
- // Android-removed: b/26470377 Some Android code doesn't expect file
- // descriptor to be null. socketClose invalidates the fd by closing the fd.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
+ // socketClose invalidates the fd by closing the fd.
// } finally {
// fd = null;
}
@@ -734,7 +733,7 @@
* close is in progress.
*/
synchronized (fdLock) {
- // Android-changed: b/26470377 Represent closed sockets with invalid fd, not null.
+ // Android-changed: Closed sockets use an invalid fd, not null. b/26470377
if (closePending || (fd == null) || !fd.valid()) {
return true;
} else {
@@ -781,8 +780,8 @@
abstract void socketShutdown(int howto)
throws IOException;
- // Android-changed: Method signature changed, socket{Get,Set}Option work directly with Object
- // values.
+ // Android-changed: Method signature changes.
+ // socket{Get,Set}Option work directly with Object values.
abstract void socketSetOption(int cmd, Object value) throws SocketException;
abstract Object socketGetOption(int opt) throws SocketException;
diff --git a/ojluni/src/main/java/java/net/CookieManager.java b/ojluni/src/main/java/java/net/CookieManager.java
index dfd3b86..bff9734 100644
--- a/ojluni/src/main/java/java/net/CookieManager.java
+++ b/ojluni/src/main/java/java/net/CookieManager.java
@@ -250,7 +250,7 @@
}
}
}
- // Android-added: b/25897688 A fix to return empty map if cookies list is empty
+ // Android-added: A fix to return empty map if cookies list is empty. b/25897688
if (cookies.isEmpty()) {
return Collections.emptyMap();
}
@@ -315,7 +315,7 @@
}
}
cookie.setPath(path);
- // Android-added: b/25763487 A fix to verify cookie URI before removal
+ // Android-added: A fix to verify cookie URI before removal. b/25763487
} else {
// Validate existing path
if (!pathMatches(uri, cookie)) {
@@ -408,7 +408,7 @@
return false;
}
- // Android-changed: b/25763487 Cookie path matching logic in OpenJDK was wrong
+ // Android-changed: Cookie path matching logic in OpenJDK was wrong. b/25763487
/**
* Return true iff. the path from {@code cookie} matches the path from {@code uri}.
*/
@@ -436,9 +436,9 @@
private List<String> sortByPath(List<HttpCookie> cookies) {
Collections.sort(cookies, new CookiePathComparator());
- // BEGIN Android-changed: Netscape cookie spec and RFC 2965 have different format
- // of Cookie header; RFC 2965 requires a leading $Version="1" string while Netscape does not
- // The workaround here is to add a $Version="1" string in advance
+ // BEGIN Android-changed: Cookie header differs in Netscape cookie spec and RFC 2965.
+ // RFC 2965 requires a leading $Version="1" string while Netscape does not.
+ // The workaround here is to add a $Version="1" string in advance.
final StringBuilder result = new StringBuilder();
int minVersion = 1;
for (HttpCookie cookie : cookies) {
@@ -461,7 +461,7 @@
List<String> cookieHeader = new java.util.ArrayList<String>();
cookieHeader.add(result.toString());
- // END Android-changed: Netscape cookie spec and RFC 2965 have different format
+ // END Android-changed: Cookie header differs in Netscape cookie spec and RFC 2965.
return cookieHeader;
}
@@ -475,7 +475,7 @@
// path rule only applies to the cookies with same name
if (!c1.getName().equals(c2.getName())) return 0;
- // Android-changed: normalize before comparison
+ // Android-changed: normalize before comparison.
final String c1Path = normalizePath(c1.getPath());
final String c2Path = normalizePath(c2.getPath());
diff --git a/ojluni/src/main/java/java/net/HttpCookie.java b/ojluni/src/main/java/java/net/HttpCookie.java
index 3ff33c7..70b9b6b 100644
--- a/ojluni/src/main/java/java/net/HttpCookie.java
+++ b/ojluni/src/main/java/java/net/HttpCookie.java
@@ -57,7 +57,7 @@
* @since 1.6
*/
public final class HttpCookie implements Cloneable {
- // BEGIN Android-added: Reserved name can't be HttpCookie name
+ // BEGIN Android-added: Reserved name can't be HttpCookie name.
private static final Set<String> RESERVED_NAMES = new HashSet<String>();
static {
@@ -73,7 +73,7 @@
RESERVED_NAMES.add("secure"); // Netscape RFC 2109 RFC 2965 RFC 6265
RESERVED_NAMES.add("version"); // RFC 2109 RFC 2965 RFC 6265
}
- // END Android-added: Reserved name can't be HttpCookie name
+ // END Android-added: Reserved name can't be HttpCookie name.
// ---------------- Fields --------------
@@ -691,13 +691,13 @@
String H = host.substring(0, lengthDiff);
String D = host.substring(lengthDiff);
- // BEGIN Android-changed: App compat reason
+ // BEGIN Android-changed: App compat reason.
// 1) Disregard RFC 2965 sec. 3.3.2, the "The request-host is a HDN..."
// 2) match "foo.local" for domain ".local".
// return (H.indexOf('.') == -1 && D.equalsIgnoreCase(domain));
return D.equalsIgnoreCase(domain) && ((domain.startsWith(".") && isFullyQualifiedDomainName(domain, 1))
|| isLocalDomain);
- // END Android-changed: App compat reason
+ // END Android-changed: App compat reason.
}
else if (lengthDiff == -1) {
// if domain is actually .host
@@ -708,12 +708,12 @@
return false;
}
- // BEGIN Android-added: App compat reason
+ // BEGIN Android-added: App compat reason.
private static boolean isFullyQualifiedDomainName(String s, int firstCharacter) {
int dotPosition = s.indexOf('.', firstCharacter + 1);
return dotPosition != -1 && dotPosition < s.length() - 1;
}
- // END Android-added: App compat reason
+ // END Android-added: App compat reason.
/**
* Constructs a cookie header string representation of this cookie,
@@ -799,7 +799,7 @@
// from RFC 2068, token special case characters
//
// private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
- // Android-changed: App compat reason. Disallow "=\t" as token
+ // Android-changed: App compat reason. Disallow "=\t" as token.
// private static final String tspecials = ",; "; // deliberately includes space
private static final String tspecials = ",;= \t";
@@ -813,7 +813,7 @@
* {@code false} if it is not
*/
private static boolean isToken(String value) {
- // Android-added: Reserved name can't be a token
+ // Android-added: Reserved name can't be a token.
if (RESERVED_NAMES.contains(value.toLowerCase(Locale.US))) {
return false;
}
@@ -998,7 +998,7 @@
// BEGIN Android-changed: Use HttpDate for date parsing.
// it accepts broader set of date formats.
// cookie.setMaxAge(cookie.expiryDate2DeltaSeconds(attrValue));
- // Android-changed: Altered max age calculation to avoid setting
+ // Android-changed: Altered max age calculation to avoid setting.
// it to MAX_AGE_UNSPECIFIED (-1) if "expires" is one second in past.
Date date = HttpDate.parse(attrValue);
long maxAgeInSeconds = 0;
@@ -1030,7 +1030,7 @@
}
}
- // BEGIN Android-removed: Android doesn't use JavaNetHttpCookieAccess
+ // BEGIN Android-removed: Android doesn't use JavaNetHttpCookieAccess.
/*
static {
sun.misc.SharedSecrets.setJavaNetHttpCookieAccess(
@@ -1046,7 +1046,7 @@
);
}
*/
- // END Android-removed: Android doesn't use JavaNetHttpCookieAccess
+ // END Android-removed: Android doesn't use JavaNetHttpCookieAccess.
/*
* Returns the original header this cookie was consructed from, if it was
diff --git a/ojluni/src/main/java/java/net/IDN.java b/ojluni/src/main/java/java/net/IDN.java
index a18c3a8..36559cf 100644
--- a/ojluni/src/main/java/java/net/IDN.java
+++ b/ojluni/src/main/java/java/net/IDN.java
@@ -103,7 +103,7 @@
* @throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification
*/
public static String toASCII(String input, int flag) {
- // BEGIN Android-changed: Use ICU4J implementation
+ // BEGIN Android-changed: Use ICU4J implementation.
try {
return IDNA.convertIDNToASCII(input, flag).toString();
} catch (android.icu.text.StringPrepParseException e) {
@@ -114,7 +114,7 @@
}
throw new IllegalArgumentException("Invalid input to toASCII: " + input, e);
}
- // END Android-changed: Use ICU4J implementation
+ // END Android-changed: Use ICU4J implementation.
}
@@ -158,7 +158,7 @@
* @return the translated {@code String}
*/
public static String toUnicode(String input, int flag) {
- // BEGIN Android-changed: Use ICU4J implementation
+ // BEGIN Android-changed: Use ICU4J implementation.
try {
// ICU only translates separators to ASCII for toASCII.
// Java expects the translation for toUnicode too.
@@ -168,10 +168,10 @@
// the original string is returned.
return input;
}
- // END Android-changed: Use ICU4J implementation
+ // END Android-changed: Use ICU4J implementation.
}
- // BEGIN Android-added: Use ICU4J implementation
+ // BEGIN Android-added: Use ICU4J implementation.
private static boolean isLabelSeperator(char c) {
return (c == '\u3002' || c == '\uff0e' || c == '\uff61');
}
@@ -184,7 +184,7 @@
}
return input;
}
- // END Android-added: Use ICU4J implementation
+ // END Android-added: Use ICU4J implementation.
/**
* Translates a string from ASCII Compatible Encoding (ACE) to Unicode,
diff --git a/ojluni/src/main/java/java/net/InMemoryCookieStore.java b/ojluni/src/main/java/java/net/InMemoryCookieStore.java
index 5df66c0..85aab8b 100644
--- a/ojluni/src/main/java/java/net/InMemoryCookieStore.java
+++ b/ojluni/src/main/java/java/net/InMemoryCookieStore.java
@@ -36,7 +36,7 @@
import java.util.Iterator;
import java.util.concurrent.locks.ReentrantLock;
-// Android-changed: App compat changes and bug fixes
+// Android-changed: App compat changes and bug fixes.
// b/26456024 Add targetSdkVersion based compatibility for domain matching
// b/33034917 Support clearing cookies by adding it with "max-age=0"
// b/25897688 InMemoryCookieStore ignores scheme (http/https) port and path of the cookie
@@ -52,7 +52,7 @@
*/
public class InMemoryCookieStore implements CookieStore {
// the in-memory representation of cookies
- // BEGIN Android-removed: Remove cookieJar and domainIndex
+ // BEGIN Android-removed: Remove cookieJar and domainIndex.
/*
private List<HttpCookie> cookieJar = null;
@@ -62,13 +62,13 @@
// presence of cookie when retrieve one form index store.
private Map<String, List<HttpCookie>> domainIndex = null;
*/
- // END Android-removed: Remove cookieJar and domainIndex
+ // END Android-removed: Remove cookieJar and domainIndex.
private Map<URI, List<HttpCookie>> uriIndex = null;
// use ReentrantLock instead of syncronized for scalability
private ReentrantLock lock = null;
- // BEGIN Android-changed: Add targetSdkVersion and remove cookieJar and domainIndex
+ // BEGIN Android-changed: Add targetSdkVersion and remove cookieJar and domainIndex.
private final boolean applyMCompatibility;
/**
@@ -83,7 +83,7 @@
lock = new ReentrantLock(false);
applyMCompatibility = (targetSdkVersion <= 23);
}
- // END Android-changed: Add targetSdkVersion and remove cookieJar and domainIndex
+ // END Android-changed: Add targetSdkVersion and remove cookieJar and domainIndex.
/**
* Add one cookie into cookie store.
@@ -96,8 +96,8 @@
lock.lock();
try {
- // Android-changed: http://b/33034917, android supports clearing cookies
- // by adding the cookie with max-age: 0.
+ // Android-changed: Android supports clearing cookies. http://b/33034917
+ // They are cleared by adding the cookie with max-age: 0.
//if (cookie.getMaxAge() != 0) {
addIndex(uriIndex, getEffectiveURI(uri), cookie);
//}
@@ -121,7 +121,7 @@
}
List<HttpCookie> cookies = new ArrayList<HttpCookie>();
- // BEGIN Android-changed: b/25897688 InMemoryCookieStore ignores scheme (http/https)
+ // BEGIN Android-changed: InMemoryCookieStore ignores scheme (http/https). b/25897688
lock.lock();
try {
// check domainIndex first
@@ -131,7 +131,7 @@
} finally {
lock.unlock();
}
- // END Android-changed: b/25897688 InMemoryCookieStore ignores scheme (http/https)
+ // END Android-changed: InMemoryCookieStore ignores scheme (http/https). b/25897688
return cookies;
}
@@ -139,7 +139,7 @@
* Get all cookies in cookie store, except those have expired
*/
public List<HttpCookie> getCookies() {
- // BEGIN Android-changed: Remove cookieJar and domainIndex
+ // BEGIN Android-changed: Remove cookieJar and domainIndex.
List<HttpCookie> rt = new ArrayList<HttpCookie>();
lock.lock();
@@ -159,7 +159,7 @@
rt = Collections.unmodifiableList(rt);
lock.unlock();
}
- // END Android-changed: Remove cookieJar and domainIndex
+ // END Android-changed: Remove cookieJar and domainIndex.
return rt;
}
@@ -213,7 +213,7 @@
throw new NullPointerException("cookie is null");
}
- // BEGIN Android-changed: Fix uri not being removed from uriIndex
+ // BEGIN Android-changed: Fix uri not being removed from uriIndex.
lock.lock();
try {
uri = getEffectiveURI(uri);
@@ -230,7 +230,7 @@
} finally {
lock.unlock();
}
- // END Android-changed: Fix uri not being removed from uriIndex
+ // END Android-changed: Fix uri not being removed from uriIndex.
}
@@ -299,7 +299,7 @@
// need to check H & D component
String D = host.substring(lengthDiff);
- // Android-changed: b/26456024 targetSdkVersion based compatibility for domain matching
+ // Android-changed: b/26456024 targetSdkVersion based compatibility for domain matching.
// Android M and earlier: Cookies with domain "foo.com" would not match "bar.foo.com".
// The RFC dictates that the user agent must treat those domains as if they had a
// leading period and must therefore match "bar.foo.com".
@@ -319,7 +319,7 @@
private void getInternal1(List<HttpCookie> cookies, Map<URI, List<HttpCookie>> cookieIndex,
String host) {
- // BEGIN Android-changed: b/25897688 InMemoryCookieStore ignores scheme (http/https)
+ // BEGIN Android-changed: InMemoryCookieStore ignores scheme (http/https). b/25897688
// Use a separate list to handle cookies that need to be removed so
// that there is no conflict with iterators.
ArrayList<HttpCookie> toRemove = new ArrayList<HttpCookie>();
@@ -348,7 +348,7 @@
}
toRemove.clear();
}
- // END Android-changed: b/25897688 InMemoryCookieStore ignores scheme (http/https)
+ // END Android-changed: InMemoryCookieStore ignores scheme (http/https). b/25897688
}
// @param cookies [OUT] contains the found cookies
@@ -359,7 +359,7 @@
void getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex,
T comparator)
{
- // BEGIN Android-changed: b/25897688 InMemoryCookieStore ignores scheme (http/https)
+ // BEGIN Android-changed: InMemoryCookieStore ignores scheme (http/https). b/25897688
// Removed cookieJar
for (T index : cookieIndex.keySet()) {
if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) {
@@ -381,7 +381,7 @@
} // end of indexedCookies != null
} // end of comparator.compareTo(index) == 0
} // end of cookieIndex iteration
- // END Android-changed: b/25897688 InMemoryCookieStore ignores scheme (http/https)
+ // END Android-changed: InMemoryCookieStore ignores scheme (http/https). b/25897688
}
// add 'cookie' indexed by 'index' into 'indexStore'
@@ -389,9 +389,9 @@
T index,
HttpCookie cookie)
{
- // Android-changed: "index" can be null. We only use the URI based
- // index on Android and we want to support null URIs. The underlying
- // store is a HashMap which will support null keys anyway.
+ // Android-changed: "index" can be null.
+ // We only use the URI based index on Android and we want to support null URIs. The
+ // underlying store is a HashMap which will support null keys anyway.
// if (index != null) {
List<HttpCookie> cookies = indexStore.get(index);
if (cookies != null) {
@@ -413,7 +413,7 @@
//
private URI getEffectiveURI(URI uri) {
URI effectiveURI = null;
- // Android-added: Fix NullPointerException
+ // Android-added: Fix NullPointerException.
if (uri == null) {
return null;
}
diff --git a/ojluni/src/main/java/java/net/Inet4Address.java b/ojluni/src/main/java/java/net/Inet4Address.java
index 1fb7b92..2dc875b 100644
--- a/ojluni/src/main/java/java/net/Inet4Address.java
+++ b/ojluni/src/main/java/java/net/Inet4Address.java
@@ -93,7 +93,7 @@
* serialized */
private static final long serialVersionUID = 3286316764910316507L;
- // BEGIN Android-added: Define special-purpose IPv4 address
+ // BEGIN Android-added: Define special-purpose IPv4 address.
/** @hide */
public static final InetAddress ANY = new Inet4Address(null, new byte[] { 0, 0, 0, 0 });
@@ -104,10 +104,10 @@
/** @hide */
public static final InetAddress LOOPBACK =
new Inet4Address("localhost", new byte[] { 127, 0, 0, 1 });
- // END Android-added: Define special-purpose IPv4 address
+ // END Android-added: Define special-purpose IPv4 address.
- // BEGIN Android-removed: Android doesn't need to call native init
+ // BEGIN Android-removed: Android doesn't need to call native init.
/*
* Perform initializations.
*
@@ -115,7 +115,7 @@
init();
}
*/
- // END Android-removed: Android doesn't need to call native init
+ // END Android-removed: Android doesn't need to call native init.
Inet4Address() {
super();
holder().hostName = null;
@@ -391,11 +391,11 @@
return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
}
- // BEGIN Android-removed: Android doesn't need to call native init
+ // BEGIN Android-removed: Android doesn't need to call native init.
/*
* Perform class load-time initializations.
*
private static native void init();
*/
- // END Android-removed: Android doesn't need to call native init
+ // END Android-removed: Android doesn't need to call native init.
}
diff --git a/ojluni/src/main/java/java/net/Inet6Address.java b/ojluni/src/main/java/java/net/Inet6Address.java
index c0aadb3..83f3451 100644
--- a/ojluni/src/main/java/java/net/Inet6Address.java
+++ b/ojluni/src/main/java/java/net/Inet6Address.java
@@ -178,15 +178,15 @@
class Inet6Address extends InetAddress {
final static int INADDRSZ = 16;
- // BEGIN Android-removed: Remove special handling for link-local addresses
+ // BEGIN Android-removed: Remove special handling for link-local addresses.
/*
* cached scope_id - for link-local address use only.
*
private transient int cached_scope_id; // 0
*/
- // END Android-removed: Remove special handling for link-local addresses
+ // END Android-removed: Remove special handling for link-local addresses.
- // BEGIN Android-added: Define special-purpose IPv6 address
+ // BEGIN Android-added: Define special-purpose IPv6 address.
/** @hide */
public static final InetAddress ANY =
new Inet6Address("::", new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0);
@@ -194,7 +194,7 @@
/** @hide */
public static final InetAddress LOOPBACK = new Inet6Address("ip6-localhost",
new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, 0);
- // END Android-added: Define special-purpose IPv6 address
+ // END Android-added: Define special-purpose IPv6 address.
private class Inet6AddressHolder {
@@ -252,7 +252,7 @@
void init(byte addr[], int scope_id) {
setAddr(addr);
- // Android-changed: was >= 0
+ // Android-changed: was >= 0.
if (scope_id > 0) {
this.scope_id = scope_id;
this.scope_id_set = true;
@@ -272,7 +272,7 @@
}
}
- // Android-removed: getnameinfo returns smarter representations than getHostAddress()
+ // Android-removed: getnameinfo returns smarter representations than getHostAddress().
/*
String getHostAddress() {
String s = numericToTextFormat(ipaddress);
@@ -389,11 +389,11 @@
private static final long serialVersionUID = 6880410070516793377L;
- // BEGIN Android-removed: Android doesn't need to call native init
+ // BEGIN Android-removed: Android doesn't need to call native init.
/*
// Perform native initialization
static { init(); }
- // END Android-removed: Android doesn't need to call native init
+ // END Android-removed: Android doesn't need to call native init.
*/
Inet6Address() {
@@ -622,7 +622,7 @@
throws IOException, ClassNotFoundException {
NetworkInterface scope_ifname = null;
- // Android-changed: was getClass().getClassLoader() != null
+ // Android-changed: was getClass().getClassLoader() != null.
if (getClass().getClassLoader() != Class.class.getClassLoader()) {
throw new SecurityException ("invalid address type");
}
@@ -894,7 +894,7 @@
*/
@Override
public String getHostAddress() {
- // Android-changed: getnameinfo returns smarter representations than getHostAddress()
+ // Android-changed: getnameinfo returns smarter representations than getHostAddress().
// return holder6.getHostAddress();
return Libcore.os.getnameinfo(this, NI_NUMERICHOST); // Can't throw.
}
@@ -971,11 +971,11 @@
return sb.toString();
}
- // BEGIN Android-removed: Android doesn't need to call native init
+ // BEGIN Android-removed: Android doesn't need to call native init.
/*
* Perform class load-time initializations.
*
private static native void init();
*/
- // END Android-removed: Android doesn't need to call native init
+ // END Android-removed: Android doesn't need to call native init.
}
diff --git a/ojluni/src/main/java/java/net/URLStreamHandler.java b/ojluni/src/main/java/java/net/URLStreamHandler.java
index dffc6d5..c0876e8 100644
--- a/ojluni/src/main/java/java/net/URLStreamHandler.java
+++ b/ojluni/src/main/java/java/net/URLStreamHandler.java
@@ -134,9 +134,9 @@
boolean isRelPath = false;
boolean queryOnly = false;
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
boolean querySet = false;
- // END Android-changed: App compat
+ // END Android-changed: App compat.
// FIX: should not assume query if opaque
// Strip off the query part
@@ -148,22 +148,22 @@
if (limit > queryStart)
limit = queryStart;
spec = spec.substring(0, queryStart);
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
querySet = true;
- // END Android-changed: App compat
+ // END Android-changed: App compat.
}
}
int i = 0;
// Parse the authority part if any
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
// boolean isUNCName = (start <= limit - 4) &&
// (spec.charAt(start) == '/') &&
// (spec.charAt(start + 1) == '/') &&
// (spec.charAt(start + 2) == '/') &&
// (spec.charAt(start + 3) == '/');
boolean isUNCName = false;
- // END Android-changed: App compat
+ // END Android-changed: App compat.
if (!isUNCName && (start <= limit - 2) && (spec.charAt(start) == '/') &&
(spec.charAt(start + 1) == '/')) {
start += 2;
@@ -239,7 +239,7 @@
if (ind >= 0) {
// port can be null according to RFC2396
if (host.length() > (ind + 1)) {
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
// port = Integer.parseInt(host.substring(ind + 1));
char firstPortChar = host.charAt(ind+1);
if (firstPortChar >= '0' && firstPortChar <= '9') {
@@ -248,7 +248,7 @@
throw new IllegalArgumentException("invalid port: " +
host.substring(ind + 1));
}
- // END Android-changed: App compat
+ // END Android-changed: App compat.
}
host = host.substring(0, ind);
}
@@ -263,14 +263,14 @@
// If the authority is defined then the path is defined by the
// spec only; See RFC 2396 Section 5.2.4.
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
// if (authority != null && authority.length() > 0)
// path = "";
path = null;
if (!querySet) {
query = null;
}
- // END Android-changed: App compat
+ // END Android-changed: App compat.
}
if (host == null) {
@@ -297,21 +297,21 @@
path = seperator + spec.substring(start, limit);
}
}
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
//else if (queryOnly && path != null) {
// int ind = path.lastIndexOf('/');
// if (ind < 0)
// ind = 0;
// path = path.substring(0, ind) + "/";
//}
- // END Android-changed: App compat
+ // END Android-changed: App compat.
if (path == null)
path = "";
- // BEGIN Android-changed
+ // BEGIN Android-changed: always assume isRelPath is true.
//if (isRelPath) {
if (true) {
- // END Android-changed
+ // END Android-changed: always assume isRelPath is true.
// Remove embedded /./
while ((i = path.indexOf("/./")) >= 0) {
path = path.substring(0, i) + path.substring(i + 2);
@@ -319,21 +319,21 @@
// Remove embedded /../ if possible
i = 0;
while ((i = path.indexOf("/../", i)) >= 0) {
- // BEGIN Android-changed: App compat
+ // BEGIN Android-changed: App compat.
/*
* Trailing /../
*/
if (i == 0) {
path = path.substring(i + 3);
i = 0;
- // END Android-changed: App compat
+ // END Android-changed: App compat.
/*
* A "/../" will cancel the previous segment and itself,
* unless that segment is a "/../" itself
* i.e. "/a/b/../c" becomes "/a/c"
* but "/../../a" should stay unchanged
*/
- // Android-changed: App compat
+ // Android-changed: App compat.
// if (i > 0 && (limit = path.lastIndexOf('/', i - 1)) >= 0 &&
} else if (i > 0 && (limit = path.lastIndexOf('/', i - 1)) >= 0 &&
(path.indexOf("/../", limit) != 0)) {
@@ -360,7 +360,7 @@
if (path.endsWith("/."))
path = path.substring(0, path.length() -1);
- // Android-changed: App compat: Remove trailing ?
+ // Android-changed: App compat: Remove trailing '?'.
if (path.endsWith("?"))
path = path.substring(0, path.length() -1);
}
@@ -391,7 +391,7 @@
* @since 1.3
*/
protected boolean equals(URL u1, URL u2) {
- // Android-changed: Avoid network I/O
+ // Android-changed: Avoid network I/O.
return Objects.equals(u1.getRef(), u2.getRef()) &&
Objects.equals(u1.getQuery(), u2.getQuery()) &&
// sameFile compares the protocol, file, port & host components of
@@ -408,7 +408,7 @@
* @since 1.3
*/
protected int hashCode(URL u) {
- // Android-changed: Avoid network I/O
+ // Android-changed: Avoid network I/O.
// Hash on the same set of fields that we compare in equals().
return Objects.hash(
u.getRef(),
@@ -522,7 +522,7 @@
if (u.getRef() != null)
len += 1 + u.getRef().length();
- // BEGIN Android-changed: Add a toExternalForm variant that optionally escapes illegal chars
+ // BEGIN Android-changed: New toExternalForm variant that optionally escapes illegal chars.
// TODO: The variant has been removed. We can potentially revert the change
StringBuilder result = new StringBuilder(len);
result.append(u.getProtocol());
@@ -535,7 +535,7 @@
if (fileAndQuery != null) {
result.append(fileAndQuery);
}
- // END Android-changed: Add a toExternalForm variant that optionally escapes illegal chars
+ // END Android-changed: New toExternalForm variant that optionally escapes illegal chars.
if (u.getRef() != null) {
result.append("#");
result.append(u.getRef());
@@ -543,7 +543,7 @@
return result.toString();
}
- // Android-changed: Removed @see tag (target is package-private):
+ // Android-changed: Removed @see tag (target is package-private).
// @see java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
/**
* Sets the fields of the {@code URL} argument to the indicated values.
diff --git a/ojluni/src/main/java/java/security/Provider.java b/ojluni/src/main/java/java/security/Provider.java
index 9936859..6deb954 100644
--- a/ojluni/src/main/java/java/security/Provider.java
+++ b/ojluni/src/main/java/java/security/Provider.java
@@ -95,7 +95,7 @@
// Declare serialVersionUID to be compatible with JDK1.1
static final long serialVersionUID = -4298000515446427739L;
- // Android-added: Provider registration
+ // Android-added: Provider registration.
// Marking a provider as "registered" makes it change the security version when
// changes to it are made. As of 2017-05-22 this is only used in ProviderTest.
// TODO: Change ProviderTest to no longer require this mechanism
@@ -703,7 +703,7 @@
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
- // Android-added: Provider registration
+ // Android-added: Provider registration.
registered = false;
Map<Object,Object> copy = new HashMap<>();
for (Map.Entry<Object,Object> entry : super.entrySet()) {
@@ -717,7 +717,7 @@
}
private boolean checkLegacy(Object key) {
- // Android-added: Provider registration
+ // Android-added: Provider registration.
if (registered) {
Security.increaseVersion();
}
@@ -742,7 +742,7 @@
for (Map.Entry<?,?> e : t.entrySet()) {
implPut(e.getKey(), e.getValue());
}
- // Android-added: Provider registration
+ // Android-added: Provider registration.
if (registered) {
Security.increaseVersion();
}
@@ -817,7 +817,7 @@
if (!checkLegacy(key)) {
return null;
}
- // BEGIN Android-changed: use compute() instead of computeIfAbsent() to avoid cast fails
+ // BEGIN Android-changed: use compute(), not computeIfAbsent(), to avoid cast fails.
// The upstream code cannot ever succeed as the cast from BiFunction to Function
// always fails.
// legacyStrings.computeIfAbsent((String) key,
@@ -825,7 +825,7 @@
legacyStrings.compute((String) key,
(BiFunction<? super String, ? super String, ? extends String>)
remappingFunction);
- // END Android-changed: use compute() instead of computeIfAbsent() to avoid cast fails
+ // END Android-changed: use compute(), not computeIfAbsent(), to avoid cast fails.
}
return super.compute(key, remappingFunction);
}
@@ -887,7 +887,7 @@
serviceSet = null;
super.clear();
putId();
- // Android-added: Provider registration
+ // Android-added: Provider registration.
if (registered) {
Security.increaseVersion();
}
@@ -1192,7 +1192,7 @@
String key = type + "." + algorithm + " " + entry.getKey();
super.put(key, entry.getValue());
}
- // Android-added: Provider registration
+ // Android-added: Provider registration.
if (registered) {
Security.increaseVersion();
}
@@ -1214,7 +1214,7 @@
String key = type + "." + algorithm + " " + entry.getKey();
super.remove(key);
}
- // Android-added: Provider registration
+ // Android-added: Provider registration.
if (registered) {
Security.increaseVersion();
}
@@ -1883,7 +1883,7 @@
}
- // BEGIN Android-added: Provider registration
+ // BEGIN Android-added: Provider registration.
/**
* @hide
*/
@@ -1922,5 +1922,5 @@
// stored field, if the services didn't change in the meantime.
getServices();
}
- // END Android-added: Provider registration
+ // END Android-added: Provider registration.
}
diff --git a/ojluni/src/main/java/java/text/DateFormatSymbols.java b/ojluni/src/main/java/java/text/DateFormatSymbols.java
index 97dc528..5f48e1b 100644
--- a/ojluni/src/main/java/java/text/DateFormatSymbols.java
+++ b/ojluni/src/main/java/java/text/DateFormatSymbols.java
@@ -101,7 +101,7 @@
*/
public class DateFormatSymbols implements Serializable, Cloneable {
- // Android-changed: Removed reference to DateFormatSymbolsProvider but suggested getInstance()
+ // Android-changed: Removed reference to DateFormatSymbolsProvider but suggested getInstance().
// be used instead in case Android supports it in future.
/**
* Construct a DateFormatSymbols object by loading format data from
@@ -123,7 +123,7 @@
initializeData(Locale.getDefault(Locale.Category.FORMAT));
}
- // Android-changed: Removed reference to DateFormatSymbolsProvider but suggested getInstance()
+ // Android-changed: Removed reference to DateFormatSymbolsProvider but suggested getInstance().
// be used instead in case Android supports it in future.
/**
* Construct a DateFormatSymbols object by loading format data from
@@ -229,7 +229,7 @@
* Unlocalized date-time pattern characters. For example: 'y', 'd', etc.
* All locales use the same these unlocalized pattern characters.
*/
- // Android-changed: Add 'c' (standalone day of week), 'b' (day period),
+ // Android-changed: Add 'c' (standalone day of week), 'b' (day period),.
// 'B' (flexible day period)
static final String patternChars = "GyMdkHmsSEDFwWahKzZYuXLcbB";
@@ -258,7 +258,7 @@
static final int PATTERN_MONTH_STANDALONE = 22; // L
// Android-added: Constant for standalone day of week.
static final int PATTERN_STANDALONE_DAY_OF_WEEK = 23; // c
- // Android-added: Constant for pattern letter 'b', 'B'
+ // Android-added: Constant for pattern letter 'b', 'B'.
static final int PATTERN_DAY_PERIOD = 24; // b
static final int PATTERN_FLEXIBLE_DAY_PERIOD = 25; // B
@@ -844,7 +844,7 @@
// END Android-changed: Use ICU data and move cache handling to getCachedInstance().
}
- // Android-removed: toOneBasedArray(String[])
+ // Android-removed: toOneBasedArray(String[]).
// BEGIN Android-added: initializeSupplementaryData(LocaleData) for tiny and standalone fields.
private void initializeSupplementaryData(LocaleData localeData) {
@@ -917,10 +917,11 @@
}
return zoneStrings;
}
+ // END Android-changed: extract initialization of zoneStrings to separate method.
private String[][] getZoneStringsImpl(boolean needsCopy) {
+ // Android-changed: use helper method to initialize zoneStrings.
String[][] zoneStrings = internalZoneStrings();
- // END Android-changed: extract initialization of zoneStrings to separate method.
if (!needsCopy) {
return zoneStrings;
diff --git a/ojluni/src/main/java/java/util/Arrays.java b/ojluni/src/main/java/java/util/Arrays.java
index 6da3e5d..8cd8aaf 100644
--- a/ojluni/src/main/java/java/util/Arrays.java
+++ b/ojluni/src/main/java/java/util/Arrays.java
@@ -78,7 +78,7 @@
* tasks that makes parallel speedups unlikely.
* @hide
*/
- // Android-changed: Make MIN_ARRAY_SORT_GRAN public and @hide (used by harmony ArraysTest)
+ // Android-changed: Make MIN_ARRAY_SORT_GRAN public and @hide (used by harmony ArraysTest).
public static final int MIN_ARRAY_SORT_GRAN = 1 << 13;
// Suppresses default constructor, ensuring non-instantiability.
@@ -1232,14 +1232,14 @@
* {@link Comparable} contract
*/
public static void sort(Object[] a) {
- // Android-removed: LegacyMergeSort support
+ // Android-removed: LegacyMergeSort support.
// if (LegacyMergeSort.userRequested)
// legacyMergeSort(a);
// else
ComparableTimSort.sort(a, 0, a.length, null, 0, 0);
}
- // Android-removed: legacyMergeSort() (unused on Android)
+ // Android-removed: legacyMergeSort() (unused on Android).
/**
* Sorts the specified range of the specified array of objects into
@@ -1295,14 +1295,14 @@
*/
public static void sort(Object[] a, int fromIndex, int toIndex) {
rangeCheck(a.length, fromIndex, toIndex);
- // Android-removed: LegacyMergeSort support
+ // Android-removed: LegacyMergeSort support.
// if (LegacyMergeSort.userRequested)
// legacyMergeSort(a, fromIndex, toIndex);
// else
ComparableTimSort.sort(a, fromIndex, toIndex, null, 0, 0);
}
- // Android-removed: legacyMergeSort() (unused on Android)
+ // Android-removed: legacyMergeSort() (unused on Android).
/**
* Tuning parameter: list size at or below which insertion sort will be
@@ -1417,7 +1417,7 @@
if (c == null) {
sort(a);
} else {
- // Android-removed: LegacyMergeSort support
+ // Android-removed: LegacyMergeSort support.
// if (LegacyMergeSort.userRequested)
// legacyMergeSort(a, c);
// else
@@ -1425,7 +1425,7 @@
}
}
- // Android-removed: legacyMergeSort() (unused on Android)
+ // Android-removed: legacyMergeSort() (unused on Android).
/**
* Sorts the specified range of the specified array of objects according
@@ -1485,7 +1485,7 @@
sort(a, fromIndex, toIndex);
} else {
rangeCheck(a.length, fromIndex, toIndex);
- // Android-removed: LegacyMergeSort support
+ // Android-removed: LegacyMergeSort support.
// if (LegacyMergeSort.userRequested)
// legacyMergeSort(a, fromIndex, toIndex, c);
// else
@@ -1493,8 +1493,8 @@
}
}
- // Android-removed: legacyMergeSort() (unused on Android)
- // Android-removed: mergeSort() (unused on Android)
+ // Android-removed: legacyMergeSort() (unused on Android).
+ // Android-removed: mergeSort() (unused on Android).
// Parallel prefix
@@ -4110,7 +4110,7 @@
for (Object element : a) {
int elementHash = 0;
- // BEGIN Android-changed: getComponentType() is faster than instanceof()
+ // BEGIN Android-changed: getComponentType() is faster than instanceof().
if (element != null) {
Class<?> cl = element.getClass().getComponentType();
if (cl == null)
@@ -4136,7 +4136,7 @@
else
elementHash = element.hashCode();
}
- // END Android-changed: getComponentType() is faster than instanceof()
+ // END Android-changed: getComponentType() is faster than instanceof().
result = 31 * result + elementHash;
}
diff --git a/ojluni/src/main/java/java/util/Calendar.java b/ojluni/src/main/java/java/util/Calendar.java
index 3a0343b..a5be988 100644
--- a/ojluni/src/main/java/java/util/Calendar.java
+++ b/ojluni/src/main/java/java/util/Calendar.java
@@ -1595,7 +1595,7 @@
*/
protected Calendar(TimeZone zone, Locale aLocale)
{
- // BEGIN Android-added: Allow aLocale == null
+ // BEGIN Android-added: Allow aLocale == null.
// http://b/16938922.
//
// TODO: This is for backwards compatibility only. Seems like a better idea to throw
@@ -1603,7 +1603,7 @@
if (aLocale == null) {
aLocale = Locale.getDefault();
}
- // END Android-added: Allow aLocale == null
+ // END Android-added: Allow aLocale == null.
fields = new int[FIELD_COUNT];
isSet = new boolean[FIELD_COUNT];
stamp = new int[FIELD_COUNT];
@@ -1667,7 +1667,7 @@
return createCalendar(zone, aLocale);
}
- // BEGIN Android-added: add getJapaneseImperialInstance()
+ // BEGIN Android-added: add getJapaneseImperialInstance().
/**
* Create a Japanese Imperial Calendar.
* @hide
@@ -1675,14 +1675,14 @@
public static Calendar getJapaneseImperialInstance(TimeZone zone, Locale aLocale) {
return new JapaneseImperialCalendar(zone, aLocale);
}
- // END Android-added: add getJapaneseImperialInstance()
+ // END Android-added: add getJapaneseImperialInstance().
private static Calendar createCalendar(TimeZone zone,
Locale aLocale)
{
- // BEGIN Android-changed: only support GregorianCalendar here
+ // BEGIN Android-changed: only support GregorianCalendar here.
return new GregorianCalendar(zone, aLocale);
- // END Android-changed: only support GregorianCalendar here
+ // END Android-changed: only support GregorianCalendar here.
}
/**
@@ -2061,13 +2061,13 @@
* @since 1.6
*/
public String getDisplayName(int field, int style, Locale locale) {
- // BEGIN Android-changed: Treat ALL_STYLES as SHORT
+ // BEGIN Android-changed: Treat ALL_STYLES as SHORT.
// Android has traditionally treated ALL_STYLES as SHORT, even though
// it's not documented to be a valid value for style.
if (style == ALL_STYLES) {
style = SHORT;
}
- // END Android-changed: Treat ALL_STYLES as SHORT
+ // END Android-changed: Treat ALL_STYLES as SHORT.
if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
@@ -2161,7 +2161,7 @@
ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
return null;
}
- // Android-added: Add complete() here to fix leniency, see http://b/35382060
+ // Android-added: Add complete() here to fix leniency. http://b/35382060
complete();
String calendarType = getCalendarType();
@@ -2209,12 +2209,12 @@
baseStyle < minStyle || baseStyle > maxStyle) {
throw new IllegalArgumentException();
}
- // BEGIN Android-added: Check for invalid baseStyle == 3
+ // BEGIN Android-added: Check for invalid baseStyle == 3.
// 3 is not a valid base style (unlike 1, 2 and 4). Throw if used.
if (baseStyle == 3) {
throw new IllegalArgumentException();
}
- // END Android-added: Check for invalid baseStyle == 3
+ // END Android-added: Check for invalid baseStyle == 3.
if (locale == null) {
throw new NullPointerException();
}
@@ -2574,12 +2574,12 @@
return style & ~STANDALONE_MASK;
}
- // BEGIN Android-changed: Make toStandaloneStyle() public to use in java.text.SimpleDateFormat
+ // BEGIN Android-changed: Make toStandaloneStyle() public to use in java.text.SimpleDateFormat.
/**
* @hide
*/
public static int toStandaloneStyle(int style) {
- // END Android-changed: Make toStandaloneStyle() public to use in java.text.SimpleDateFormat
+ // END Android-changed: Make toStandaloneStyle() public to use in java.text.SimpleDateFormat.
return style | STANDALONE_MASK;
}
diff --git a/ojluni/src/main/java/java/util/GregorianCalendar.java b/ojluni/src/main/java/java/util/GregorianCalendar.java
index 1d8c87b..46733e9 100644
--- a/ojluni/src/main/java/java/util/GregorianCalendar.java
+++ b/ojluni/src/main/java/java/util/GregorianCalendar.java
@@ -739,12 +739,12 @@
gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
}
- // BEGIN Android-added
+ // BEGIN Android-added: Constructor.
GregorianCalendar(long milliseconds) {
this();
setTimeInMillis(milliseconds);
}
- // END Android-added
+ // END Android-added: Constructor.
/////////////////
// Public methods
@@ -1080,7 +1080,7 @@
}
fd += delta; // fd is the expected fixed date after the calculation
- // BEGIN Android-changed: time zone related calculation via helper methods
+ // BEGIN Android-changed: time zone related calculation via helper methods.
// Calculate the time in the UTC time zone.
long utcTime = (fd - EPOCH_OFFSET) * ONE_DAY + timeOfDay;
@@ -1093,7 +1093,7 @@
// Update the time and recompute the fields.
setTimeInMillis(millis);
- // END Android-changed: time zone related calculation via helper methods
+ // END Android-changed: time zone related calculation via helper methods.
}
}
@@ -2346,12 +2346,12 @@
}
if (tzMask != (ZONE_OFFSET_MASK|DST_OFFSET_MASK)) {
if (tz instanceof ZoneInfo) {
- // BEGIN Android-changed: use libcore.util.ZoneInfo
+ // BEGIN Android-changed: use libcore.util.ZoneInfo.
// The method name to get offsets differs from sun.util.calendar.ZoneInfo
// zoneOffset = ((ZoneInfo)tz).getOffsets(time, zoneOffsets);
ZoneInfo zoneInfo = (ZoneInfo) tz;
zoneOffset = zoneInfo.getOffsetsByUtcTime(time, zoneOffsets);
- // END Android-changed: use libcore.util.ZoneInfo
+ // END Android-changed: use libcore.util.ZoneInfo.
} else {
zoneOffset = tz.getOffset(time);
zoneOffsets[0] = tz.getRawOffset();
@@ -2801,11 +2801,11 @@
// We use the TimeZone object, unless the user has explicitly set the ZONE_OFFSET
// or DST_OFFSET fields; then we use those fields.
TimeZone zone = getZone();
- // BEGIN Android-changed: time zone related calculation via helper methods
+ // BEGIN Android-changed: time zone related calculation via helper methods.
int tzMask = fieldMask & (ZONE_OFFSET_MASK|DST_OFFSET_MASK);
millis = adjustForZoneAndDaylightSavingsTime(tzMask, millis, zone);
- // END Android-changed: time zone related calculation via helper methods
+ // END Android-changed: time zone related calculation via helper methods.
// Set this calendar's time in milliseconds
time = millis;
@@ -2828,7 +2828,7 @@
setFieldsNormalized(mask);
}
- // BEGIN Android-added: helper methods for time zone related calculation
+ // BEGIN Android-added: helper methods for time zone related calculation.
/**
* Calculates the time in milliseconds that this calendar represents using the UTC time,
* timezone information (specifically Daylight Savings Time (DST) rules, if any) and knowledge
@@ -2998,7 +2998,7 @@
}
return dstOffset;
}
- // END Android-added: helper methods for time zone related calculation
+ // END Android-added: helper methods for time zone related calculation.
/**
* Computes the fixed date under either the Gregorian or the
diff --git a/ojluni/src/main/java/java/util/TreeMap.java b/ojluni/src/main/java/java/util/TreeMap.java
index 20d98bc..3359635 100644
--- a/ojluni/src/main/java/java/util/TreeMap.java
+++ b/ojluni/src/main/java/java/util/TreeMap.java
@@ -1343,7 +1343,7 @@
*/
abstract static class NavigableSubMap<K,V> extends AbstractMap<K,V>
implements NavigableMap<K,V>, java.io.Serializable {
- // Android-changed: Explicitly add a serialVersionUID so that we're serialization
+ // Android-changed: Explicitly add a serialVersionUID so that we're serialization.
// compatible with the Java-7 version of this class. Several new methods were added
// in Java-8 but none of them have any bearing on the serialized format of the class
// or require any additional state to be preserved.
@@ -1877,11 +1877,11 @@
}
public NavigableMap<K,V> headMap(K toKey, boolean inclusive) {
- // BEGIN Android-changed: Fix for edge cases
+ // BEGIN Android-changed: Fix for edge cases.
// if (!inRange(toKey, inclusive))
if (!inRange(toKey) && !(!toEnd && m.compare(toKey, hi) == 0 &&
!hiInclusive && !inclusive))
- // END Android-changed: Fix for edge cases
+ // END Android-changed: Fix for edge cases.
throw new IllegalArgumentException("toKey out of range");
return new AscendingSubMap<>(m,
fromStart, lo, loInclusive,
@@ -1889,11 +1889,11 @@
}
public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
- // BEGIN Android-changed: Fix for edge cases
+ // BEGIN Android-changed: Fix for edge cases.
// if (!inRange(fromKey, inclusive))
if (!inRange(fromKey) && !(!fromStart && m.compare(fromKey, lo) == 0 &&
!loInclusive && !inclusive))
- // END Android-changed: Fix for edge cases
+ // END Android-changed: Fix for edge cases.
throw new IllegalArgumentException("fromKey out of range");
return new AscendingSubMap<>(m,
false, fromKey, inclusive,
@@ -1970,11 +1970,11 @@
}
public NavigableMap<K,V> headMap(K toKey, boolean inclusive) {
- // BEGIN Android-changed: Fix for edge cases
+ // BEGIN Android-changed: Fix for edge cases.
// if (!inRange(toKey, inclusive))
if (!inRange(toKey) && !(!fromStart && m.compare(toKey, lo) == 0 &&
!loInclusive && !inclusive))
- // END Android-changed: Fix for edge cases
+ // END Android-changed: Fix for edge cases.
throw new IllegalArgumentException("toKey out of range");
return new DescendingSubMap<>(m,
false, toKey, inclusive,
@@ -1982,11 +1982,11 @@
}
public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive) {
- // BEGIN Android-changed: Fix for edge cases
+ // BEGIN Android-changed: Fix for edge cases.
// if (!inRange(fromKey, inclusive))
if (!inRange(fromKey) && !(!toEnd && m.compare(fromKey, hi) == 0 &&
!hiInclusive && !inclusive))
- // END Android-changed: Fix for edge cases
+ // END Android-changed: Fix for edge cases.
throw new IllegalArgumentException("fromKey out of range");
return new DescendingSubMap<>(m,
fromStart, lo, loInclusive,
diff --git a/ojluni/src/main/java/java/util/zip/ZipFile.java b/ojluni/src/main/java/java/util/zip/ZipFile.java
index 851aab1..e06fb6d 100644
--- a/ojluni/src/main/java/java/util/zip/ZipFile.java
+++ b/ojluni/src/main/java/java/util/zip/ZipFile.java
@@ -81,7 +81,7 @@
private final boolean locsig; // if zip file starts with LOCSIG (usually true)
private volatile boolean closeRequested = false;
- // Android-added: CloseGuard support
+ // Android-added: CloseGuard support.
private final CloseGuard guard = CloseGuard.get();
// Android-added: Do not use unlink() to implement OPEN_DELETE.
@@ -243,7 +243,7 @@
Integer.toHexString(mode));
}
String name = file.getPath();
- // Android-removed: SecurityManager is always null
+ // Android-removed: SecurityManager is always null.
/*
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
@@ -260,16 +260,16 @@
if (charset == null)
throw new NullPointerException("charset is null");
this.zc = ZipCoder.get(charset);
- // Android-removed: Skip perf counters
+ // Android-removed: Skip perf counters.
// long t0 = System.nanoTime();
jzfile = open(name, mode, file.lastModified(), usemmap);
- // Android-removed: Skip perf counters
+ // Android-removed: Skip perf counters.
// sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
// sun.misc.PerfCounter.getZipFileCount().increment();
this.name = name;
this.total = getTotal(jzfile);
this.locsig = startsWithLOC(jzfile);
- // Android-added: CloseGuard support
+ // Android-added: CloseGuard support.
guard.open("close");
}
@@ -668,7 +668,7 @@
public void close() throws IOException {
if (closeRequested)
return;
- // Android-added: CloseGuard support
+ // Android-added: CloseGuard support.
if (guard != null) {
guard.close();
}
@@ -739,7 +739,7 @@
* @see java.util.zip.ZipFile#close()
*/
protected void finalize() throws IOException {
- // Android-added: CloseGuard support
+ // Android-added: CloseGuard support.
if (guard != null) {
guard.warnIfOpen();
}
diff --git a/ojluni/src/main/java/sun/misc/SharedSecrets.java b/ojluni/src/main/java/sun/misc/SharedSecrets.java
index 45cd489..226dbf7 100644
--- a/ojluni/src/main/java/sun/misc/SharedSecrets.java
+++ b/ojluni/src/main/java/sun/misc/SharedSecrets.java
@@ -35,7 +35,7 @@
for this purpose, namely the loss of compile-time checking. */
public class SharedSecrets {
- // BEGIN Android-removed: Pruned unused access interfaces
+ // BEGIN Android-removed: Pruned unused access interfaces.
/*
private static final Unsafe unsafe = Unsafe.getUnsafe();
private static JavaUtilJarAccess javaUtilJarAccess;
@@ -46,9 +46,9 @@
private static JavaNetHttpCookieAccess javaNetHttpCookieAccess;
private static JavaNioAccess javaNioAccess;
*/
- // END Android-removed: Pruned unused access interfaces
+ // END Android-removed: Pruned unused access interfaces.
private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
- // BEGIN Android-removed: Pruned unused access interfaces
+ // BEGIN Android-removed: Pruned unused access interfaces.
/*
private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
private static JavaSecurityAccess javaSecurityAccess;
@@ -129,7 +129,7 @@
return javaIOAccess;
}
*/
- // END Android-removed: Pruned unused access interfaces
+ // END Android-removed: Pruned unused access interfaces.
public static void setJavaIOFileDescriptorAccess(JavaIOFileDescriptorAccess jiofda) {
javaIOFileDescriptorAccess = jiofda;
@@ -150,7 +150,7 @@
return javaIOFileDescriptorAccess;
}
- // BEGIN Android-removed: Pruned unused access interfaces
+ // BEGIN Android-removed: Pruned unused access interfaces.
/*
public static void setJavaOISAccess(JavaOISAccess access) {
javaOISAccess = access;
@@ -221,5 +221,5 @@
javaObjectInputStreamAccess = access;
}
*/
- // END Android-removed: Pruned unused access interfaces
+ // END Android-removed: Pruned unused access interfaces.
}
diff --git a/ojluni/src/main/java/sun/misc/URLClassPath.java b/ojluni/src/main/java/sun/misc/URLClassPath.java
index e9a89bc..0961d7a 100644
--- a/ojluni/src/main/java/sun/misc/URLClassPath.java
+++ b/ojluni/src/main/java/sun/misc/URLClassPath.java
@@ -360,7 +360,7 @@
lookupCacheEnabled = false;
}
- // BEGIN Android-changed: No lookup chache support
+ // BEGIN Android-changed: No lookup cache support.
/*
private static native URL[] getLookupCacheURLs(ClassLoader loader);
private static native int[] getLookupCacheForClassLoader(ClassLoader loader,
@@ -380,7 +380,7 @@
String className) {
return false;
}
- // END Android-changed: No lookup chache support
+ // END Android-changed: No lookup cache support.
synchronized boolean knownToNotExist(String className) {
@@ -816,7 +816,7 @@
private final HashMap<String, Loader> lmap;
private final AccessControlContext acc;
private boolean closed = false;
- // Android-changed: Not needed, called directly
+ // Android-changed: Not needed, called directly.
// private static final sun.misc.JavaUtilZipFileAccess zipAccess =
// sun.misc.SharedSecrets.getJavaUtilZipFileAccess();
diff --git a/ojluni/src/main/java/sun/misc/VM.java b/ojluni/src/main/java/sun/misc/VM.java
index f9060ba..0c5c4e5 100644
--- a/ojluni/src/main/java/sun/misc/VM.java
+++ b/ojluni/src/main/java/sun/misc/VM.java
@@ -93,7 +93,7 @@
return STATE_GREEN;
}
- // Android-removed: Not used
+ // Android-removed: Not used.
/** @deprecated */
// @Deprecated
// public static void registerVMNotification(VMNotification n) { }
@@ -233,7 +233,7 @@
return allowArraySyntax;
}
- // BEGIN Android-removed: Not used on android
+ // BEGIN Android-removed: Not used on android.
/**
* Returns true if the given class loader is in the system domain
* in which all permissions are granted.
@@ -241,7 +241,7 @@
// public static boolean isSystemDomainLoader(ClassLoader loader) {
// return loader == null;
// }
- // END Android-removed: Not used on android
+ // END Android-removed: Not used on android.
/**
* Returns the system property of the specified key saved at
@@ -403,7 +403,7 @@
private final static int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
private final static int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
- // BEGIN Android-removed: latestUserDefinedLoader()/initialize() not supported
+ // BEGIN Android-removed: latestUserDefinedLoader()/initialize() not supported.
// /*
// * Returns the first non-null class loader up the execution stack,
// * or null if only code from the null class loader is on the stack.
@@ -414,5 +414,5 @@
// initialize();
// }
// private native static void initialize();
- // END Android-removed: latestUserDefinedLoader()/initialize() not supported
+ // END Android-removed: latestUserDefinedLoader()/initialize() not supported.
}
diff --git a/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java b/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java
index b4fdf70..6af86d5 100644
--- a/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java
+++ b/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java
@@ -116,7 +116,7 @@
return false;
}
- // Android-removed: Dead code: Unused method conservativeCheckMemberAccess()
+ // Android-removed: Dead code: Unused method conservativeCheckMemberAccess().
/**
* Checks package access on the given class.
@@ -262,6 +262,6 @@
return Proxy.isProxyClass(cls) && !pkg.isEmpty();
}
- // Android-removed: Dead code: unused method checkProxyMethod()
- // Android-removed: Dead code: unused method isVMAnonymousClass()
+ // Android-removed: Dead code: unused method checkProxyMethod().
+ // Android-removed: Dead code: unused method isVMAnonymousClass().
}
diff --git a/ojluni/src/main/java/sun/security/util/DerInputStream.java b/ojluni/src/main/java/sun/security/util/DerInputStream.java
index 6608676..7f42bb0 100644
--- a/ojluni/src/main/java/sun/security/util/DerInputStream.java
+++ b/ojluni/src/main/java/sun/security/util/DerInputStream.java
@@ -325,7 +325,7 @@
* (used to initialize an auto-growing data structure)
* @return array of the values in the sequence
*/
- // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation
+ // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation.
public DerValue[] getSequence(int startLen,
boolean originalEncodedFormRetained) throws IOException {
tag = (byte)buffer.read();
@@ -348,8 +348,8 @@
return getSequence(
startLen,
false); // no need to retain original encoded form
- // END Android-changed: Original encoded form needed for APKs parsing/validation
}
+ // END Android-changed: Original encoded form needed for APKs parsing/validation.
/**
* Return a set of encoded entities. ASN.1 sets are unordered,
@@ -381,7 +381,7 @@
*/
public DerValue[] getSet(int startLen, boolean implicit)
throws IOException {
- // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation
+ // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation.
return getSet(
startLen,
implicit,
@@ -398,7 +398,7 @@
}
}
return (readVector(startLen, originalEncodedFormRetained));
- // END Android-changed: Original encoded form needed for APKs parsing/validation
+ // END Android-changed: Original encoded form needed for APKs parsing/validation.
}
/*
@@ -407,7 +407,7 @@
* this same helper routine.
*/
protected DerValue[] readVector(int startLen) throws IOException {
- // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation
+ // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation.
return readVector(
startLen,
false); // no need to retain original encoded form
@@ -420,7 +420,7 @@
*/
protected DerValue[] readVector(int startLen,
boolean originalEncodedFormRetained) throws IOException {
- // END Android-changed: Original encoded form needed for APKs parsing/validation
+ // END Android-changed: Original encoded form needed for APKs parsing/validation.
DerInputStream newstr;
byte lenByte = (byte)buffer.read();
@@ -465,7 +465,7 @@
DerValue value;
do {
- // Android-changed: Original encoded form needed for APKs parsing/validation
+ // Android-changed: Original encoded form needed for APKs parsing/validation.
value = new DerValue(newstr.buffer, originalEncodedFormRetained);
vec.addElement(value);
} while (newstr.available() > 0);
diff --git a/ojluni/src/main/java/sun/security/util/DerValue.java b/ojluni/src/main/java/sun/security/util/DerValue.java
index 3045995..7828820 100644
--- a/ojluni/src/main/java/sun/security/util/DerValue.java
+++ b/ojluni/src/main/java/sun/security/util/DerValue.java
@@ -72,13 +72,13 @@
private int length;
- // BEGIN Android-added: Original encoded form needed for APKs parsing/validation
+ // BEGIN Android-added: Original encoded form needed for APKs parsing/validation.
/**
* The original encoded form of the whole value (tag, length, and value)
* or null if the form was not provided or was not retained during parsing.
*/
private byte[] originalEncodedForm;
- // END Android-added: Original encoded form needed for APKs parsing/validation
+ // END Android-added: Original encoded form needed for APKs parsing/validation.
/*
* The type starts at the first byte of the encoding, and
@@ -251,7 +251,7 @@
/*
* package private
*/
- // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation
+ // BEGIN Android-changed: Original encoded form needed for APKs parsing/validation.
DerValue(DerInputBuffer in, boolean originalEncodedFormRetained)
throws IOException {
// XXX must also parse BER-encoded constructed
@@ -297,7 +297,7 @@
int consumed = in.getPos() - startPosInInput;
originalEncodedForm = in.getSlice(startPosInInput, consumed);
}
- // END Android-changed: Original encoded form needed for APKs parsing/validation
+ // END Android-changed: Original encoded form needed for APKs parsing/validation.
}
/**
@@ -838,7 +838,7 @@
}
}
- // BEGIN Android-added: Original encoded form needed for APKs parsing/validation
+ // BEGIN Android-added: Original encoded form needed for APKs parsing/validation.
/**
* Returns the original encoded form or {@code null} if the form was not
* retained or is not available.
@@ -847,7 +847,7 @@
return (originalEncodedForm != null)
? originalEncodedForm.clone() : null;
}
- // END Android-added: Original encoded form needed for APKs parsing/validation
+ // END Android-added: Original encoded form needed for APKs parsing/validation.
/**
* Returns a DER-encoded value, such that if it's passed to the
diff --git a/ojluni/src/main/java/sun/security/x509/X509CertImpl.java b/ojluni/src/main/java/sun/security/x509/X509CertImpl.java
index 57a8f71..f15b998 100644
--- a/ojluni/src/main/java/sun/security/x509/X509CertImpl.java
+++ b/ojluni/src/main/java/sun/security/x509/X509CertImpl.java
@@ -192,7 +192,7 @@
}
}
- // BEGIN Android-removed: unused code
+ // BEGIN Android-removed: unused code.
/*
/**
* unmarshals an X.509 certificate from an input stream. If the
@@ -280,7 +280,7 @@
return der;
}
*/
- // END Android-removed: unused code
+ // END Android-removed: unused code.
/**
* Construct an initialized X509 Certificate. The certificate is stored
@@ -310,7 +310,7 @@
}
}
- // BEGIN Android-added: Ctor to retain original encoded form for APKs parsing
+ // BEGIN Android-added: Ctor to retain original encoded form for APKs parsing.
/**
* Unmarshal a certificate from its encoded form, parsing a DER value.
* This form of constructor is used by agents which need to examine
@@ -328,7 +328,7 @@
throw new CertificateException("Unable to initialize, " + e, e);
}
}
- // END Android-added: Ctor to retain original encoded form for APKs parsing
+ // END Android-added: Ctor to retain original encoded form for APKs parsing.
/**
* Appends the certificate to an output stream.
@@ -1814,7 +1814,7 @@
throw new CertificateParsingException(
"invalid DER-encoded certificate data");
- // Android-changed: Needed for providing encoded form of cert
+ // Android-changed: Needed for providing encoded form of cert.
// signedCert = val.toByteArray();
signedCert =
(originalEncodedForm != null)
@@ -1972,12 +1972,12 @@
private ConcurrentHashMap<String,String> fingerprints =
new ConcurrentHashMap<>(2);
-// BEGIN Android-removed
+// BEGIN Android-removed: unused code.
// public String getFingerprint(String algorithm) {
// return fingerprints.computeIfAbsent(algorithm,
// x -> getFingerprint(x, this));
// }
-// END Android-removed
+// END Android-removed: unused code.
/**
* Gets the requested finger print of the certificate. The result
diff --git a/ojluni/src/main/java/sun/util/locale/LocaleMatcher.java b/ojluni/src/main/java/sun/util/locale/LocaleMatcher.java
index 70fabc7..37eb416 100644
--- a/ojluni/src/main/java/sun/util/locale/LocaleMatcher.java
+++ b/ojluni/src/main/java/sun/util/locale/LocaleMatcher.java
@@ -212,7 +212,7 @@
if (range.equals("*")) {
continue;
}
- // Android-changed: backport OpenJDK 9 fix for JDK-8166994
+ // Android-changed: backport OpenJDK 9 fix for JDK-8166994.
String rangeForRegex = range.replace("*", "\\p{Alnum}*");
while (rangeForRegex.length() > 0) {
for (String tag : tags) {
@@ -242,7 +242,7 @@
}
public static List<LanguageRange> parse(String ranges) {
- // Android-changed: backport OpenJDK 9 fix for JDK-8166994
+ // Android-changed: backport OpenJDK 9 fix for JDK-8166994.
ranges = ranges.replace(" ", "").toLowerCase();
if (ranges.startsWith("accept-language:")) {
ranges = ranges.substring(16); // delete unnecessary prefix
@@ -332,7 +332,7 @@
return list;
}
- // BEGIN Android-added: backport OpenJDK 9 fix for JDK-8166994
+ // BEGIN Android-added: backport OpenJDK 9 fix for JDK-8166994.
/**
* A faster alternative approach to String.replaceFirst(), if the given
* string is a literal String, not a regex.
@@ -347,7 +347,7 @@
+ range.substring(pos + substr.length());
}
}
- // END Android-added: backport OpenJDK 9 fix for JDK-8166994
+ // END Android-added: backport OpenJDK 9 fix for JDK-8166994.
private static String[] getEquivalentsForLanguage(String range) {
String r = range;
@@ -357,7 +357,7 @@
String equiv = LocaleEquivalentMaps.singleEquivMap.get(r);
// Return immediately for performance if the first matching
// subtag is found.
-// BEGIN Android-added: backport OpenJDK 9 fix for JDK-8166994
+// BEGIN Android-added: backport OpenJDK 9 fix for JDK-8166994.
// Upstream bug: https://bugs.openjdk.java.net/browse/JDK-8166994
// Upstream fix: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/60837db5d445
return new String[]{replaceFirstSubStringMatch(range,
@@ -370,7 +370,7 @@
r, equivs[i]);
}
return result;
-// END Android-added: backport OpenJDK 9 fix for JDK-8166994
+// END Android-added: backport OpenJDK 9 fix for JDK-8166994.
}
// Truncate the last subtag simply.
diff --git a/tools/patch-style/libcore-patch-style.awk b/tools/patch-style/libcore-patch-style.awk
new file mode 100644
index 0000000..e138298
--- /dev/null
+++ b/tools/patch-style/libcore-patch-style.awk
@@ -0,0 +1,175 @@
+# Copyright 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Simple libcore patch-style checking based on http://go/libcore-patch-style.
+#
+# See sample-input.java for examples of matches and failures.
+#
+# Usage:
+# awk -f libcore-patch-style.awk <file0> [... fileN]
+#
+# This script ignores any files whose name does not end in the suffix ".java".
+#
+# To scan all source code in the libcore tree:
+# $ cd libcore
+# $ find . -type f | xargs awk -f tools/patch-style/libcore-patch-style.awk
+#
+# To find sources with the most issues:
+# $ cd libcore
+# $ find . -type f | xargs awk -f tools/patch-style/libcore-patch-style.awk \
+# | grep -F ./ | sed -e 's/:.*//' | uniq -c | sort -n -r | head
+
+BEGIN {
+ g_errors = 0 # Number of errors accumulated.
+ g_expected_end = "" # Expected END line.
+ g_max_length = 100 # Maximum line length for markers (0 == no checking).
+ g_stop_oneline_interleaving = 0 # Error one-line comments between BEGIN and END markers.
+}
+
+BEGINFILE {
+ # Skip files whose names do not have a .java suffix.
+ if (FILENAME !~ /\.java$/) {
+ nextfile
+ }
+
+ # Reset the line number for reporting errors back to zero.
+ NR = 0
+
+ # Clear expected end marker as processing a new file.
+ g_expected_end = ""
+}
+
+function error(message) {
+ print(FILENAME ":" NR ":", message "\n")
+ g_errors += 1;
+}
+
+function expectationError(reason, expected, actual) {
+ error(reason "\n Expected: \"" expected "\"\n Actual: \"" actual "\"")
+}
+
+function inputError(reason, actual) {
+ error(reason "\n Input: \"" actual "\"")
+}
+
+function checkLineLength(line) {
+ if (g_max_length > 0 && length(line) > g_max_length) {
+ inputError("Line too long", line)
+ }
+}
+
+function leftTrim(message) {
+ return gensub(/^ */, "", 1, message)
+}
+
+function failIfEndExpected() {
+ if (g_expected_end != "") {
+ expectationError("Missing END marker.", g_expected_end, $0)
+ g_expected_end = ""
+ }
+}
+
+function expectEndFor(begin_line) {
+ g_expected_end = begin_line
+ sub("BEGIN", "END", g_expected_end)
+}
+
+function actualEndFor(actual_line) {
+ if (actual_line != g_expected_end) {
+ expectationError("Bad END marker.", g_expected_end, actual_line)
+ }
+ g_expected_end = ""
+}
+
+function processBeginMarker(line) {
+ failIfEndExpected()
+ expectEndFor(line)
+}
+
+function processEndMarker(line) {
+ actualEndFor(line)
+}
+
+# BEGIN marker ending in a period.
+/^ *\/\/ BEGIN Android-(added|changed|note|removed):.*\./ {
+ checkLineLength($0)
+ processBeginMarker($0)
+ next
+}
+
+# BEGIN marker ending in a period.
+/^ *\/\/ END Android-(added|changed|note|removed):.*\./ {
+ checkLineLength($0)
+ processEndMarker($0)
+ next
+}
+
+# BEGIN marker ending in a bug reference.
+/^ *\/\/ BEGIN Android-(added|changed|note|removed):.*[.](http:\/\/)?b\/[1-9][0-9]*/ {
+ checkLineLength($0)
+ processBeginMarker($0)
+ next
+}
+
+# BEGIN marker ending in anything else, oops!
+/^ *\/\/ BEGIN Android-(added|changed|note|removed)[^:].*/ {
+ inputError("BEGIN marker is missing colon or description.", $0)
+ next
+}
+
+# END marker, should be paired with last BEGIN marker.
+/^ *\/\/ END Android-(added|changed|note|removed):.*/ {
+ checkLineLength($0)
+ processEndMarker($0)
+ next
+}
+
+# One line change marker ending in a period.
+/^ *\/\/ Android-(added|changed|note|removed):.*[.]/ {
+ checkLineLength($0)
+ if (g_stop_oneline_interleaving) {
+ failIfEndExpected()
+ }
+ next
+}
+
+# One line change marker ending in a bug reference.
+/^ *\/\/ Android-(added|changed|note|removed):[.](http:\/\/)?b\/[1-9][0-9]*/ {
+ checkLineLength($0)
+ if (g_stop_oneline_interleaving) {
+ failIfEndExpected()
+ }
+ next
+}
+
+# One line change marker missing comment after colon.
+/^ *\/\/ BEGIN Android-(added|changed|note|removed).*/ {
+ inputError("Bad change marker: missing colon or description.", $0)
+ next
+}
+
+# Something that looks like a potential change marker.
+/^ *(\/\*|\/\/|\*) *(Android|ANDROID)-/ {
+ if (g_stop_oneline_interleaving) {
+ failIfEndExpected()
+ }
+ inputError("Bad change marker.", $0)
+ next
+}
+
+END {
+ failIfEndExpected()
+ printf("Found " g_errors " libcore patch style issues.\n")
+ exit g_errors == 0
+}
diff --git a/tools/patch-style/sample-input.java b/tools/patch-style/sample-input.java
new file mode 100644
index 0000000..8d55cfe
--- /dev/null
+++ b/tools/patch-style/sample-input.java
@@ -0,0 +1,32 @@
+# HAPPY PATHS
+ // BEGIN Android-added: something bot like.
+ // END Android-added: something bot like.
+
+ // BEGIN Android-changed: something bot like. http://b/12345
+ // END Android-changed: something bot like. http://b/12345
+
+ // BEGIN Android-removed: coffee stain. b/12345
+ // END Android-changed: something bot like. http://b/12345
+
+ // Android-added: hello world.
+ // Android-change: hello world. http://b/1100
+ // Android-remove: goodbye world. http://b/999912
+
+# UNHAPPY PATHS
+
+ // BEGIN Android-added something bot like.
+ // END Android-added something bot like.
+
+ // Android-note: blah
+ // Android-note: blah.
+ // Android-changed hello
+ // Android-added: hello
+
+ /* Android-note blah balh */
+ /* Android note: blah balh */
+ /* ANDROID android android android */
+ * ANDROID *
+
+Android-bar
+
+// BEGIN Android-removed: END from last line.