From 9826b64e1f03cbeedc931babdf987c357032b66a Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Wed, 8 Jun 2016 15:47:09 -0400 Subject: [PATCH] Exempt LocalDate from bridge method checks on java 9 The painless whitelist has a lot of self-checking, in this case, it checks for missing covariant overrides. It fails on java 9, because LocalDate.getEra() now returns IsoEra instead of Era: https://bugs.openjdk.java.net/browse/JDK-8072746 To our checker, it thinks we were lazy with whitelisting :) This means painless works on java 9 again --- .../src/main/java/org/elasticsearch/painless/Definition.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/Definition.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/Definition.java index a68c9629a2d..dbfc9993c31 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/Definition.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/Definition.java @@ -19,6 +19,7 @@ package org.elasticsearch.painless; +import org.apache.lucene.util.Constants; import org.apache.lucene.util.SetOnce; import java.io.InputStream; @@ -28,6 +29,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Modifier; import java.nio.charset.StandardCharsets; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -864,6 +866,9 @@ public final class Definition { // ok } else if (child.clazz == Spliterator.OfPrimitive.class || child.clazz == PrimitiveIterator.class) { // ok, we rely on generics erasure for these (its guaranteed in the javadocs though!!!!) + } else if (Constants.JRE_IS_MINIMUM_JAVA9 && owner.clazz == LocalDate.class) { + // ok, java 9 added covariant override for LocalDate.getEra() to return IsoEra: + // https://bugs.openjdk.java.net/browse/JDK-8072746 } else { try { Class arguments[] = new Class[method.arguments.size()];