Skip to content
Permalink
Browse files

Fix nonpublic identifiers and documentation that use "whitelist" or "…

…blacklist" to use less problematic terms.

RELNOTES=n/a

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199834981
  • Loading branch information
netdpb authored and ronshapiro committed Jun 8, 2018
1 parent c2f8967 commit 0cd4e9faa1360da4a343f84cb275d6eda0c5e732
@@ -57,7 +57,7 @@
* would no longer have the problematic test. But why bother when we can instead strip it with
* a more precisely named annotation?
* <li>While a dependency on Android ought to be easy if it's for annotations only, it will
* probably require adding the dep to various whitelists, license files, and Proguard
* probably require adding the dep to various ACLs, license files, and Proguard
* configurations, and there's always the potential that something will go wrong. It
* <i>probably</i> won't, since the deps are needed only in tests (and maybe someday in
* testlib), but why bother?
@@ -50,15 +50,15 @@
// execution significantly)

/**
* This classloader blacklists sun.misc.Unsafe which will prevent us from selecting our preferred
* strategy {@code UnsafeAtomicHelper}.
* This classloader disallows {@link sun.misc.Unsafe}, which will prevent us from selecting our
* preferred strategy {@code UnsafeAtomicHelper}.
*/
private static final ClassLoader NO_UNSAFE =
getClassLoader(ImmutableSet.of(sun.misc.Unsafe.class.getName()));

/**
* This classloader blacklists sun.misc.Unsafe and AtomicReferenceFieldUpdater which will prevent
* us from selecting our {@code SafeAtomicHelper} strategy.
* This classloader disallows {@link sun.misc.Unsafe} and {@link AtomicReferenceFieldUpdater},
* which will prevent us from selecting our {@code SafeAtomicHelper} strategy.
*/
private static final ClassLoader NO_ATOMIC_REFERENCE_FIELD_UPDATER =
getClassLoader(
@@ -86,7 +86,7 @@ public void runTest() throws Exception {
checkHelperVersion(NO_UNSAFE, "SafeAtomicHelper");
checkHelperVersion(NO_ATOMIC_REFERENCE_FIELD_UPDATER, "SynchronizedHelper");

// Run the corresponding AbstractFutureTest test method in a new classloader that blacklists
// Run the corresponding AbstractFutureTest test method in a new classloader that disallows
// certain core jdk classes.
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(NO_UNSAFE);
@@ -119,14 +119,14 @@ private void checkHelperVersion(ClassLoader classLoader, String expectedHelperCl
assertEquals(expectedHelperClassName, helperField.get(null).getClass().getSimpleName());
}

private static ClassLoader getClassLoader(final Set<String> blacklist) {
private static ClassLoader getClassLoader(final Set<String> disallowedClassNames) {
final String concurrentPackage = SettableFuture.class.getPackage().getName();
ClassLoader classLoader = AbstractFutureFallbackAtomicHelperTest.class.getClassLoader();
// we delegate to the current classloader so both loaders agree on classes like TestCase
return new URLClassLoader(ClassPathUtil.getClassPathUrls(), classLoader) {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (blacklist.contains(name)) {
if (disallowedClassNames.contains(name)) {
throw new ClassNotFoundException("I'm sorry Dave, I'm afraid I can't do that.");
}
if (name.startsWith(concurrentPackage)) {
@@ -48,7 +48,7 @@
public class AggregateFutureStateFallbackAtomicHelperTest extends TestCase {

/**
* This classloader blacklists AtomicReferenceFieldUpdater and AtomicIntegerFieldUpdate which will
* This classloader disallows AtomicReferenceFieldUpdater and AtomicIntegerFieldUpdate which will
* prevent us from selecting our {@code SafeAtomicHelper} strategy.
*
* <p>Stashing this in a static field avoids loading it over and over again and speeds up test
@@ -81,7 +81,7 @@ public void runTest() throws Exception {
checkHelperVersion(getClass().getClassLoader(), "SafeAtomicHelper");
checkHelperVersion(NO_ATOMIC_FIELD_UPDATER, "SynchronizedAtomicHelper");

// Run the corresponding FuturesTest test method in a new classloader that blacklists
// Run the corresponding FuturesTest test method in a new classloader that disallows
// certain core jdk classes.
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(NO_ATOMIC_FIELD_UPDATER);
@@ -110,14 +110,14 @@ private void checkHelperVersion(ClassLoader classLoader, String expectedHelperCl
assertEquals(expectedHelperClassName, helperField.get(null).getClass().getSimpleName());
}

private static ClassLoader getClassLoader(final Set<String> blacklist) {
private static ClassLoader getClassLoader(final Set<String> blocklist) {
final String concurrentPackage = SettableFuture.class.getPackage().getName();
ClassLoader classLoader = AggregateFutureStateFallbackAtomicHelperTest.class.getClassLoader();
// we delegate to the current classloader so both loaders agree on classes like TestCase
return new URLClassLoader(ClassPathUtil.getClassPathUrls(), classLoader) {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (blacklist.contains(name)) {
if (blocklist.contains(name)) {
throw new ClassNotFoundException("I'm sorry Dave, I'm afraid I can't do that.");
}
if (name.startsWith(concurrentPackage)) {
@@ -468,7 +468,7 @@ private static Object invokeAccessibleNonThrowingMethod(
private static final Method getStackTraceDepthMethod = (jla == null) ? null : getSizeMethod();

/**
* Returns the JavaLangAccess class that is present in all Sun JDKs. It is not whitelisted for
* Returns the JavaLangAccess class that is present in all Sun JDKs. It is not allowed in
* AppEngine, and not present in non-Sun JDKs.
*/
@GwtIncompatible // java.lang.reflect
@@ -486,7 +486,7 @@ private static Object getJLA() {
throw death;
} catch (Throwable t) {
/*
* This is not one of AppEngine's whitelisted classes, so even in Sun JDKs, this can fail with
* This is not one of AppEngine's allowed classes, so even in Sun JDKs, this can fail with
* a NoClassDefFoundError. Other apps might deny access to sun.misc packages.
*/
return null;
@@ -8,7 +8,7 @@ NAMESPACE com.google.common.io
NAMESPACE com.google.common.net
NAMESPACE com.google.common.testing

# Whitelist our dependencies for now.
# Allow our dependencies for now.
NAMESPACE junit.framework
NAMESPACE org.junit

@@ -57,7 +57,7 @@
* would no longer have the problematic test. But why bother when we can instead strip it with
* a more precisely named annotation?
* <li>While a dependency on Android ought to be easy if it's for annotations only, it will
* probably require adding the dep to various whitelists, license files, and Proguard
* probably require adding the dep to various ACLs, license files, and Proguard
* configurations, and there's always the potential that something will go wrong. It
* <i>probably</i> won't, since the deps are needed only in tests (and maybe someday in
* testlib), but why bother?
@@ -50,15 +50,15 @@
// execution significantly)

/**
* This classloader blacklists sun.misc.Unsafe which will prevent us from selecting our preferred
* strategy {@code UnsafeAtomicHelper}.
* This classloader disallows {@link sun.misc.Unsafe}, which will prevent us from selecting our
* preferred strategy {@code UnsafeAtomicHelper}.
*/
private static final ClassLoader NO_UNSAFE =
getClassLoader(ImmutableSet.of(sun.misc.Unsafe.class.getName()));

/**
* This classloader blacklists sun.misc.Unsafe and AtomicReferenceFieldUpdater which will prevent
* us from selecting our {@code SafeAtomicHelper} strategy.
* This classloader disallows {@link sun.misc.Unsafe} and {@link AtomicReferenceFieldUpdater},
* which will prevent us from selecting our {@code SafeAtomicHelper} strategy.
*/
private static final ClassLoader NO_ATOMIC_REFERENCE_FIELD_UPDATER =
getClassLoader(
@@ -86,7 +86,7 @@ public void runTest() throws Exception {
checkHelperVersion(NO_UNSAFE, "SafeAtomicHelper");
checkHelperVersion(NO_ATOMIC_REFERENCE_FIELD_UPDATER, "SynchronizedHelper");

// Run the corresponding AbstractFutureTest test method in a new classloader that blacklists
// Run the corresponding AbstractFutureTest test method in a new classloader that disallows
// certain core jdk classes.
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(NO_UNSAFE);
@@ -119,14 +119,14 @@ private void checkHelperVersion(ClassLoader classLoader, String expectedHelperCl
assertEquals(expectedHelperClassName, helperField.get(null).getClass().getSimpleName());
}

private static ClassLoader getClassLoader(final Set<String> blacklist) {
private static ClassLoader getClassLoader(final Set<String> disallowedClassNames) {
final String concurrentPackage = SettableFuture.class.getPackage().getName();
ClassLoader classLoader = AbstractFutureFallbackAtomicHelperTest.class.getClassLoader();
// we delegate to the current classloader so both loaders agree on classes like TestCase
return new URLClassLoader(ClassPathUtil.getClassPathUrls(), classLoader) {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (blacklist.contains(name)) {
if (disallowedClassNames.contains(name)) {
throw new ClassNotFoundException("I'm sorry Dave, I'm afraid I can't do that.");
}
if (name.startsWith(concurrentPackage)) {
@@ -48,7 +48,7 @@
public class AggregateFutureStateFallbackAtomicHelperTest extends TestCase {

/**
* This classloader blacklists AtomicReferenceFieldUpdater and AtomicIntegerFieldUpdate which will
* This classloader disallows AtomicReferenceFieldUpdater and AtomicIntegerFieldUpdate which will
* prevent us from selecting our {@code SafeAtomicHelper} strategy.
*
* <p>Stashing this in a static field avoids loading it over and over again and speeds up test
@@ -81,7 +81,7 @@ public void runTest() throws Exception {
checkHelperVersion(getClass().getClassLoader(), "SafeAtomicHelper");
checkHelperVersion(NO_ATOMIC_FIELD_UPDATER, "SynchronizedAtomicHelper");

// Run the corresponding FuturesTest test method in a new classloader that blacklists
// Run the corresponding FuturesTest test method in a new classloader that disallows
// certain core jdk classes.
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(NO_ATOMIC_FIELD_UPDATER);
@@ -110,14 +110,14 @@ private void checkHelperVersion(ClassLoader classLoader, String expectedHelperCl
assertEquals(expectedHelperClassName, helperField.get(null).getClass().getSimpleName());
}

private static ClassLoader getClassLoader(final Set<String> blacklist) {
private static ClassLoader getClassLoader(final Set<String> blocklist) {
final String concurrentPackage = SettableFuture.class.getPackage().getName();
ClassLoader classLoader = AggregateFutureStateFallbackAtomicHelperTest.class.getClassLoader();
// we delegate to the current classloader so both loaders agree on classes like TestCase
return new URLClassLoader(ClassPathUtil.getClassPathUrls(), classLoader) {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (blacklist.contains(name)) {
if (blocklist.contains(name)) {
throw new ClassNotFoundException("I'm sorry Dave, I'm afraid I can't do that.");
}
if (name.startsWith(concurrentPackage)) {
@@ -467,7 +467,7 @@ private static Object invokeAccessibleNonThrowingMethod(
(jla == null) ? null : getSizeMethod();

/**
* Returns the JavaLangAccess class that is present in all Sun JDKs. It is not whitelisted for
* Returns the JavaLangAccess class that is present in all Sun JDKs. It is not allowed in
* AppEngine, and not present in non-Sun JDKs.
*/
@GwtIncompatible // java.lang.reflect
@@ -484,7 +484,7 @@ private static Object invokeAccessibleNonThrowingMethod(
throw death;
} catch (Throwable t) {
/*
* This is not one of AppEngine's whitelisted classes, so even in Sun JDKs, this can fail with
* This is not one of AppEngine's allowed classes, so even in Sun JDKs, this can fail with
* a NoClassDefFoundError. Other apps might deny access to sun.misc packages.
*/
return null;

0 comments on commit 0cd4e9f

Please sign in to comment.
You can’t perform that action at this time.