Merge pull request #18960 from uschindler/forbiddenapis-2.2

Update forbiddenapis to 2.2
This commit is contained in:
Robert Muir 2016-06-19 17:17:45 -04:00 committed by GitHub
commit 92bc29266b
4 changed files with 11 additions and 5 deletions

View File

@ -84,7 +84,7 @@ dependencies {
compile 'com.netflix.nebula:gradle-info-plugin:3.0.3' compile 'com.netflix.nebula:gradle-info-plugin:3.0.3'
compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r' compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r'
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE.... compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
compile 'de.thetaphi:forbiddenapis:2.1' compile 'de.thetaphi:forbiddenapis:2.2'
compile 'com.bmuschko:gradle-nexus-plugin:2.3.1' compile 'com.bmuschko:gradle-nexus-plugin:2.3.1'
compile 'org.apache.rat:apache-rat:0.11' compile 'org.apache.rat:apache-rat:0.11'
} }

View File

@ -32,7 +32,7 @@ org.apache.lucene.index.IndexReader#getCombinedCoreAndDeletesKey()
@defaultMessage Soon to be removed @defaultMessage Soon to be removed
org.apache.lucene.document.FieldType#numericType() org.apache.lucene.document.FieldType#numericType()
@defaultMessage Don't use MethodHandles in slow ways, dont be lenient in tests. @defaultMessage Don't use MethodHandles in slow ways, don't be lenient in tests.
# unfortunately, invoke() cannot be banned, because forbidden apis does not support signature polymorphic methods java.lang.invoke.MethodHandle#invoke(java.lang.Object[])
java.lang.invoke.MethodHandle#invokeWithArguments(java.lang.Object[]) java.lang.invoke.MethodHandle#invokeWithArguments(java.lang.Object[])
java.lang.invoke.MethodHandle#invokeWithArguments(java.util.List) java.lang.invoke.MethodHandle#invokeWithArguments(java.util.List)

View File

@ -19,6 +19,9 @@
package org.elasticsearch.painless; package org.elasticsearch.painless;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodType;
/** Tests for or operator across all types */ /** Tests for or operator across all types */
public class ArrayTests extends ScriptTestCase { public class ArrayTests extends ScriptTestCase {
@ -36,7 +39,10 @@ public class ArrayTests extends ScriptTestCase {
} }
private void assertArrayLength(int length, Object array) throws Throwable { private void assertArrayLength(int length, Object array) throws Throwable {
assertEquals(length, (int) Def.arrayLengthGetter(array.getClass()).invoke(array)); final MethodHandle mh = Def.arrayLengthGetter(array.getClass());
assertSame(array.getClass(), mh.type().parameterType(0));
assertEquals(length, (int) mh.asType(MethodType.methodType(int.class, Object.class))
.invokeExact(array));
} }
public void testArrayLoadStoreInt() { public void testArrayLoadStoreInt() {

View File

@ -139,7 +139,7 @@ public class DefBootstrapTests extends ESTestCase {
DefBootstrap.BINARY_OPERATOR, DefBootstrap.OPERATOR_ALLOWS_NULL); DefBootstrap.BINARY_OPERATOR, DefBootstrap.OPERATOR_ALLOWS_NULL);
MethodHandle handle = site.dynamicInvoker(); MethodHandle handle = site.dynamicInvoker();
assertEquals(2, (Object)handle.invokeExact((Object)1, (Object)1)); assertEquals(2, (Object)handle.invokeExact((Object)1, (Object)1));
assertEquals("nulltest", (Object)handle.invoke((Object)null, (Object)"test")); assertEquals("nulltest", (Object)handle.invokeExact((Object)null, (Object)"test"));
} }
public void testNullGuardEq() throws Throwable { public void testNullGuardEq() throws Throwable {