ban slow methods in MethodHandle

This commit is contained in:
Robert Muir 2016-06-06 17:58:00 -04:00
parent b32f6abb26
commit 23d7cdd043
2 changed files with 8 additions and 0 deletions

View File

@ -92,3 +92,8 @@ org.joda.time.DateTime#<init>(int, int, int, int, int, int)
org.joda.time.DateTime#<init>(int, int, int, int, int, int, int)
org.joda.time.DateTime#now()
org.joda.time.DateTimeZone#getDefault()
@defaultMessage Don't use MethodHandles in slow ways, except in tests.
java.lang.invoke.MethodHandle#invoke(java.lang.Object[])
java.lang.invoke.MethodHandle#invokeWithArguments(java.lang.Object[])
java.lang.invoke.MethodHandle#invokeWithArguments(java.util.List)

View File

@ -1,5 +1,7 @@
package org.elasticsearch.painless;
import org.elasticsearch.common.SuppressForbidden;
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
@ -115,6 +117,7 @@ public final class DefBootstrap {
* Called when a new type is encountered (or, when we have encountered more than {@code MAX_DEPTH}
* types at this call site and given up on caching).
*/
@SuppressForbidden(reason = "slow path")
Object fallback(Object[] args) throws Throwable {
final MethodType type = type();
final Object receiver = args[0];