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 05c12c30239..db9330174cc 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 @@ -38,7 +38,14 @@ import java.util.Objects; */ public final class Definition { - private static final String DEFINITION_FILE = "definition.txt"; + private static final List DEFINITION_FILES = Collections.unmodifiableList( + Arrays.asList("org.elasticsearch.txt", + "java.lang.txt", + "java.math.txt", + "java.text.txt", + "java.util.txt", + "java.util.function.txt", + "java.util.stream.txt")); private static final Definition INSTANCE = new Definition(); @@ -158,15 +165,13 @@ public final class Definition { public final Struct owner; public final List arguments; public final org.objectweb.asm.commons.Method method; - public final java.lang.reflect.Constructor reflect; - private Constructor(final String name, final Struct owner, final List arguments, - final org.objectweb.asm.commons.Method method, final java.lang.reflect.Constructor reflect) { + private Constructor(String name, Struct owner, List arguments, + org.objectweb.asm.commons.Method method) { this.name = name; this.owner = owner; this.arguments = Collections.unmodifiableList(arguments); this.method = method; - this.reflect = reflect; } } @@ -176,18 +181,17 @@ public final class Definition { public final Type rtn; public final List arguments; public final org.objectweb.asm.commons.Method method; - public final java.lang.reflect.Method reflect; + public final int modifiers; public final MethodHandle handle; - private Method(final String name, final Struct owner, final Type rtn, final List arguments, - final org.objectweb.asm.commons.Method method, final java.lang.reflect.Method reflect, - final MethodHandle handle) { + private Method(String name, Struct owner, Type rtn, List arguments, + org.objectweb.asm.commons.Method method, int modifiers, MethodHandle handle) { this.name = name; this.owner = owner; this.rtn = rtn; this.arguments = Collections.unmodifiableList(arguments); this.method = method; - this.reflect = reflect; + this.modifiers = modifiers; this.handle = handle; } } @@ -196,16 +200,17 @@ public final class Definition { public final String name; public final Struct owner; public final Type type; - public final java.lang.reflect.Field reflect; - public final MethodHandle getter; - public final MethodHandle setter; + public final String javaName; + public final int modifiers; + private final MethodHandle getter; + private final MethodHandle setter; - private Field(final String name, final Struct owner, final Type type, - final java.lang.reflect.Field reflect, final MethodHandle getter, final MethodHandle setter) { + private Field(String name, String javaName, Struct owner, Type type, int modifiers, MethodHandle getter, MethodHandle setter) { this.name = name; + this.javaName = javaName; this.owner = owner; this.type = type; - this.reflect = reflect; + this.modifiers = modifiers; this.getter = getter; this.setter = setter; } @@ -420,102 +425,106 @@ public final class Definition { /** adds classes from definition. returns hierarchy */ private Map> addStructs() { final Map> hierarchy = new HashMap<>(); - int currentLine = -1; - try { - try (InputStream stream = Definition.class.getResourceAsStream(DEFINITION_FILE); - LineNumberReader reader = new LineNumberReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { - String line = null; - while ((line = reader.readLine()) != null) { - currentLine = reader.getLineNumber(); - line = line.trim(); - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } - if (line.startsWith("class ")) { - String elements[] = line.split("\u0020"); - assert elements[2].equals("->"); - if (elements.length == 7) { - hierarchy.put(elements[1], Arrays.asList(elements[5].split(","))); - } else { - assert elements.length == 5; + for (String file : DEFINITION_FILES) { + int currentLine = -1; + try { + try (InputStream stream = Definition.class.getResourceAsStream(file); + LineNumberReader reader = new LineNumberReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { + String line = null; + while ((line = reader.readLine()) != null) { + currentLine = reader.getLineNumber(); + line = line.trim(); + if (line.length() == 0 || line.charAt(0) == '#') { + continue; } - String className = elements[1]; - String javaPeer = elements[3]; - final Class javaClazz; - switch (javaPeer) { - case "void": - javaClazz = void.class; - break; - case "boolean": - javaClazz = boolean.class; - break; - case "byte": - javaClazz = byte.class; - break; - case "short": - javaClazz = short.class; - break; - case "char": - javaClazz = char.class; - break; - case "int": - javaClazz = int.class; - break; - case "long": - javaClazz = long.class; - break; - case "float": - javaClazz = float.class; - break; - case "double": - javaClazz = double.class; - break; - default: - javaClazz = Class.forName(javaPeer); - break; + if (line.startsWith("class ")) { + String elements[] = line.split("\u0020"); + assert elements[2].equals("->"); + if (elements.length == 7) { + hierarchy.put(elements[1], Arrays.asList(elements[5].split(","))); + } else { + assert elements.length == 5; + } + String className = elements[1]; + String javaPeer = elements[3]; + final Class javaClazz; + switch (javaPeer) { + case "void": + javaClazz = void.class; + break; + case "boolean": + javaClazz = boolean.class; + break; + case "byte": + javaClazz = byte.class; + break; + case "short": + javaClazz = short.class; + break; + case "char": + javaClazz = char.class; + break; + case "int": + javaClazz = int.class; + break; + case "long": + javaClazz = long.class; + break; + case "float": + javaClazz = float.class; + break; + case "double": + javaClazz = double.class; + break; + default: + javaClazz = Class.forName(javaPeer); + break; + } + addStruct(className, javaClazz); } - addStruct(className, javaClazz); } } + } catch (Exception e) { + throw new RuntimeException("syntax error in " + file + ", line: " + currentLine, e); } - } catch (Exception e) { - throw new RuntimeException("syntax error in definition line: " + currentLine, e); } return hierarchy; } /** adds class methods/fields/ctors */ private void addElements() { - int currentLine = -1; - try { - try (InputStream stream = Definition.class.getResourceAsStream(DEFINITION_FILE); - LineNumberReader reader = new LineNumberReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { - String line = null; - String currentClass = null; - while ((line = reader.readLine()) != null) { - currentLine = reader.getLineNumber(); - line = line.trim(); - if (line.length() == 0 || line.charAt(0) == '#') { - continue; - } else if (line.startsWith("class ")) { - assert currentClass == null; - currentClass = line.split("\u0020")[1]; - } else if (line.equals("}")) { - assert currentClass != null; - currentClass = null; - } else { - assert currentClass != null; - addSignature(currentClass, line); + for (String file : DEFINITION_FILES) { + int currentLine = -1; + try { + try (InputStream stream = Definition.class.getResourceAsStream(file); + LineNumberReader reader = new LineNumberReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { + String line = null; + String currentClass = null; + while ((line = reader.readLine()) != null) { + currentLine = reader.getLineNumber(); + line = line.trim(); + if (line.length() == 0 || line.charAt(0) == '#') { + continue; + } else if (line.startsWith("class ")) { + assert currentClass == null; + currentClass = line.split("\u0020")[1]; + } else if (line.equals("}")) { + assert currentClass != null; + currentClass = null; + } else { + assert currentClass != null; + addSignature(currentClass, line); + } } } + } catch (Exception e) { + throw new RuntimeException("syntax error in " + file + ", line: " + currentLine, e); } - } catch (Exception e) { - throw new RuntimeException("syntax error in definition line: " + currentLine, e); } } private final void addStruct(final String name, final Class clazz) { - if (!name.matches("^[_a-zA-Z][<>,_a-zA-Z0-9]*$")) { + if (!name.matches("^[_a-zA-Z][\\.,_a-zA-Z0-9]*$")) { throw new IllegalArgumentException("Invalid struct name [" + name + "]."); } @@ -575,7 +584,7 @@ public final class Definition { } final org.objectweb.asm.commons.Method asm = org.objectweb.asm.commons.Method.getMethod(reflect); - final Constructor constructor = new Constructor(name, owner, Arrays.asList(args), asm, reflect); + final Constructor constructor = new Constructor(name, owner, Arrays.asList(args), asm); owner.constructors.put(methodKey, constructor); } @@ -697,8 +706,8 @@ public final class Definition { " with arguments " + Arrays.toString(classes) + "."); } - final Method method = new Method(name, owner, rtn, Arrays.asList(args), asm, reflect, handle); final int modifiers = reflect.getModifiers(); + final Method method = new Method(name, owner, rtn, Arrays.asList(args), asm, modifiers, handle); if (java.lang.reflect.Modifier.isStatic(modifiers)) { owner.staticMethods.put(methodKey, method); @@ -751,7 +760,7 @@ public final class Definition { " not found for class [" + owner.clazz.getName() + "]."); } - final Field field = new Field(name, owner, type, reflect, getter, setter); + final Field field = new Field(name, reflect.getName(), owner, type, modifiers, getter, setter); if (isStatic) { // require that all static fields are static final @@ -766,7 +775,7 @@ public final class Definition { } } - private final void copyStruct(final String struct, List children) { + private void copyStruct(String struct, List children) { final Struct owner = structsMap.get(struct); if (owner == null) { @@ -776,7 +785,7 @@ public final class Definition { for (int count = 0; count < children.size(); ++count) { final Struct child = structsMap.get(children.get(count)); - if (struct == null) { + if (child == null) { throw new IllegalArgumentException("Child struct [" + children.get(count) + "]" + " not defined for copy to owner struct [" + owner.name + "]."); } @@ -786,62 +795,19 @@ public final class Definition { " is not a super type of owner struct [" + owner.name + "] in copy."); } - final boolean object = child.clazz.equals(Object.class) && - java.lang.reflect.Modifier.isInterface(owner.clazz.getModifiers()); - for (Map.Entry kvPair : child.methods.entrySet()) { MethodKey methodKey = kvPair.getKey(); Method method = kvPair.getValue(); if (owner.methods.get(methodKey) == null) { - final Class clazz = object ? Object.class : owner.clazz; - - java.lang.reflect.Method reflect; - MethodHandle handle; - - try { - reflect = clazz.getMethod(method.method.getName(), method.reflect.getParameterTypes()); - } catch (final NoSuchMethodException exception) { - throw new IllegalArgumentException("Method [" + method.method.getName() + "] not found for" + - " class [" + owner.clazz.getName() + "] with arguments " + - Arrays.toString(method.reflect.getParameterTypes()) + "."); - } - - try { - handle = MethodHandles.publicLookup().in(owner.clazz).unreflect(reflect); - } catch (final IllegalAccessException exception) { - throw new IllegalArgumentException("Method [" + method.method.getName() + "] not found for" + - " class [" + owner.clazz.getName() + "] with arguments " + - Arrays.toString(method.reflect.getParameterTypes()) + "."); - } - owner.methods.put(methodKey, - new Method(method.name, owner, method.rtn, method.arguments, method.method, reflect, handle)); + new Method(method.name, owner, method.rtn, method.arguments, method.method, method.modifiers, method.handle)); } } - for (final Field field : child.members.values()) { + for (Field field : child.members.values()) { if (owner.members.get(field.name) == null) { - java.lang.reflect.Field reflect; - MethodHandle getter; - MethodHandle setter; - - try { - reflect = owner.clazz.getField(field.reflect.getName()); - } catch (final NoSuchFieldException exception) { - throw new IllegalArgumentException("Field [" + field.reflect.getName() + "]" + - " not found for class [" + owner.clazz.getName() + "]."); - } - - try { - getter = MethodHandles.publicLookup().unreflectGetter(reflect); - setter = MethodHandles.publicLookup().unreflectSetter(reflect); - } catch (final IllegalAccessException exception) { - throw new IllegalArgumentException("Getter/Setter [" + field.name + "]" + - " not found for class [" + owner.clazz.getName() + "]."); - } - owner.members.put(field.name, - new Field(field.name, owner, field.type, reflect, getter, setter)); + new Field(field.name, field.javaName, owner, field.type, field.modifiers, field.getter, field.setter)); } } } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java index fdb6612e1f4..ea75215c5c8 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LCall.java @@ -94,7 +94,7 @@ public final class LCall extends ALink { argument.write(adapter); } - if (java.lang.reflect.Modifier.isStatic(method.reflect.getModifiers())) { + if (java.lang.reflect.Modifier.isStatic(method.modifiers)) { adapter.invokeStatic(method.owner.type, method.method); } else if (java.lang.reflect.Modifier.isInterface(method.owner.clazz.getModifiers())) { adapter.invokeInterface(method.owner.type, method.method); diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java index 44ba33acdda..0cf3b9a6e94 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LField.java @@ -62,7 +62,7 @@ public final class LField extends ALink { field = statik ? struct.staticMembers.get(value) : struct.members.get(value); if (field != null) { - if (store && java.lang.reflect.Modifier.isFinal(field.reflect.getModifiers())) { + if (store && java.lang.reflect.Modifier.isFinal(field.modifiers)) { throw new IllegalArgumentException(error( "Cannot write to read-only field [" + value + "] for type [" + struct.name + "].")); } @@ -104,19 +104,19 @@ public final class LField extends ALink { @Override void load(MethodWriter adapter) { - if (java.lang.reflect.Modifier.isStatic(field.reflect.getModifiers())) { - adapter.getStatic(field.owner.type, field.reflect.getName(), field.type.type); + if (java.lang.reflect.Modifier.isStatic(field.modifiers)) { + adapter.getStatic(field.owner.type, field.javaName, field.type.type); } else { - adapter.getField(field.owner.type, field.reflect.getName(), field.type.type); + adapter.getField(field.owner.type, field.javaName, field.type.type); } } @Override void store(MethodWriter adapter) { - if (java.lang.reflect.Modifier.isStatic(field.reflect.getModifiers())) { - adapter.putStatic(field.owner.type, field.reflect.getName(), field.type.type); + if (java.lang.reflect.Modifier.isStatic(field.modifiers)) { + adapter.putStatic(field.owner.type, field.javaName, field.type.type); } else { - adapter.putField(field.owner.type, field.reflect.getName(), field.type.type); + adapter.putField(field.owner.type, field.javaName, field.type.type); } } } diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/definition.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/definition.txt deleted file mode 100644 index 379fadb9865..00000000000 --- a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/definition.txt +++ /dev/null @@ -1,375 +0,0 @@ -# -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you 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. -# - -# -# Painless definition file. This defines the hierarchy of classes, -# what methods and fields they have, etc. -# - -# primitive types - -class void -> void { -} - -class boolean -> boolean { -} - -class byte -> byte { -} - -class short -> short { -} - -class char -> char { -} - -class int -> int { -} - -class long -> long { -} - -class float -> float { -} - -class double -> double { -} - -# basic JDK classes - -class Object -> java.lang.Object { - boolean equals(Object) - int hashCode() - String toString() -} - -class def -> java.lang.Object { - boolean equals(Object) - int hashCode() - String toString() -} - -class Void -> java.lang.Void extends Object { -} - -class Boolean -> java.lang.Boolean extends Object { - Boolean TRUE - Boolean FALSE - int compare(boolean,boolean) - boolean parseBoolean(String) - Boolean valueOf(boolean) - boolean booleanValue() - int compareTo(Boolean) -} - -class Byte -> java.lang.Byte extends Number,Object { - byte MIN_VALUE - byte MAX_VALUE - int compare(byte,byte) - int compareTo(Byte) - byte parseByte(String) - Byte valueOf(byte) -} - -class Short -> java.lang.Short extends Number,Object { - short MIN_VALUE - short MAX_VALUE - int compare(short,short) - int compareTo(Short) - short parseShort(String) - Short valueOf(short) -} - -class Character -> java.lang.Character extends Object { - char MIN_VALUE - char MAX_VALUE - int charCount(int) - char charValue() - int compare(char,char) - int compareTo(Character) - int digit(int,int) - char forDigit(int,int) - String getName(int) - int getNumericValue(int) - boolean isAlphabetic(int) - boolean isDefined(int) - boolean isDigit(int) - boolean isIdeographic(int) - boolean isLetter(int) - boolean isLetterOrDigit(int) - boolean isLowerCase(int) - boolean isMirrored(int) - boolean isSpaceChar(int) - boolean isTitleCase(int) - boolean isUpperCase(int) - boolean isWhitespace(int) - Character valueOf(char) -} - -class Integer -> java.lang.Integer extends Number,Object { - int MIN_VALUE - int MAX_VALUE - int compare(int,int) - int compareTo(Integer) - int min(int,int) - int max(int,int) - int parseInt(String) - int signum(int) - String toHexString(int) - Integer valueOf(int) -} - -class Long -> java.lang.Long extends Number,Object { - long MIN_VALUE - long MAX_VALUE - int compare(long,long) - int compareTo(Long) - long min(long,long) - long max(long,long) - long parseLong(String) - int signum(long) - String toHexString(long) - Long valueOf(long) -} - -class Float -> java.lang.Float extends Number,Object { - float MIN_VALUE - float MAX_VALUE - int compare(float,float) - int compareTo(Float) - float min(float,float) - float max(float,float) - float parseFloat(String) - String toHexString(float) - Float valueOf(float) -} - -class Double -> java.lang.Double extends Number,Object { - double MIN_VALUE - double MAX_VALUE - int compare(double,double) - int compareTo(Double) - double min(double,double) - double max(double,double) - double parseDouble(String) - String toHexString(double) - Double valueOf(double) -} - -class Number -> java.lang.Number extends Object { - byte byteValue() - short shortValue() - int intValue() - long longValue() - float floatValue() - double doubleValue() -} - -class CharSequence -> java.lang.CharSequence extends Object { - char charAt(int) - int length() -} - -class String -> java.lang.String extends CharSequence,Object { - String () - int codePointAt(int) - int compareTo(String) - String concat(String) - boolean endsWith(String) - int indexOf(String) - int indexOf(String,int) - boolean isEmpty() - String replace(CharSequence,CharSequence) - boolean startsWith(String) - String substring(int,int) - char[] toCharArray() - String trim() -} - -class Math -> java.lang.Math { - double E - double PI - double abs(double) - double acos(double) - double asin(double) - double atan(double) - double atan2(double,double) - double cbrt(double) - double ceil(double) - double cos(double) - double cosh(double) - double exp(double) - double expm1(double) - double floor(double) - double hypot(double,double) - double log(double) - double log10(double) - double log1p(double) - double max(double,double) - double min(double,double) - double pow(double,double) - double random() - double rint(double) - long round(double) - double sin(double) - double sinh(double) - double sqrt(double) - double tan(double) - double tanh(double) - double toDegrees(double) - double toRadians(double) -} - -class Iterator -> java.util.Iterator extends Object { - boolean hasNext() - def next() - void remove() -} - -class Collection -> java.util.Collection extends Object { - boolean add(def) - void clear() - boolean contains(def) - boolean isEmpty() - Iterator iterator() - boolean remove(def) - int size() -} - -class List -> java.util.List extends Collection,Object { - def set(int,def) - def get(int) - def remove(int) - int getLength/size() -} - -class ArrayList -> java.util.ArrayList extends List,Collection,Object { - ArrayList () -} - -class Set -> java.util.Set extends Collection,Object { -} - -class HashSet -> java.util.HashSet extends Set,Collection,Object { - HashSet () -} - -class Map -> java.util.Map extends Object { - def put(def,def) - def get(def) - def remove(def) - boolean isEmpty() - int size() - boolean containsKey(def) - Set keySet() - Collection values() -} - -class HashMap -> java.util.HashMap extends Map,Object { - HashMap () -} - -class Exception -> java.lang.Exception extends Object { - String getMessage() -} - -class ArithmeticException -> java.lang.ArithmeticException extends Exception,Object { - ArithmeticException () -} - -class IllegalArgumentException -> java.lang.IllegalArgumentException extends Exception,Object { - IllegalArgumentException () -} - -class IllegalStateException -> java.lang.IllegalStateException extends Exception,Object { - IllegalStateException () -} - -class NumberFormatException -> java.lang.NumberFormatException extends Exception,Object { - NumberFormatException () -} - -# ES Scripting API - -class GeoPoint -> org.elasticsearch.common.geo.GeoPoint extends Object { - double getLat() - double getLon() -} - -class Strings -> org.elasticsearch.index.fielddata.ScriptDocValues$Strings extends List,Collection,Object { - String getValue() - List getValues() -} - -class Longs -> org.elasticsearch.index.fielddata.ScriptDocValues$Longs extends List,Collection,Object { - long getValue() - List getValues() -} - -class Doubles -> org.elasticsearch.index.fielddata.ScriptDocValues$Doubles extends List,Collection,Object { - double getValue() - List getValues() -} - -class GeoPoints -> org.elasticsearch.index.fielddata.ScriptDocValues$GeoPoints extends List,Collection,Object { - GeoPoint getValue() - List getValues() - double getLat() - double getLon() - double[] getLats() - double[] getLons() - - # geo distance functions... so many... - double factorDistance(double,double) - double factorDistanceWithDefault(double,double,double) - double factorDistance02(double,double) - double factorDistance13(double,double) - double arcDistance(double,double) - double arcDistanceWithDefault(double,double,double) - double arcDistanceInKm(double,double) - double arcDistanceInKmWithDefault(double,double,double) - double arcDistanceInMiles(double,double) - double arcDistanceInMilesWithDefault(double,double,double) - double distance(double,double) - double distanceWithDefault(double,double,double) - double distanceInKm(double,double) - double distanceInKmWithDefault(double,double,double) - double distanceInMiles(double,double) - double distanceInMilesWithDefault(double,double,double) - double geohashDistance(String) - double geohashDistanceInKm(String) - double geohashDistanceInMiles(String) -} - -# for testing. -# currently FeatureTest exposes overloaded constructor, field load store, and overloaded static methods -class FeatureTest -> org.elasticsearch.painless.FeatureTest extends Object { - FeatureTest () - FeatureTest (int,int) - int getX() - int getY() - void setX(int) - void setY(int) - boolean overloadedStatic() - boolean overloadedStatic(boolean) -} - -# currently needed internally -class Executable -> org.elasticsearch.painless.Executable { -} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.lang.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.lang.txt new file mode 100644 index 00000000000..01694b60db0 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.lang.txt @@ -0,0 +1,1079 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Interfaces + +class Appendable -> java.lang.Appendable { + # append(char/CharSequence): skipped. left to subclasses (e.g. StringBuilder). + Appendable append(CharSequence,int,int) +} + +# AutoCloseable: i/o + +class CharSequence -> java.lang.CharSequence { + char charAt(int) + IntStream chars() + IntStream codePoints() + int length() + CharSequence subSequence(int,int) + String toString() +} + +# Cloneable: add clone() to subclasses directly. + +class Comparable -> java.lang.Comparable { + int compareTo(def) +} + +class Iterable -> java.lang.Iterable { + void forEach(Consumer) + Iterator iterator() + Spliterator spliterator() +} + +# Readable: i/o +# Runnable: threads. +# Thread.UncaughtExceptionHandler: threads. + +#### Classes + +class Boolean -> java.lang.Boolean extends Comparable,Object { + Boolean TRUE + Boolean FALSE + boolean booleanValue() + int compare(boolean,boolean) + int hashCode(boolean) + boolean logicalAnd(boolean,boolean) + boolean logicalOr(boolean,boolean) + boolean logicalXor(boolean,boolean) + boolean parseBoolean(String) + String toString(boolean) + Boolean valueOf(boolean) +} + +class Byte -> java.lang.Byte extends Number,Comparable,Object { + int BYTES + byte MAX_VALUE + byte MIN_VALUE + int SIZE + int compare(byte,byte) + Byte decode(String) + int hashCode(byte) + byte parseByte(String) + byte parseByte(String,int) + String toString(byte) + int toUnsignedInt(byte) + long toUnsignedLong(byte) + Byte valueOf(byte) + Byte valueOf(String,int) +} + +class Character -> java.lang.Character extends Comparable,Object { + int BYTES + byte COMBINING_SPACING_MARK + byte CONNECTOR_PUNCTUATION + byte CONTROL + byte CURRENCY_SYMBOL + byte DASH_PUNCTUATION + byte DECIMAL_DIGIT_NUMBER + byte DIRECTIONALITY_ARABIC_NUMBER + byte DIRECTIONALITY_BOUNDARY_NEUTRAL + byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR + byte DIRECTIONALITY_EUROPEAN_NUMBER + byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR + byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR + byte DIRECTIONALITY_LEFT_TO_RIGHT + byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING + byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE + byte DIRECTIONALITY_NONSPACING_MARK + byte DIRECTIONALITY_OTHER_NEUTRALS + byte DIRECTIONALITY_PARAGRAPH_SEPARATOR + byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT + byte DIRECTIONALITY_RIGHT_TO_LEFT + byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC + byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING + byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE + byte DIRECTIONALITY_SEGMENT_SEPARATOR + byte DIRECTIONALITY_UNDEFINED + byte DIRECTIONALITY_WHITESPACE + byte ENCLOSING_MARK + byte END_PUNCTUATION + byte FINAL_QUOTE_PUNCTUATION + byte FORMAT + byte INITIAL_QUOTE_PUNCTUATION + byte LETTER_NUMBER + byte LINE_SEPARATOR + byte LOWERCASE_LETTER + byte MATH_SYMBOL + int MAX_CODE_POINT + char MAX_HIGH_SURROGATE + char MAX_LOW_SURROGATE + int MAX_RADIX + char MAX_SURROGATE + char MAX_VALUE + char MIN_CODE_POINT + char MIN_HIGH_SURROGATE + char MIN_LOW_SURROGATE + int MIN_RADIX + int MIN_SUPPLEMENTARY_CODE_POINT + char MIN_SURROGATE + char MIN_VALUE + byte MODIFIER_LETTER + byte MODIFIER_SYMBOL + byte NON_SPACING_MARK + byte OTHER_LETTER + byte OTHER_NUMBER + byte OTHER_PUNCTUATION + byte OTHER_SYMBOL + byte PARAGRAPH_SEPARATOR + byte PRIVATE_USE + int SIZE + byte SPACE_SEPARATOR + byte START_PUNCTUATION + byte SURROGATE + byte TITLECASE_LETTER + byte UNASSIGNED + byte UPPERCASE_LETTER + int charCount(int) + char charValue() + int codePointAt(char[],int,int) + int codePointAt(CharSequence,int) + int codePointBefore(char[],int,int) + int codePointBefore(CharSequence,int) + int codePointCount(CharSequence,int,int) + int compare(char,char) + int digit(int,int) + char forDigit(int,int) + byte getDirectionality(int) + String getName(int) + int getNumericValue(int) + int getType(int) + int hashCode(char) + char highSurrogate(int) + boolean isAlphabetic(int) + boolean isBmpCodePoint(int) + boolean isDefined(int) + boolean isDigit(int) + boolean isHighSurrogate(char) + boolean isIdentifierIgnorable(int) + boolean isIdeographic(int) + boolean isISOControl(int) + boolean isJavaIdentifierPart(int) + boolean isJavaIdentifierStart(int) + boolean isLetter(int) + boolean isLetterOrDigit(int) + boolean isLowerCase(int) + boolean isMirrored(int) + boolean isSpaceChar(int) + boolean isSupplementaryCodePoint(int) + boolean isSurrogate(char) + boolean isSurrogatePair(char,char) + boolean isTitleCase(int) + boolean isUnicodeIdentifierPart(int) + boolean isUnicodeIdentifierStart(int) + boolean isUpperCase(int) + boolean isValidCodePoint(int) + boolean isWhitespace(int) + char lowSurrogate(int) + int offsetByCodePoints(char[],int,int,int,int) + int offsetByCodePoints(CharSequence,int,int) + char reverseBytes(char) + char[] toChars(int) + int toChars(int,char[],int) + int toCodePoint(char,char) + char toLowerCase(char) + String toString(char) + char toTitleCase(char) + char toUpperCase(char) + Character valueOf(char) +} + +class Character.Subset -> java.lang.Character$Subset extends Object { +} + +class Character.UnicodeBlock -> java.lang.Character$UnicodeBlock extends Character.Subset,Object { + Character.UnicodeBlock AEGEAN_NUMBERS + Character.UnicodeBlock ALCHEMICAL_SYMBOLS + Character.UnicodeBlock ALPHABETIC_PRESENTATION_FORMS + Character.UnicodeBlock ANCIENT_GREEK_MUSICAL_NOTATION + Character.UnicodeBlock ANCIENT_GREEK_NUMBERS + Character.UnicodeBlock ANCIENT_SYMBOLS + Character.UnicodeBlock ARABIC + Character.UnicodeBlock ARABIC_EXTENDED_A + Character.UnicodeBlock ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS + Character.UnicodeBlock ARABIC_PRESENTATION_FORMS_A + Character.UnicodeBlock ARABIC_PRESENTATION_FORMS_B + Character.UnicodeBlock ARABIC_SUPPLEMENT + Character.UnicodeBlock ARMENIAN + Character.UnicodeBlock ARROWS + Character.UnicodeBlock AVESTAN + Character.UnicodeBlock BALINESE + Character.UnicodeBlock BAMUM + Character.UnicodeBlock BAMUM_SUPPLEMENT + Character.UnicodeBlock BASIC_LATIN + Character.UnicodeBlock BATAK + Character.UnicodeBlock BENGALI + Character.UnicodeBlock BLOCK_ELEMENTS + Character.UnicodeBlock BOPOMOFO + Character.UnicodeBlock BOPOMOFO_EXTENDED + Character.UnicodeBlock BOX_DRAWING + Character.UnicodeBlock BRAHMI + Character.UnicodeBlock BRAILLE_PATTERNS + Character.UnicodeBlock BUGINESE + Character.UnicodeBlock BUHID + Character.UnicodeBlock BYZANTINE_MUSICAL_SYMBOLS + Character.UnicodeBlock CARIAN + Character.UnicodeBlock CHAKMA + Character.UnicodeBlock CHAM + Character.UnicodeBlock CHEROKEE + Character.UnicodeBlock CJK_COMPATIBILITY + Character.UnicodeBlock CJK_COMPATIBILITY_FORMS + Character.UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS + Character.UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT + Character.UnicodeBlock CJK_RADICALS_SUPPLEMENT + Character.UnicodeBlock CJK_STROKES + Character.UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION + Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS + Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A + Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B + Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C + Character.UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D + Character.UnicodeBlock COMBINING_DIACRITICAL_MARKS + Character.UnicodeBlock COMBINING_DIACRITICAL_MARKS_SUPPLEMENT + Character.UnicodeBlock COMBINING_HALF_MARKS + Character.UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS + Character.UnicodeBlock COMMON_INDIC_NUMBER_FORMS + Character.UnicodeBlock CONTROL_PICTURES + Character.UnicodeBlock COPTIC + Character.UnicodeBlock COUNTING_ROD_NUMERALS + Character.UnicodeBlock CUNEIFORM + Character.UnicodeBlock CUNEIFORM_NUMBERS_AND_PUNCTUATION + Character.UnicodeBlock CURRENCY_SYMBOLS + Character.UnicodeBlock CYPRIOT_SYLLABARY + Character.UnicodeBlock CYRILLIC + Character.UnicodeBlock CYRILLIC_EXTENDED_A + Character.UnicodeBlock CYRILLIC_EXTENDED_B + Character.UnicodeBlock CYRILLIC_SUPPLEMENTARY + Character.UnicodeBlock DESERET + Character.UnicodeBlock DEVANAGARI + Character.UnicodeBlock DEVANAGARI_EXTENDED + Character.UnicodeBlock DINGBATS + Character.UnicodeBlock DOMINO_TILES + Character.UnicodeBlock EGYPTIAN_HIEROGLYPHS + Character.UnicodeBlock EMOTICONS + Character.UnicodeBlock ENCLOSED_ALPHANUMERIC_SUPPLEMENT + Character.UnicodeBlock ENCLOSED_ALPHANUMERICS + Character.UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS + Character.UnicodeBlock ENCLOSED_IDEOGRAPHIC_SUPPLEMENT + Character.UnicodeBlock ETHIOPIC + Character.UnicodeBlock ETHIOPIC_EXTENDED + Character.UnicodeBlock ETHIOPIC_EXTENDED_A + Character.UnicodeBlock ETHIOPIC_SUPPLEMENT + Character.UnicodeBlock GENERAL_PUNCTUATION + Character.UnicodeBlock GEOMETRIC_SHAPES + Character.UnicodeBlock GEORGIAN + Character.UnicodeBlock GEORGIAN_SUPPLEMENT + Character.UnicodeBlock GLAGOLITIC + Character.UnicodeBlock GOTHIC + Character.UnicodeBlock GREEK + Character.UnicodeBlock GREEK_EXTENDED + Character.UnicodeBlock GUJARATI + Character.UnicodeBlock GURMUKHI + Character.UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS + Character.UnicodeBlock HANGUL_COMPATIBILITY_JAMO + Character.UnicodeBlock HANGUL_JAMO + Character.UnicodeBlock HANGUL_JAMO_EXTENDED_A + Character.UnicodeBlock HANGUL_JAMO_EXTENDED_B + Character.UnicodeBlock HANGUL_SYLLABLES + Character.UnicodeBlock HANUNOO + Character.UnicodeBlock HEBREW + Character.UnicodeBlock HIGH_PRIVATE_USE_SURROGATES + Character.UnicodeBlock HIGH_SURROGATES + Character.UnicodeBlock HIRAGANA + Character.UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS + Character.UnicodeBlock IMPERIAL_ARAMAIC + Character.UnicodeBlock INSCRIPTIONAL_PAHLAVI + Character.UnicodeBlock INSCRIPTIONAL_PARTHIAN + Character.UnicodeBlock IPA_EXTENSIONS + Character.UnicodeBlock JAVANESE + Character.UnicodeBlock KAITHI + Character.UnicodeBlock KANA_SUPPLEMENT + Character.UnicodeBlock KANBUN + Character.UnicodeBlock KANGXI_RADICALS + Character.UnicodeBlock KANNADA + Character.UnicodeBlock KATAKANA + Character.UnicodeBlock KATAKANA_PHONETIC_EXTENSIONS + Character.UnicodeBlock KAYAH_LI + Character.UnicodeBlock KHAROSHTHI + Character.UnicodeBlock KHMER + Character.UnicodeBlock KHMER_SYMBOLS + Character.UnicodeBlock LAO + Character.UnicodeBlock LATIN_1_SUPPLEMENT + Character.UnicodeBlock LATIN_EXTENDED_A + Character.UnicodeBlock LATIN_EXTENDED_ADDITIONAL + Character.UnicodeBlock LATIN_EXTENDED_B + Character.UnicodeBlock LATIN_EXTENDED_C + Character.UnicodeBlock LATIN_EXTENDED_D + Character.UnicodeBlock LEPCHA + Character.UnicodeBlock LETTERLIKE_SYMBOLS + Character.UnicodeBlock LIMBU + Character.UnicodeBlock LINEAR_B_IDEOGRAMS + Character.UnicodeBlock LINEAR_B_SYLLABARY + Character.UnicodeBlock LISU + Character.UnicodeBlock LOW_SURROGATES + Character.UnicodeBlock LYCIAN + Character.UnicodeBlock LYDIAN + Character.UnicodeBlock MAHJONG_TILES + Character.UnicodeBlock MALAYALAM + Character.UnicodeBlock MANDAIC + Character.UnicodeBlock MATHEMATICAL_ALPHANUMERIC_SYMBOLS + Character.UnicodeBlock MATHEMATICAL_OPERATORS + Character.UnicodeBlock MEETEI_MAYEK + Character.UnicodeBlock MEETEI_MAYEK_EXTENSIONS + Character.UnicodeBlock MEROITIC_CURSIVE + Character.UnicodeBlock MEROITIC_HIEROGLYPHS + Character.UnicodeBlock MIAO + Character.UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A + Character.UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B + Character.UnicodeBlock MISCELLANEOUS_SYMBOLS + Character.UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_ARROWS + Character.UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS + Character.UnicodeBlock MISCELLANEOUS_TECHNICAL + Character.UnicodeBlock MODIFIER_TONE_LETTERS + Character.UnicodeBlock MONGOLIAN + Character.UnicodeBlock MUSICAL_SYMBOLS + Character.UnicodeBlock MYANMAR + Character.UnicodeBlock MYANMAR_EXTENDED_A + Character.UnicodeBlock NEW_TAI_LUE + Character.UnicodeBlock NKO + Character.UnicodeBlock NUMBER_FORMS + Character.UnicodeBlock OGHAM + Character.UnicodeBlock OL_CHIKI + Character.UnicodeBlock OLD_ITALIC + Character.UnicodeBlock OLD_PERSIAN + Character.UnicodeBlock OLD_SOUTH_ARABIAN + Character.UnicodeBlock OLD_TURKIC + Character.UnicodeBlock OPTICAL_CHARACTER_RECOGNITION + Character.UnicodeBlock ORIYA + Character.UnicodeBlock OSMANYA + Character.UnicodeBlock PHAGS_PA + Character.UnicodeBlock PHAISTOS_DISC + Character.UnicodeBlock PHOENICIAN + Character.UnicodeBlock PHONETIC_EXTENSIONS + Character.UnicodeBlock PHONETIC_EXTENSIONS_SUPPLEMENT + Character.UnicodeBlock PLAYING_CARDS + Character.UnicodeBlock PRIVATE_USE_AREA + Character.UnicodeBlock REJANG + Character.UnicodeBlock RUMI_NUMERAL_SYMBOLS + Character.UnicodeBlock RUNIC + Character.UnicodeBlock SAMARITAN + Character.UnicodeBlock SAURASHTRA + Character.UnicodeBlock SHARADA + Character.UnicodeBlock SHAVIAN + Character.UnicodeBlock SINHALA + Character.UnicodeBlock SMALL_FORM_VARIANTS + Character.UnicodeBlock SORA_SOMPENG + Character.UnicodeBlock SPACING_MODIFIER_LETTERS + Character.UnicodeBlock SPECIALS + Character.UnicodeBlock SUNDANESE + Character.UnicodeBlock SUNDANESE_SUPPLEMENT + Character.UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS + Character.UnicodeBlock SUPPLEMENTAL_ARROWS_A + Character.UnicodeBlock SUPPLEMENTAL_ARROWS_B + Character.UnicodeBlock SUPPLEMENTAL_MATHEMATICAL_OPERATORS + Character.UnicodeBlock SUPPLEMENTAL_PUNCTUATION + Character.UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_A + Character.UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_B + Character.UnicodeBlock SYLOTI_NAGRI + Character.UnicodeBlock SYRIAC + Character.UnicodeBlock TAGALOG + Character.UnicodeBlock TAGBANWA + Character.UnicodeBlock TAGS + Character.UnicodeBlock TAI_LE + Character.UnicodeBlock TAI_THAM + Character.UnicodeBlock TAI_VIET + Character.UnicodeBlock TAI_XUAN_JING_SYMBOLS + Character.UnicodeBlock TAKRI + Character.UnicodeBlock TAMIL + Character.UnicodeBlock TELUGU + Character.UnicodeBlock THAANA + Character.UnicodeBlock THAI + Character.UnicodeBlock TIBETAN + Character.UnicodeBlock TIFINAGH + Character.UnicodeBlock TRANSPORT_AND_MAP_SYMBOLS + Character.UnicodeBlock UGARITIC + Character.UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS + Character.UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED + Character.UnicodeBlock VAI + Character.UnicodeBlock VARIATION_SELECTORS + Character.UnicodeBlock VARIATION_SELECTORS_SUPPLEMENT + Character.UnicodeBlock VEDIC_EXTENSIONS + Character.UnicodeBlock VERTICAL_FORMS + Character.UnicodeBlock YI_RADICALS + Character.UnicodeBlock YI_SYLLABLES + Character.UnicodeBlock YIJING_HEXAGRAM_SYMBOLS + Character.UnicodeBlock forName(String) + Character.UnicodeBlock of(int) +} + +# Class: skipped for obvious reasons +# ClassLoader: ... +# ClassValue: ... +# Compiler: ... + +class Double -> java.lang.Double extends Number,Comparable,Object { + int BYTES + int MAX_EXPONENT + double MAX_VALUE + int MIN_EXPONENT + double MIN_NORMAL + double MIN_VALUE + double NaN + double NEGATIVE_INFINITY + double POSITIVE_INFINITY + int SIZE + int compare(double,double) + long doubleToLongBits(double) + long doubleToRawLongBits(double) + int hashCode(double) + boolean isFinite(double) + boolean isInfinite() + boolean isInfinite(double) + boolean isNaN() + boolean isNaN(double) + double longBitsToDouble(long) + double max(double,double) + double min(double,double) + double parseDouble(String) + double sum(double,double) + String toHexString(double) + String toString(double) + Double valueOf(double) +} + +class Enum -> java.lang.Enum extends Comparable,Object { + String name(); + int ordinal(); +} + +class Float -> java.lang.Float extends Number,Comparable,Object { + int BYTES + int MAX_EXPONENT + float MAX_VALUE + int MIN_EXPONENT + float MIN_NORMAL + float MIN_VALUE + float NaN + float NEGATIVE_INFINITY + float POSITIVE_INFINITY + int SIZE + int compare(float,float) + int floatToIntBits(float) + int floatToRawIntBits(float) + int hashCode(float) + float intBitsToFloat(int) + boolean isFinite(float) + boolean isInfinite() + boolean isInfinite(float) + boolean isNaN() + boolean isNaN(float) + float max(float,float) + float min(float,float) + float parseFloat(String) + float sum(float,float) + String toHexString(float) + String toString(float) + Float valueOf(float) +} + +# InheritableThreadLocal: threads + +class Integer -> java.lang.Integer extends Number,Comparable,Object { + int BYTES + int MAX_VALUE + int MIN_VALUE + int SIZE + int bitCount(int) + int compare(int,int) + int compareUnsigned(int,int) + Integer decode(String) + int divideUnsigned(int,int) + int hashCode(int) + int highestOneBit(int) + int lowestOneBit(int) + int max(int,int) + int min(int,int) + int numberOfLeadingZeros(int) + int numberOfTrailingZeros(int) + int parseInt(String) + int parseInt(String,int) + int parseUnsignedInt(String) + int parseUnsignedInt(String,int) + int remainderUnsigned(int,int) + int reverse(int) + int reverseBytes(int) + int rotateLeft(int,int) + int rotateRight(int,int) + int signum(int) + String toBinaryString(int) + String toHexString(int) + String toOctalString(int) + String toString(int) + String toString(int,int) + long toUnsignedLong(int) + String toUnsignedString(int) + String toUnsignedString(int,int) + Integer valueOf(int) + Integer valueOf(String,int) +} + +class Long -> java.lang.Long extends Number,Comparable,Object { + int BYTES + long MAX_VALUE + long MIN_VALUE + int SIZE + int bitCount(long) + int compare(long,long) + int compareUnsigned(long,long) + Long decode(String) + long divideUnsigned(long,long) + int hashCode(long) + long highestOneBit(long) + long lowestOneBit(long) + long max(long,long) + long min(long,long) + int numberOfLeadingZeros(long) + int numberOfTrailingZeros(long) + long parseLong(String) + long parseLong(String,int) + long parseUnsignedLong(String) + long parseUnsignedLong(String,int) + long remainderUnsigned(long,long) + long reverse(long) + long reverseBytes(long) + long rotateLeft(long,int) + long rotateRight(long,int) + int signum(long) + long sum(long,long) + String toBinaryString(long) + String toHexString(long) + String toOctalString(long) + String toString(long) + String toString(long,int) + String toUnsignedString(long) + String toUnsignedString(long,int) + Long valueOf(long) + Long valueOf(String,int) +} + +class Math -> java.lang.Math { + double E + double PI + double abs(double) + double acos(double) + double asin(double) + double atan(double) + double atan2(double,double) + double cbrt(double) + double ceil(double) + double copySign(double,double) + double cos(double) + double cosh(double) + double exp(double) + double expm1(double) + double floor(double) + double hypot(double,double) + double IEEEremainder(double,double) + double log(double) + double log10(double) + double log1p(double) + double max(double,double) + double min(double,double) + double nextAfter(double,double) + double nextDown(double) + double nextUp(double) + double pow(double,double) + double random() + double rint(double) + long round(double) + double scalb(double,int) + double signum(double) + double sin(double) + double sinh(double) + double sqrt(double) + double tan(double) + double tanh(double) + double toDegrees(double) + double toRadians(double) + double ulp(double) +} + +class Number -> java.lang.Number extends Object { + byte byteValue() + short shortValue() + int intValue() + long longValue() + float floatValue() + double doubleValue() +} + +class Object -> java.lang.Object { + boolean equals(Object) + int hashCode() + String toString() +} + +# Package: skipped +# Process: skipped +# ProcessBuilder: skipped +# ProcessBuilder.Redirect: skipped +# Runtime: skipped +# RuntimePermission: skipped +# SecurityManger: skipped + +class Short -> java.lang.Short extends Number,Comparable,Object { + int BYTES + short MAX_VALUE + short MIN_VALUE + int SIZE + int compare(short,short) + Short decode(String) + int hashCode(short) + short parseShort(String) + short parseShort(String,int) + short reverseBytes(short) + String toString(short) + int toUnsignedInt(short) + long toUnsignedLong(short) + Short valueOf(short) + Short valueOf(String,int) +} + +class StackTraceElement -> java.lang.StackTraceElement extends Object { + StackTraceElement (String,String,String,int) + String getClassName() + String getFileName() + int getLineNumber() + String getMethodName() + boolean isNativeMethod() +} + +class StrictMath -> java.lang.StrictMath { + double E + double PI + double abs(double) + double acos(double) + double asin(double) + double atan(double) + double atan2(double,double) + double cbrt(double) + double ceil(double) + double copySign(double,double) + double cos(double) + double cosh(double) + double exp(double) + double expm1(double) + double floor(double) + double hypot(double,double) + double IEEEremainder(double,double) + double log(double) + double log10(double) + double log1p(double) + double max(double,double) + double min(double,double) + double nextAfter(double,double) + double nextDown(double) + double nextUp(double) + double pow(double,double) + double random() + double rint(double) + long round(double) + double scalb(double,int) + double signum(double) + double sin(double) + double sinh(double) + double sqrt(double) + double tan(double) + double tanh(double) + double toDegrees(double) + double toRadians(double) + double ulp(double) +} + +class String -> java.lang.String extends CharSequence,Comparable,Object { + String () + int codePointAt(int) + int codePointBefore(int) + int codePointCount(int,int) + int compareToIgnoreCase(String) + String concat(String) + boolean contains(CharSequence) + boolean contentEquals(CharSequence) + String copyValueOf(char[]) + String copyValueOf(char[],int,int) + boolean endsWith(String) + boolean equalsIgnoreCase(String) + String format(Locale,String,def[]) + String format(String,def[]) + void getChars(int,int,char[],int) + int indexOf(String) + int indexOf(String,int) + boolean isEmpty() + String join(CharSequence,Iterable) + int lastIndexOf(String) + int lastIndexOf(String,int) + int offsetByCodePoints(int,int) + boolean regionMatches(boolean,int,String,int,int) + boolean regionMatches(int,String,int,int) + String replace(CharSequence,CharSequence) + boolean startsWith(String) + boolean startsWith(String,int) + String substring(int) + String substring(int,int) + char[] toCharArray() + String toLowerCase() + String toLowerCase(Locale) + String toUpperCase() + String toUpperCase(Locale) + String trim() + String valueOf(def) +} + +class StringBuffer -> java.lang.StringBuffer extends CharSequence,Appendable,Object { + StringBuffer () + StringBuffer (CharSequence) + StringBuffer append(def) + StringBuffer append(CharSequence,int,int) + StringBuffer appendCodePoint(int) + int capacity() + int codePointAt(int) + int codePointBefore(int) + int codePointCount(int,int) + StringBuffer delete(int,int) + StringBuffer deleteCharAt(int) + void getChars(int,int,char[],int) + int indexOf(String) + int indexOf(String,int) + StringBuffer insert(int,def) + int lastIndexOf(String) + int lastIndexOf(String,int) + int offsetByCodePoints(int,int) + StringBuffer replace(int,int,String) + StringBuffer reverse() + void setCharAt(int,char) + void setLength(int) + String substring(int) + String substring(int,int) +} + +class StringBuilder -> java.lang.StringBuilder extends CharSequence,Appendable,Object { + StringBuilder () + StringBuilder (CharSequence) + StringBuilder append(def) + StringBuilder append(CharSequence,int,int) + StringBuilder appendCodePoint(int) + int capacity() + int codePointAt(int) + int codePointBefore(int) + int codePointCount(int,int) + StringBuilder delete(int,int) + StringBuilder deleteCharAt(int) + void getChars(int,int,char[],int) + int indexOf(String) + int indexOf(String,int) + StringBuilder insert(int,def) + int lastIndexOf(String) + int lastIndexOf(String,int) + int offsetByCodePoints(int,int) + StringBuilder replace(int,int,String) + StringBuilder reverse() + void setCharAt(int,char) + void setLength(int) + String substring(int) + String substring(int,int) +} + +class System -> java.lang.System extends Object { + void arraycopy(Object,int,Object,int,int) + long currentTimeMillis() + long nanoTime() +} + +# Thread: skipped +# ThreadGroup: skipped +# ThreadLocal: skipped +# Throwable: skipped (reserved for painless, users can only catch Exceptions) + +class Void -> java.lang.Void extends Object { +} + +#### Enums + +class Character.UnicodeScript -> java.lang.Character$UnicodeScript extends Enum,Object { + Character.UnicodeScript ARABIC + Character.UnicodeScript ARMENIAN + Character.UnicodeScript AVESTAN + Character.UnicodeScript BALINESE + Character.UnicodeScript BAMUM + Character.UnicodeScript BATAK + Character.UnicodeScript BENGALI + Character.UnicodeScript BOPOMOFO + Character.UnicodeScript BRAHMI + Character.UnicodeScript BRAILLE + Character.UnicodeScript BUGINESE + Character.UnicodeScript BUHID + Character.UnicodeScript CANADIAN_ABORIGINAL + Character.UnicodeScript CARIAN + Character.UnicodeScript CHAKMA + Character.UnicodeScript CHAM + Character.UnicodeScript CHEROKEE + Character.UnicodeScript COMMON + Character.UnicodeScript COPTIC + Character.UnicodeScript CUNEIFORM + Character.UnicodeScript CYPRIOT + Character.UnicodeScript CYRILLIC + Character.UnicodeScript DESERET + Character.UnicodeScript DEVANAGARI + Character.UnicodeScript EGYPTIAN_HIEROGLYPHS + Character.UnicodeScript ETHIOPIC + Character.UnicodeScript GEORGIAN + Character.UnicodeScript GLAGOLITIC + Character.UnicodeScript GOTHIC + Character.UnicodeScript GREEK + Character.UnicodeScript GUJARATI + Character.UnicodeScript GURMUKHI + Character.UnicodeScript HAN + Character.UnicodeScript HANGUL + Character.UnicodeScript HANUNOO + Character.UnicodeScript HEBREW + Character.UnicodeScript HIRAGANA + Character.UnicodeScript IMPERIAL_ARAMAIC + Character.UnicodeScript INHERITED + Character.UnicodeScript INSCRIPTIONAL_PAHLAVI + Character.UnicodeScript INSCRIPTIONAL_PARTHIAN + Character.UnicodeScript JAVANESE + Character.UnicodeScript KAITHI + Character.UnicodeScript KANNADA + Character.UnicodeScript KATAKANA + Character.UnicodeScript KAYAH_LI + Character.UnicodeScript KHAROSHTHI + Character.UnicodeScript KHMER + Character.UnicodeScript LAO + Character.UnicodeScript LATIN + Character.UnicodeScript LEPCHA + Character.UnicodeScript LIMBU + Character.UnicodeScript LINEAR_B + Character.UnicodeScript LISU + Character.UnicodeScript LYCIAN + Character.UnicodeScript LYDIAN + Character.UnicodeScript MALAYALAM + Character.UnicodeScript MANDAIC + Character.UnicodeScript MEETEI_MAYEK + Character.UnicodeScript MEROITIC_CURSIVE + Character.UnicodeScript MEROITIC_HIEROGLYPHS + Character.UnicodeScript MIAO + Character.UnicodeScript MONGOLIAN + Character.UnicodeScript MYANMAR + Character.UnicodeScript NEW_TAI_LUE + Character.UnicodeScript NKO + Character.UnicodeScript OGHAM + Character.UnicodeScript OL_CHIKI + Character.UnicodeScript OLD_ITALIC + Character.UnicodeScript OLD_PERSIAN + Character.UnicodeScript OLD_SOUTH_ARABIAN + Character.UnicodeScript OLD_TURKIC + Character.UnicodeScript ORIYA + Character.UnicodeScript OSMANYA + Character.UnicodeScript PHAGS_PA + Character.UnicodeScript PHOENICIAN + Character.UnicodeScript REJANG + Character.UnicodeScript RUNIC + Character.UnicodeScript SAMARITAN + Character.UnicodeScript SAURASHTRA + Character.UnicodeScript SHARADA + Character.UnicodeScript SHAVIAN + Character.UnicodeScript SINHALA + Character.UnicodeScript SORA_SOMPENG + Character.UnicodeScript SUNDANESE + Character.UnicodeScript SYLOTI_NAGRI + Character.UnicodeScript SYRIAC + Character.UnicodeScript TAGALOG + Character.UnicodeScript TAGBANWA + Character.UnicodeScript TAI_LE + Character.UnicodeScript TAI_THAM + Character.UnicodeScript TAI_VIET + Character.UnicodeScript TAKRI + Character.UnicodeScript TAMIL + Character.UnicodeScript TELUGU + Character.UnicodeScript THAANA + Character.UnicodeScript THAI + Character.UnicodeScript TIBETAN + Character.UnicodeScript TIFINAGH + Character.UnicodeScript UGARITIC + Character.UnicodeScript UNKNOWN + Character.UnicodeScript VAI + Character.UnicodeScript YI + Character.UnicodeScript forName(String) + Character.UnicodeScript of(int) + Character.UnicodeScript valueOf(String) + Character.UnicodeScript[] values() +} + +#### Exceptions + +class ArithmeticException -> java.lang.ArithmeticException extends RuntimeException,Exception,Object { + ArithmeticException () + ArithmeticException (String) +} + +class ArrayIndexOutOfBoundsException -> java.lang.ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException,RuntimeException,Exception,Object { + ArrayIndexOutOfBoundsException () + ArrayIndexOutOfBoundsException (String) +} + +class ArrayStoreException -> java.lang.ArrayStoreException extends RuntimeException,Exception,Object { + ArrayStoreException () + ArrayStoreException (String) +} + +class ClassCastException -> java.lang.ClassCastException extends RuntimeException,Exception,Object { + ClassCastException () + ClassCastException (String) +} + +class ClassNotFoundException -> java.lang.ClassNotFoundException extends ReflectiveOperationException,Exception,Object { + ClassNotFoundException () + ClassNotFoundException (String) +} + +class CloneNotSupportedException -> java.lang.CloneNotSupportedException extends Exception,Object { + CloneNotSupportedException () + CloneNotSupportedException (String) +} + +class EnumConstantNotPresentException -> java.lang.EnumConstantNotPresentException extends RuntimeException,Exception,Object { + String constantName() +} + +class Exception -> java.lang.Exception extends Object { + Exception () + Exception (String) + String getLocalizedMessage() + String getMessage() + StackTraceElement[] getStackTrace() +} + +class IllegalAccessException -> java.lang.IllegalAccessException extends ReflectiveOperationException,Exception,Object { + IllegalAccessException () + IllegalAccessException (String) +} + +class IllegalArgumentException -> java.lang.IllegalArgumentException extends RuntimeException,Exception,Object { + IllegalArgumentException () + IllegalArgumentException (String) +} + +class IllegalMonitorStateException -> java.lang.IllegalMonitorStateException extends RuntimeException,Exception,Object { + IllegalMonitorStateException () + IllegalMonitorStateException (String) +} + +class IllegalStateException -> java.lang.IllegalStateException extends RuntimeException,Exception,Object { + IllegalStateException () + IllegalStateException (String) +} + +class IllegalThreadStateException -> java.lang.IllegalThreadStateException extends IllegalArgumentException,RuntimeException,Exception,Object { + IllegalThreadStateException () + IllegalThreadStateException (String) +} + +class IndexOutOfBoundsException -> java.lang.IndexOutOfBoundsException extends RuntimeException,Exception,Object { + IndexOutOfBoundsException () + IndexOutOfBoundsException (String) +} + +class InstantiationException -> java.lang.InstantiationException extends ReflectiveOperationException,Exception,Object { + InstantiationException () + InstantiationException (String) +} + +class InterruptedException -> java.lang.InterruptedException extends Exception,Object { + InterruptedException () + InterruptedException (String) +} + +class NegativeArraySizeException -> java.lang.NegativeArraySizeException extends RuntimeException,Exception,Object { + NegativeArraySizeException () + NegativeArraySizeException (String) +} + +class NoSuchFieldException -> java.lang.NoSuchFieldException extends ReflectiveOperationException,Exception,Object { + NoSuchFieldException () + NoSuchFieldException (String) +} + +class NoSuchMethodException -> java.lang.NoSuchMethodException extends ReflectiveOperationException,Exception,Object { + NoSuchMethodException () + NoSuchMethodException (String) +} + +class NullPointerException -> java.lang.NullPointerException extends RuntimeException,Exception,Object { + NullPointerException () + NullPointerException (String) +} + +class NumberFormatException -> java.lang.NumberFormatException extends RuntimeException,Exception,Object { + NumberFormatException () + NumberFormatException (String) +} + +class ReflectiveOperationException -> java.lang.ReflectiveOperationException extends Exception,Object { + ReflectiveOperationException () + ReflectiveOperationException (String) +} + +class RuntimeException -> java.lang.RuntimeException extends Exception,Object { + RuntimeException () +} + +class SecurityException -> java.lang.SecurityException extends RuntimeException,Exception,Object { + SecurityException () + SecurityException (String) +} + +class StringIndexOutOfBoundsException -> java.lang.StringIndexOutOfBoundsException extends IndexOutOfBoundsException,RuntimeException,Exception,Object { + StringIndexOutOfBoundsException () + StringIndexOutOfBoundsException (String) +} + +class TypeNotPresentException -> java.lang.TypeNotPresentException extends RuntimeException,Exception,Object { + String typeName() +} + +class UnsupportedOperationException -> java.lang.UnsupportedOperationException extends RuntimeException,Exception,Object { + UnsupportedOperationException () + UnsupportedOperationException (String) +} + diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.math.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.math.txt new file mode 100644 index 00000000000..42680f8a428 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.math.txt @@ -0,0 +1,149 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Classes + +class BigDecimal -> java.math.BigDecimal extends Number,Comparable,Object { + BigDecimal ONE + BigDecimal TEN + BigDecimal ZERO + BigDecimal (String) + BigDecimal (String,MathContext) + BigDecimal abs() + BigDecimal abs(MathContext) + BigDecimal add(BigDecimal) + BigDecimal add(BigDecimal,MathContext) + byte byteValueExact() + BigDecimal divide(BigDecimal) + BigDecimal divide(BigDecimal,MathContext) + BigDecimal[] divideAndRemainder(BigDecimal) + BigDecimal[] divideAndRemainder(BigDecimal,MathContext) + BigDecimal divideToIntegralValue(BigDecimal) + BigDecimal divideToIntegralValue(BigDecimal,MathContext) + int intValueExact() + long longValueExact() + BigDecimal max(BigDecimal) + BigDecimal min(BigDecimal) + BigDecimal movePointLeft(int) + BigDecimal movePointRight(int) + BigDecimal multiply(BigDecimal) + BigDecimal multiply(BigDecimal,MathContext) + BigDecimal negate() + BigDecimal negate(MathContext) + BigDecimal plus() + BigDecimal plus(MathContext) + BigDecimal pow(int) + BigDecimal pow(int,MathContext) + int precision() + BigDecimal remainder(BigDecimal) + BigDecimal remainder(BigDecimal,MathContext) + BigDecimal round(MathContext) + int scale() + BigDecimal scaleByPowerOfTen(int) + BigDecimal setScale(int) + BigDecimal setScale(int,RoundingMode) + short shortValueExact() + int signum() + BigDecimal stripTrailingZeros() + BigDecimal subtract(BigDecimal) + BigDecimal subtract(BigDecimal,MathContext) + BigInteger toBigInteger() + BigInteger toBigIntegerExact() + String toEngineeringString() + String toPlainString() + BigDecimal ulp() + BigDecimal valueOf(double) +} + +class BigInteger -> java.math.BigInteger extends Number,Comparable,Object { + BigInteger ONE + BigInteger TEN + BigInteger ZERO + BigInteger (String) + BigInteger (String,int) + BigInteger abs() + BigInteger add(BigInteger) + BigInteger and(BigInteger) + BigInteger andNot(BigInteger) + int bitCount() + int bitLength() + byte byteValueExact() + BigInteger clearBit(int) + BigInteger divide(BigInteger) + BigInteger[] divideAndRemainder(BigInteger) + BigInteger flipBit(int) + BigInteger gcd(BigInteger) + int getLowestSetBit() + int intValueExact() + long longValueExact() + BigInteger max(BigInteger) + BigInteger min(BigInteger) + BigInteger mod(BigInteger) + BigInteger modInverse(BigInteger) + BigInteger modPow(BigInteger,BigInteger) + BigInteger multiply(BigInteger) + BigInteger negate() + BigInteger not() + BigInteger or(BigInteger) + BigInteger pow(int) + BigInteger remainder(BigInteger) + BigInteger setBit(int) + BigInteger shiftLeft(int) + BigInteger shiftRight(int) + short shortValueExact() + int signum() + BigInteger subtract(BigInteger) + boolean testBit(int) + byte[] toByteArray() + String toString(int) + BigInteger valueOf(long) + BigInteger xor(BigInteger) +} + +class MathContext -> java.math.MathContext extends Object { + MathContext DECIMAL128 + MathContext DECIMAL32 + MathContext DECIMAL64 + MathContext UNLIMITED + MathContext (int) + MathContext (int,RoundingMode) + int getPrecision() + RoundingMode getRoundingMode() +} + +#### Enums + +class RoundingMode -> java.math.RoundingMode extends Enum,Object { + RoundingMode CEILING + RoundingMode DOWN + RoundingMode FLOOR + RoundingMode HALF_DOWN + RoundingMode HALF_EVEN + RoundingMode HALF_UP + RoundingMode UNNECESSARY + RoundingMode UP + RoundingMode valueOf(String) + RoundingMode[] values() +} + diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.text.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.text.txt new file mode 100644 index 00000000000..eac725cfb94 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.text.txt @@ -0,0 +1,486 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Interfaces + +class AttributedCharacterIterator -> java.text.AttributedCharacterIterator extends CharacterIterator { + Set getAllAttributeKeys() + def getAttribute(AttributedCharacterIterator.Attribute) + Map getAttributes() + int getRunLimit() + int getRunLimit(Set) + int getRunStart() + int getRunStart(Set) +} + +class CharacterIterator -> java.text.CharacterIterator { + char DONE + def clone() + char current() + char first() + int getBeginIndex() + int getEndIndex() + int getIndex() + char last() + char next() + char previous() + char setIndex(int) +} + +#### Classes + +class Annotation -> java.text.Annotation extends Object { + Annotation (Object) + def getValue() +} + +class AttributedCharacterIterator.Attribute -> java.text.AttributedCharacterIterator$Attribute extends Object { + AttributedCharacterIterator.Attribute INPUT_METHOD_SEGMENT + AttributedCharacterIterator.Attribute LANGUAGE + AttributedCharacterIterator.Attribute READING +} + +class AttributedString -> java.text.AttributedString extends Object { + AttributedString (String) + AttributedString (String,Map) + void addAttribute(AttributedCharacterIterator.Attribute,Object) + void addAttribute(AttributedCharacterIterator.Attribute,Object,int,int) + void addAttributes(Map,int,int) + AttributedCharacterIterator getIterator() + AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[]) + AttributedCharacterIterator getIterator(AttributedCharacterIterator.Attribute[],int,int) +} + +class Bidi -> java.text.Bidi extends Object { + int DIRECTION_DEFAULT_LEFT_TO_RIGHT + int DIRECTION_DEFAULT_RIGHT_TO_LEFT + int DIRECTION_LEFT_TO_RIGHT + int DIRECTION_RIGHT_TO_LEFT + Bidi (AttributedCharacterIterator) + Bidi (char[],int,byte[],int,int,int) + Bidi (String,int) + boolean baseIsLeftToRight() + Bidi createLineBidi(int,int) + int getBaseLevel() + int getLength() + int getLevelAt(int) + int getRunCount() + int getRunLevel(int) + int getRunLimit(int) + int getRunStart(int) + boolean isLeftToRight() + boolean isMixed() + boolean isRightToLeft() + void reorderVisually(byte[],int,Object[],int,int) + boolean requiresBidi(char[],int,int) +} + +class BreakIterator -> java.text.BreakIterator extend Object { + int DONE + def clone() + int current() + int first() + int following(int) + Locale[] getAvailableLocales() + BreakIterator getCharacterInstance() + BreakIterator getCharacterInstance(Locale) + BreakIterator getLineInstance() + BreakIterator getLineInstance(Locale) + BreakIterator getSentenceInstance() + BreakIterator getSentenceInstance(Locale) + CharacterIterator getText() + BreakIterator getWordInstance() + BreakIterator getWordInstance(Locale) + boolean isBoundary(int) + int last() + int next() + int next(int) + int preceding(int) + int previous() + void setText(String) +} + +class ChoiceFormat -> java.text.ChoiceFormat extends NumberFormat,Format,Object { + ChoiceFormat (double[],String[]) + ChoiceFormat (String) + void applyPattern(String) + def[] getFormats() + double[] getLimits() + double nextDouble(double) + double nextDouble(double,boolean) + double previousDouble(double) + void setChoices(double[],String[]) + String toPattern() +} + +class CollationElementIterator -> java.text.CollationElementIterator extends Object { + int NULLORDER + int getMaxExpansion(int) + int getOffset() + int next() + int previous() + int primaryOrder(int) + void reset() + short secondaryOrder(int) + void setOffset(int) + void setText(String) + short tertiaryOrder(int) +} + +class CollationKey -> java.text.CollationKey extends Comparable,Object { + String getSourceString() + byte[] toByteArray() +} + +class Collator -> java.text.Collator extends Comparator,Object { + int CANONICAL_DECOMPOSITION + int FULL_DECOMPOSITION + int IDENTICAL + int NO_DECOMPOSITION + int PRIMARY + int SECONDARY + int TERTIARY + def clone() + boolean equals(String,String) + Locale[] getAvailableLocales() + CollationKey getCollationKey(String) + int getDecomposition() + Collator getInstance() + Collator getInstance(Locale) + int getStrength() + void setDecomposition(int) + void setStrength(int) +} + +class DateFormat -> java.text.DateFormat extends Format,Object { + int AM_PM_FIELD + int DATE_FIELD + int DAY_OF_WEEK_FIELD + int DAY_OF_WEEK_IN_MONTH_FIELD + int DAY_OF_YEAR_FIELD + int DEFAULT + int ERA_FIELD + int FULL + int HOUR_OF_DAY0_FIELD + int HOUR_OF_DAY1_FIELD + int HOUR0_FIELD + int HOUR1_FIELD + int LONG + int MEDIUM + int MILLISECOND_FIELD + int MINUTE_FIELD + int MONTH_FIELD + int SECOND_FIELD + int SHORT + int TIMEZONE_FIELD + int WEEK_OF_MONTH_FIELD + int WEEK_OF_YEAR_FIELD + int YEAR_FIELD + Locale[] getAvailableLocales() + Calendar getCalendar() + DateFormat getDateInstance() + DateFormat getDateInstance(int) + DateFormat getDateInstance(int,Locale) + DateFormat getDateTimeInstance() + DateFormat getDateTimeInstance(int,int) + DateFormat getDateTimeInstance(int,int,Locale) + DateFormat getInstance() + NumberFormat getNumberFormat() + DateFormat getTimeInstance() + DateFormat getTimeInstance(int) + DateFormat getTimeInstance(int,Locale) + TimeZone getTimeZone() + boolean isLenient() + Date parse(String) + Date parse(String,ParsePosition) + void setCalendar(Calendar) + void setLenient(boolean) + void setNumberFormat(NumberFormat) + void setTimeZone(TimeZone) +} + +class DateFormat.Field -> java.text.DateFormat$Field extends Format.Field,AttributedCharacterIterator.Attribute,Object { + DateFormat.Field AM_PM + DateFormat.Field DAY_OF_MONTH + DateFormat.Field DAY_OF_WEEK + DateFormat.Field DAY_OF_WEEK_IN_MONTH + DateFormat.Field DAY_OF_YEAR + DateFormat.Field ERA + DateFormat.Field HOUR_OF_DAY0 + DateFormat.Field HOUR_OF_DAY1 + DateFormat.Field HOUR0 + DateFormat.Field HOUR1 + DateFormat.Field MILLISECOND + DateFormat.Field MINUTE + DateFormat.Field MONTH + DateFormat.Field SECOND + DateFormat.Field TIME_ZONE + DateFormat.Field WEEK_OF_MONTH + DateFormat.Field WEEK_OF_YEAR + DateFormat.Field YEAR + int getCalendarField() + DateFormat.Field ofCalendarField(int) +} + +class DateFormatSymbols -> java.text.DateFormatSymbols extends Object { + DateFormatSymbols () + DateFormatSymbols (Locale) + def clone() + String[] getAmPmStrings() + Locale[] getAvailableLocales() + String[] getEras() + DateFormatSymbols getInstance() + DateFormatSymbols getInstance(Locale) + String getLocalPatternChars() + String[] getMonths() + String[] getShortMonths() + String[] getShortWeekdays() + String[] getWeekdays() + String[][] getZoneStrings() + int hashCode() + void setAmPmStrings(String[]) + void setEras(String[]) + void setLocalPatternChars(String) + void setMonths(String[]) + void setShortMonths(String[]) + void setShortWeekdays(String[]) + void setWeekdays(String[]) + void setZoneStrings(String[][]) +} + +class DecimalFormat -> java.text.DecimalFormat extends NumberFormat,Format,Object { + DecimalFormat () + DecimalFormat (String) + DecimalFormat (String,DecimalFormatSymbols) + void applyLocalizedPattern(String) + void applyPattern(String) + DecimalFormatSymbols getDecimalFormatSymbols() + int getGroupingSize() + int getMultiplier() + String getNegativePrefix() + String getNegativeSuffix() + String getPositivePrefix() + String getPositiveSuffix() + boolean isDecimalSeparatorAlwaysShown() + boolean isParseBigDecimal() + void setDecimalFormatSymbols(DecimalFormatSymbols) + void setDecimalSeparatorAlwaysShown(boolean) + void setGroupingSize(int) + void setMultiplier(int) + void setNegativePrefix(String) + void setNegativeSuffix(String) + void setPositivePrefix(String) + void setPositiveSuffix(String) + void setParseBigDecimal(boolean) + String toLocalizedPattern() + String toPattern() +} + +class DecimalFormatSymbols -> java.text.DecimalFormatSymbols extends Object { + DecimalFormatSymbols () + DecimalFormatSymbols (Locale) + def clone() + Locale[] getAvailableLocales() + Currency getCurrency() + String getCurrencySymbol() + char getDecimalSeparator() + char getDigit() + String getExponentSeparator() + char getGroupingSeparator() + String getInfinity() + DecimalFormatSymbols getInstance() + DecimalFormatSymbols getInstance(Locale) + String getInternationalCurrencySymbol() + char getMinusSign() + char getMonetaryDecimalSeparator() + String getNaN() + char getPatternSeparator() + char getPercent() + char getPerMill() + char getZeroDigit() + void setCurrency(Currency) + void setCurrencySymbol(String) + void setDecimalSeparator(char) + void setDigit(char) + void setExponentSeparator(String) + void setGroupingSeparator(char) + void setInfinity(String) + void setInternationalCurrencySymbol(String) + void setMinusSign(char) + void setMonetaryDecimalSeparator(char) + void setNaN(String) + void setPatternSeparator(char) + void setPercent(char) + void setPerMill(char) + void setZeroDigit(char) +} + +class FieldPosition -> java.text.FieldPosition extends Object { + FieldPosition (int) + FieldPosition (Format.Field,int) + int getBeginIndex() + int getEndIndex() + int getField() + Format.Field getFieldAttribute() + void setBeginIndex(int) + void setEndIndex(int) +} + +class Format -> java.text.Format extends Object { + def clone() + String format(Object) + StringBuffer format(Object,StringBuffer,FieldPosition) + AttributedCharacterIterator formatToCharacterIterator(Object) + Object parseObject(String) + Object parseObject(String,ParsePosition) +} + +class Format.Field -> java.text.Format$Field extends AttributedCharacterIterator.Attribute,Object { +} + +class MessageFormat -> java.text.MessageFormat extends Format,Object { + void applyPattern(String) + String format(String,Object[]) + Format[] getFormats() + Format[] getFormatsByArgumentIndex() + Locale getLocale() + Object[] parse(String) + Object[] parse(String,ParsePosition) + void setFormat(int,Format) + void setFormatByArgumentIndex(int,Format) + void setFormats(Format[]) + void setFormatsByArgumentIndex(Format[]) + void setLocale(Locale) + String toPattern() +} + +class MessageFormat.Field -> java.text.MessageFormat$Field extends Format.Field,AttributedCharacterIterator.Attribute,Object { + MessageFormat.Field ARGUMENT +} + +class Normalizer -> java.text.Normalizer extends Object { + boolean isNormalized(CharSequence,Normalizer.Form) + String normalize(CharSequence,Normalizer.Form) +} + +class NumberFormat -> java.text.NumberFormat extends Format,Object { + int FRACTION_FIELD + int INTEGER_FIELD + Locale[] getAvailableLocales() + Currency getCurrency() + NumberFormat getCurrencyInstance() + NumberFormat getCurrencyInstance(Locale) + NumberFormat getInstance() + NumberFormat getInstance(Locale) + NumberFormat getIntegerInstance() + NumberFormat getIntegerInstance(Locale) + int getMaximumFractionDigits() + int getMaximumIntegerDigits() + int getMinimumFractionDigits() + int getMinimumIntegerDigits() + NumberFormat getNumberInstance() + NumberFormat getNumberInstance(Locale) + NumberFormat getPercentInstance() + NumberFormat getPercentInstance(Locale) + RoundingMode getRoundingMode() + boolean isGroupingUsed() + boolean isParseIntegerOnly() + Number parse(String) + Number parse(String,ParsePosition) + void setCurrency(Currency) + void setGroupingUsed(boolean) + void setMaximumFractionDigits(int) + void setMaximumIntegerDigits(int) + void setMinimumFractionDigits(int) + void setMinimumIntegerDigits(int) + void setParseIntegerOnly(boolean) + void setRoundingMode(RoundingMode) +} + +class NumberFormat.Field -> java.text.NumberFormat$Field extends Format.Field,AttributedCharacterIterator.Attribute,Object { + NumberFormat.Field CURRENCY + NumberFormat.Field DECIMAL_SEPARATOR + NumberFormat.Field EXPONENT + NumberFormat.Field EXPONENT_SIGN + NumberFormat.Field EXPONENT_SYMBOL + NumberFormat.Field FRACTION + NumberFormat.Field GROUPING_SEPARATOR + NumberFormat.Field INTEGER + NumberFormat.Field PERCENT + NumberFormat.Field PERMILLE + NumberFormat.Field SIGN +} + +class ParsePosition -> java.text.ParsePosition extends Object { + ParsePosition (int) + int getErrorIndex() + int getIndex() + void setErrorIndex(int) + void setIndex(int) +} + +class RuleBasedCollator -> java.text.RuleBasedCollator extends Collator,Comparator,Object { + RuleBasedCollator (String) + CollationElementIterator getCollationElementIterator(String) + String getRules() +} + +class SimpleDateFormat -> java.text.SimpleDateFormat extends DateFormat,Format,Object { + SimpleDateFormat () + SimpleDateFormat (String) + SimpleDateFormat (String,Locale) + void applyLocalizedPattern(String) + void applyPattern(String) + Date get2DigitYearStart() + DateFormatSymbols getDateFormatSymbols() + void setDateFormatSymbols(DateFormatSymbols) + void set2DigitYearStart(Date) + String toLocalizedPattern() + String toPattern() +} + +class StringCharacterIterator -> java.text.StringCharacterIterator extends CharacterIterator,Object { + StringCharacterIterator (String) + StringCharacterIterator (String,int) + StringCharacterIterator (String,int,int,int) + void setText(String) +} + +#### Enums + +class Normalizer.Form -> java.text.Normalizer$Form extends Enum,Object { + Normalizer.Form NFC + Normalizer.Form NFD + Normalizer.Form NFKC + Normalizer.Form NFKD + Normalizer.Form valueOf(String) + Normalizer.Form[] values() +} + +#### Exceptions + +class ParseException -> java.text.ParseException extends Exception,Object { + ParseException (String,int) + int getErrorOffset() +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.function.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.function.txt new file mode 100644 index 00000000000..969a8d6fb46 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.function.txt @@ -0,0 +1,232 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Interfaces + +class BiConsumer -> java.util.function.BiConsumer { + void accept(def,def) + BiConsumer andThen(BiConsumer) +} + +class BiFunction -> java.util.function.BiFunction { + BiFunction andThen(Function) + def apply(def,def) +} + +class BinaryOperator -> java.util.function.BinaryOperator extends BiFunction { + BinaryOperator maxBy(Comparator) + BinaryOperator minBy(Comparator) +} + +class BiPredicate -> java.util.function.BiPredicate { + BiPredicate and(BiPredicate) + BiPredicate negate() + BiPredicate or(BiPredicate) + boolean test(def,def) +} + +class BooleanSupplier -> java.util.function.BooleanSupplier { + boolean getAsBoolean() +} + +class Consumer -> java.util.function.Consumer { + void accept(def) + Consumer andThen(Consumer) +} + +class DoubleBinaryOperator -> java.util.function.DoubleBinaryOperator { + double applyAsDouble(double,double) +} + +class DoubleConsumer -> java.util.function.DoubleConsumer { + void accept(double) + DoubleConsumer andThen(DoubleConsumer) +} + +class DoubleFunction -> java.util.function.DoubleFunction { + def apply(double) +} + +class DoublePredicate -> java.util.function.DoublePredicate { + DoublePredicate and(DoublePredicate) + DoublePredicate negate() + DoublePredicate or(DoublePredicate) + boolean test(double) +} + +class DoubleSupplier -> java.util.function.DoubleSupplier { + double getAsDouble() +} + +class DoubleToIntFunction -> java.util.function.DoubleToIntFunction { + int applyAsInt(double) +} + +class DoubleToLongFunction -> java.util.function.DoubleToLongFunction { + long applyAsLong(double) +} + +class DoubleUnaryOperator -> java.util.function.DoubleUnaryOperator { + DoubleUnaryOperator andThen(DoubleUnaryOperator) + double applyAsDouble(double) + DoubleUnaryOperator compose(DoubleUnaryOperator) + DoubleUnaryOperator identity() +} + +class Function -> java.util.function.Function { + Function andThen(Function) + def apply(def) + Function compose(Function) + Function identity() +} + +class IntBinaryOperator -> java.util.function.IntBinaryOperator { + int applyAsInt(int,int) +} + +class IntConsumer -> java.util.function.IntConsumer { + void accept(int) + IntConsumer andThen(IntConsumer) +} + +class IntFunction -> java.util.function.IntFunction { + def apply(int) +} + +class IntPredicate -> java.util.function.IntPredicate { + IntPredicate and(IntPredicate) + IntPredicate negate() + IntPredicate or(IntPredicate) + boolean test(int) +} + +class IntSupplier -> java.util.function.IntSupplier { + int getAsInt() +} + +class IntToDoubleFunction -> java.util.function.IntToDoubleFunction { + double applyAsDouble(int) +} + +class IntToLongFunction -> java.util.function.IntToLongFunction { + long applyAsLong(int) +} + +class IntUnaryOperator -> java.util.function.IntUnaryOperator { + IntUnaryOperator andThen(IntUnaryOperator) + int applyAsInt(int) + IntUnaryOperator compose(IntUnaryOperator) + IntUnaryOperator identity() +} + +class LongBinaryOperator -> java.util.function.LongBinaryOperator { + long applyAsLong(long,long) +} + +class LongConsumer -> java.util.function.LongConsumer { + void accept(long) + LongConsumer andThen(LongConsumer) +} + +class LongFunction -> java.util.function.LongFunction { + def apply(long) +} + +class LongPredicate -> java.util.function.LongPredicate { + LongPredicate and(LongPredicate) + LongPredicate negate() + LongPredicate or(LongPredicate) + boolean test(long) +} + +class LongSupplier -> java.util.function.LongSupplier { + long getAsLong() +} + +class LongToDoubleFunction -> java.util.function.LongToDoubleFunction { + double applyAsDouble(long) +} + +class LongToIntFunction -> java.util.function.LongToIntFunction { + int applyAsInt(long) +} + +class LongUnaryOperator -> java.util.function.LongUnaryOperator { + LongUnaryOperator andThen(LongUnaryOperator) + long applyAsLong(long) + LongUnaryOperator compose(LongUnaryOperator) + LongUnaryOperator identity() +} + +class ObjDoubleConsumer -> java.util.function.ObjDoubleConsumer { + void accept(def,double) +} + +class ObjIntConsumer -> java.util.function.ObjIntConsumer { + void accept(def,int) +} + +class ObjLongConsumer -> java.util.function.ObjLongConsumer { + void accept(def,long) +} + +class Predicate -> java.util.function.Predicate { + Predicate and(Predicate) + Predicate isEqual(def) + Predicate negate() + Predicate or(Predicate) + boolean test(def) +} + +class Supplier -> java.util.function.Supplier { + def get() +} + +class ToDoubleBiFunction -> java.util.function.ToDoubleBiFunction { + double applyAsDouble(def,def) +} + +class ToDoubleFunction -> java.util.function.ToDoubleFunction { + double applyAsDouble(def) +} + +class ToIntBiFunction -> java.util.function.ToIntBiFunction { + int applyAsInt(def,def) +} + +class ToIntFunction -> java.util.function.ToIntFunction { + int applyAsInt(def) +} + +class ToLongBiFunction -> java.util.function.ToLongBiFunction { + long applyAsLong(def,def) +} + +class ToLongFunction -> java.util.function.ToLongFunction { + long applyAsLong(def) +} + +class UnaryOperator -> java.util.function.UnaryOperator extends Function { + UnaryOperator identity() +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.stream.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.stream.txt new file mode 100644 index 00000000000..d24cf8c0424 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.stream.txt @@ -0,0 +1,273 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Interfaces + +class BaseStream -> java.util.stream.BaseStream { + void close() + boolean isParallel() + Iterator iterator() + BaseStream sequential() + Spliterator spliterator() + BaseStream unordered() +} + +class Collector -> java.util.stream.Collector { + BiConsumer accumulator() + Set characteristics() + BinaryOperator combiner() + Function finisher() + Collector of(Supplier,BiConsumer,BinaryOperator,Function,Collector.Characteristics[]) + Collector of(Supplier,BiConsumer,BinaryOperator,Collector.Characteristics[]) + Supplier supplier() +} + +class DoubleStream -> java.util.stream.DoubleStream extends BaseStream { + boolean allMatch(DoublePredicate) + boolean anyMatch(DoublePredicate) + OptionalDouble average() + Stream boxed() + DoubleStream.Builder builder() + def collect(Supplier,ObjDoubleConsumer,BiConsumer) + DoubleStream concat(DoubleStream,DoubleStream) + long count() + DoubleStream distinct() + DoubleStream empty() + DoubleStream filter(DoublePredicate) + OptionalDouble findAny() + OptionalDouble findFirst() + DoubleStream flatMap(DoubleFunction) + void forEach(DoubleConsumer) + void forEachOrdered(DoubleConsumer) + PrimitiveIterator.OfDouble iterator() + DoubleStream limit(long) + DoubleStream map(DoubleUnaryOperator) + IntStream mapToInt(DoubleToIntFunction) + LongStream mapToLong(DoubleToLongFunction) + Stream mapToObj(DoubleFunction) + OptionalDouble max() + OptionalDouble min() + boolean noneMatch(DoublePredicate) + DoubleStream of(double[]) + DoubleStream peek(DoubleConsumer) + OptionalDouble reduce(DoubleBinaryOperator) + double reduce(double,DoubleBinaryOperator) + DoubleStream sequential() + DoubleStream skip(long) + DoubleStream sorted() + Spliterator.OfDouble spliterator() + double sum() + DoubleSummaryStatistics summaryStatistics() + double[] toArray() +} + +class DoubleStream.Builder -> java.util.stream.DoubleStream$Builder extends DoubleConsumer { + DoubleStream.Builder add(double) + DoubleStream build() +} + +class IntStream -> java.util.stream.IntStream extends BaseStream { + boolean allMatch(IntPredicate) + boolean anyMatch(IntPredicate) + DoubleStream asDoubleStream() + LongStream asLongStream() + OptionalDouble average() + Stream boxed() + IntStream.Builder builder() + def collect(Supplier,ObjIntConsumer,BiConsumer) + IntStream concat(IntStream,IntStream) + long count() + IntStream distinct() + IntStream empty() + IntStream filter(IntPredicate) + OptionalInt findAny() + OptionalInt findFirst() + IntStream flatMap(IntFunction) + void forEach(IntConsumer) + void forEachOrdered(IntConsumer) + PrimitiveIterator.OfInt iterator() + IntStream limit(long) + IntStream map(IntUnaryOperator) + DoubleStream mapToDouble(IntToDoubleFunction) + LongStream mapToLong(IntToLongFunction) + Stream mapToObj(IntFunction) + OptionalInt max() + OptionalInt min() + boolean noneMatch(IntPredicate) + IntStream of(int[]) + IntStream peek(IntConsumer) + IntStream range(int,int) + IntStream rangeClosed(int,int) + OptionalInt reduce(IntBinaryOperator) + int reduce(int,IntBinaryOperator) + IntStream sequential() + IntStream skip(long) + IntStream sorted() + Spliterator.OfInt spliterator() + int sum() + IntSummaryStatistics summaryStatistics() + int[] toArray() +} + +class IntStream.Builder -> java.util.stream.IntStream$Builder extends IntConsumer { + IntStream.Builder add(int) + IntStream build() +} + +class LongStream -> java.util.stream.LongStream extends BaseStream { + boolean allMatch(LongPredicate) + boolean anyMatch(LongPredicate) + DoubleStream asDoubleStream() + OptionalDouble average() + Stream boxed() + LongStream.Builder builder() + def collect(Supplier,ObjLongConsumer,BiConsumer) + LongStream concat(LongStream,LongStream) + long count() + LongStream distinct() + LongStream empty() + LongStream filter(LongPredicate) + OptionalLong findAny() + OptionalLong findFirst() + LongStream flatMap(LongFunction) + void forEach(LongConsumer) + void forEachOrdered(LongConsumer) + PrimitiveIterator.OfLong iterator() + LongStream limit(long) + LongStream map(LongUnaryOperator) + DoubleStream mapToDouble(LongToDoubleFunction) + IntStream mapToInt(LongToIntFunction) + Stream mapToObj(LongFunction) + OptionalLong max() + OptionalLong min() + boolean noneMatch(LongPredicate) + LongStream of(long[]) + LongStream peek(LongConsumer) + LongStream range(long,long) + LongStream rangeClosed(long,long) + OptionalLong reduce(LongBinaryOperator) + long reduce(long,LongBinaryOperator) + LongStream sequential() + LongStream skip(long) + LongStream sorted() + Spliterator.OfLong spliterator() + long sum() + LongSummaryStatistics summaryStatistics() + long[] toArray() +} + +class LongStream.Builder -> java.util.stream.LongStream$Builder extends LongConsumer { + LongStream.Builder add(long) + LongStream build() +} + +class Stream -> java.util.stream.Stream extends BaseStream { + boolean allMatch(Predicate) + boolean anyMatch(Predicate) + Stream.Builder builder() + def collect(Collector) + def collect(Supplier,BiConsumer,BiConsumer) + Stream concat(Stream,Stream) + long count() + Stream distinct() + Stream empty() + Stream filter(Predicate) + Optional findAny() + Optional findFirst() + Stream flatMap(Function) + DoubleStream flatMapToDouble(Function) + IntStream flatMapToInt(Function) + LongStream flatMapToLong(Function) + void forEach(Consumer) + void forEachOrdered(Consumer) + Stream limit(long) + Stream map(Function) + DoubleStream mapToDouble(ToDoubleFunction) + IntStream mapToInt(ToIntFunction) + LongStream mapToLong(ToLongFunction) + Optional max(Comparator) + Optional min(Comparator) + boolean noneMatch(Predicate) + Stream of(def[]) + Stream peek(Consumer) + Optional reduce(BinaryOperator) + def reduce(def,BinaryOperator) + def reduce(def,BiFunction,BinaryOperator) + Stream skip(long) + Stream sorted() + Stream sorted(Comparator) + def[] toArray() + def[] toArray(IntFunction) +} + +class Stream.Builder -> java.util.stream.Stream$Builder extends Consumer { + Stream.Builder add(def) + Stream build() +} + +#### Classes + +class Collectors -> java.util.stream.Collectors extends Object { + Collector averagingDouble(ToDoubleFunction) + Collector averagingInt(ToIntFunction) + Collector averagingLong(ToLongFunction) + Collector collectingAndThen(Collector,Function) + Collector counting() + Collector groupingBy(Function) + Collector groupingBy(Function,Collector) + Collector groupingBy(Function,Supplier,Collector) + Collector joining() + Collector joining(CharSequence) + Collector joining(CharSequence,CharSequence,CharSequence) + Collector mapping(Function,Collector) + Collector maxBy(Comparator) + Collector minBy(Comparator) + Collector partitioningBy(Predicate) + Collector partitioningBy(Predicate,Collector) + Collector reducing(BinaryOperator) + Collector reducing(def,BinaryOperator) + Collector reducing(def,Function,BinaryOperator) + Collector summarizingDouble(ToDoubleFunction) + Collector summarizingInt(ToIntFunction) + Collector summarizingLong(ToLongFunction) + Collector summingDouble(ToDoubleFunction) + Collector summingInt(ToIntFunction) + Collector summingLong(ToLongFunction) + Collector toCollection(Supplier) + Collector toList() + Collector toMap(Function,Function) + Collector toMap(Function,Function,BinaryOperator) + Collector toMap(Function,Function,BinaryOperator,Supplier) + Collector toSet() +} + +#### Enums + +class Collector.Characteristics -> java.util.stream.Collector$Characteristics extends Enum,Object { + Collector.Characteristics CONCURRENT + Collector.Characteristics IDENTITY_FINISH + Collector.Characteristics UNORDERED + Collector.Characteristics valueOf(String) + Collector.Characteristics[] values() +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.txt new file mode 100644 index 00000000000..9be890f15d5 --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/java.util.txt @@ -0,0 +1,1148 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Interfaces + +class Collection -> java.util.Collection extends Iterable { + boolean add(def) + boolean addAll(Collection) + void clear() + boolean contains(def) + boolean containsAll(Collection) + boolean isEmpty() + boolean removeAll(Collection) + boolean removeIf(Predicate) + boolean retainAll(Collection) + int size() + Spliterator spliterator() + Stream stream() + def[] toArray() + def[] toArray(def[]) +} + +class Comparator -> java.util.Comparator { + int compare(def,def) + Comparator comparing(Function) + Comparator comparing(Function,Comparator) + Comparator comparingDouble(ToDoubleFunction) + Comparator comparingInt(ToIntFunction) + Comparator comparingLong(ToLongFunction) + boolean equals(Object) + Comparator naturalOrder() + Comparator nullsFirst(Comparator) + Comparator nullsLast(Comparator) + Comparator reversed() + Comparator reverseOrder() + Comparator thenComparing(Comparator) + Comparator thenComparing(Function,Comparator) + Comparator thenComparingDouble(ToDoubleFunction) + Comparator thenComparingInt(ToIntFunction) + Comparator thenComparingLong(ToLongFunction) +} + +class Deque -> java.util.Deque extends Queue,Collection,Iterable { + void addFirst(def) + void addLast(def) + Iterator descendingIterator() + def getFirst() + def getLast() + boolean offerFirst(def) + boolean offerLast(def) + def peekFirst() + def peekLast() + def pollFirst() + def pollLast() + def pop() + void push(def) + boolean remove(def) + def removeFirst() + boolean removeFirstOccurrence(def) + def removeLast() + boolean removeLastOccurrence(def) +} + +class Enumeration -> java.util.Enumeration { + boolean hasMoreElements() + def nextElement() +} + +class EventListener -> java.util.EventListener { +} + +class Formattable -> java.util.Formattable { + void formatTo(Formatter,int,int,int) +} + +class Iterator -> java.util.Iterator { + void forEachRemaining(Consumer) + boolean hasNext() + def next() + void remove() +} + +class List -> java.util.List extends Collection,Iterable { + void add(int,def) + boolean addAll(int,Collection) + boolean equals(Object) + def get(int) + int hashCode() + int indexOf(def) + int lastIndexOf(def) + ListIterator listIterator() + ListIterator listIterator(int) + def remove(int) + void replaceAll(UnaryOperator) + def set(int,def) + # TODO: wtf? + int getLength/size() + void sort(Comparator) + List subList(int,int) +} + +class ListIterator -> java.util.ListIterator extends Iterator { + void add(def) + boolean hasPrevious() + int nextIndex() + int previousIndex() + void set(def) +} + +class Map -> java.util.Map { + void clear() + def compute(def,BiFunction) + def computeIfAbsent(def,Function) + def computeIfPresent(def,BiFunction) + boolean containsKey(def) + boolean containsValue(def) + Set entrySet() + boolean equals(Object) + void forEach(BiConsumer) + def get(def) + def getOrDefault(def,def) + boolean isEmpty() + Set keySet() + def merge(def,def,BiFunction) + def put(def,def) + void putAll(Map) + def putIfAbsent(def,def) + def remove(def) + boolean remove(def,def) + def replace(def,def) + boolean replace(def,def,def) + void replaceAll(BiFunction) + int size() + Collection values() +} + +class Map.Entry -> java.util.Map$Entry { + Comparator comparingByKey() + Comparator comparingByKey(Comparator) + Comparator comparingByValue() + Comparator comparingByValue(Comparator) + boolean equals(Object) + def getKey() + def getValue() + int hashCode() + def setValue(def) +} + +class NavigableMap -> java.util.NavigableMap extends SortedMap,Map { + Map.Entry ceilingEntry(def) + def ceilingKey(def) + NavigableSet descendingKeySet() + NavigableMap descendingMap() + Map.Entry firstEntry() + Map.Entry floorEntry(def) + def floorKey(def) + NavigableMap headMap(def,boolean) + Map.Entry higherEntry(def) + def higherKey(def) + Map.Entry lastEntry() + Map.Entry lowerEntry(def) + NavigableSet navigableKeySet() + Map.Entry pollFirstEntry() + Map.Entry pollLastEntry() + NavigableMap subMap(def,boolean,def,boolean) + NavigableMap tailMap(def,boolean) +} + +class NavigableSet -> java.util.NavigableSet extends SortedSet,Set,Collection,Iterable { + def ceiling(def) + Iterator descendingIterator() + NavigableSet descendingSet() + def floor(def) + NavigableSet headSet(def,boolean) + def higher(def) + def lower(def) + def pollFirst() + def pollLast() + NavigableSet subSet(def,boolean,def,boolean) + NavigableSet tailSet(def,boolean) +} + +class Observer -> java.util.Observer { + void update(Observable,Object) +} + +class PrimitiveIterator -> java.util.PrimitiveIterator extends Iterator { + void forEachRemaining(def) +} + +class PrimitiveIterator.OfDouble -> java.util.PrimitiveIterator$OfDouble extends PrimitiveIterator,Iterator { + Double next() + double nextDouble() +} + +class PrimitiveIterator.OfInt -> java.util.PrimitiveIterator$OfInt extends PrimitiveIterator,Iterator { + Integer next() + int nextInt() +} + +class PrimitiveIterator.OfLong -> java.util.PrimitiveIterator$OfLong extends PrimitiveIterator,Iterator { + Long next() + long nextLong() +} + +class Spliterator -> java.util.Spliterator { + int CONCURRENT + int DISTINCT + int IMMUTABLE + int NONNULL + int ORDERED + int SIZED + int SORTED + int SUBSIZED + int characteristics() + long estimateSize() + void forEachRemaining(Consumer) + Comparator getComparator() + long getExactSizeIfKnown() + boolean hasCharacteristics(int) + boolean tryAdvance(Consumer) + Spliterator trySplit() +} + +class Spliterator.OfPrimitive -> java.util.Spliterator$OfPrimitive extends Spliterator { + void forEachRemaining(def) + boolean tryAdvance(def) + Spliterator.OfPrimitive trySplit() +} + +class Spliterator.OfDouble -> java.util.Spliterator$OfDouble extends Spliterator.OfPrimitive,Spliterator { + Spliterator.OfDouble trySplit() +} + +class Spliterator.OfInt -> java.util.Spliterator$OfInt extends Spliterator.OfPrimitive,Spliterator { + Spliterator.OfInt trySplit() +} + +class Spliterator.OfLong -> java.util.Spliterator$OfLong extends Spliterator.OfPrimitive,Spliterator { + Spliterator.OfLong trySplit() +} + +class Queue -> java.util.Queue extends Collection,Iterable { + def element() + boolean offer(def) + def peek() + def poll() + def remove() +} + +class RandomAccess -> java.util.RandomAccess { +} + +class Set -> java.util.Set extends Collection,Iterable { + boolean equals(Object) + int hashCode() + boolean remove(def) +} + +class SortedMap -> java.util.SortedMap extends Map { + Comparator comparator() + def firstKey() + SortedMap headMap(def) + def lastKey() + SortedMap subMap(def,def) + SortedMap tailMap(def) +} + +class SortedSet -> java.util.SortedSet extends Set,Collection,Iterable { + Comparator comparator() + def first() + SortedSet headSet(def) + def last() + SortedSet subSet(def,def) + SortedSet tailSet(def) +} + +#### Classes + +class AbstractCollection -> java.util.AbstractCollection extends Collection,Iterable,Object { +} + +class AbstractList -> java.util.AbstractList extends AbstractCollection,List,Collection,Iterable,Object { +} + +class AbstractMap -> java.util.AbstractMap extends Map,Object { +} + +class AbstractMap.SimpleEntry -> java.util.AbstractMap$SimpleEntry extends Map.Entry,Object { + AbstractMap.SimpleEntry (def,def) + AbstractMap.SimpleEntry (Map.Entry) +} + +class AbstractMap.SimpleImmutableEntry -> java.util.AbstractMap$SimpleImmutableEntry extends Map.Entry,Object { + AbstractMap.SimpleImmutableEntry (def,def) + AbstractMap.SimpleImmutableEntry (Map.Entry) +} + +class AbstractQueue -> java.util.AbstractQueue extends AbstractCollection,Queue,Collection,Iterable,Object { +} + +class AbstractSequentialList -> java.util.AbstractSequentialList extends AbstractList,AbstractCollection,List,Collection,Iterable,Object { +} + +class AbstractSet -> java.util.AbstractSet extends AbstractCollection,Set,Collection,Iterable,Object { +} + +class ArrayDeque -> java.util.ArrayDeque extends AbstractCollection,Deque,Queue,Collection,Iterable,Object { + ArrayDeque () + ArrayDeque (Collection) + ArrayDeque clone() +} + +class ArrayList -> java.util.ArrayList extends AbstractList,AbstractCollection,List,RandomAccess,Collection,Iterable,Object { + ArrayList () + ArrayList (Collection) + def clone() + void trimToSize() +} + +class Arrays -> java.util.Arrays extends Object { + List asList(Object[]) + boolean deepEquals(Object[],Object[]) + int deepHashCode(Object[]) + String deepToString(Object[]) +} + +class Base64 -> java.util.Base64 extends Object { + Base64.Decoder getDecoder() + Base64.Encoder getEncoder() + Base64.Decoder getMimeDecoder() + Base64.Encoder getMimeEncoder() + Base64.Encoder getMimeEncoder(int,byte[]) + Base64.Decoder getUrlDecoder() + Base64.Encoder getUrlEncoder() +} + +class Base64.Decoder -> java.util.Base64$Decoder extends Object { + int decode(byte[],byte[]) + byte[] decode(String) +} + +class Base64.Encoder -> java.util.Base64$Encoder extends Object { + int encode(byte[],byte[]) + String encodeToString(byte[]) + Base64.Encoder withoutPadding() +} + +class BitSet -> java.util.BitSet extends Object { + BitSet () + BitSet (int) + void and(BitSet) + void andNot(BitSet) + int cardinality() + void clear() + void clear(int) + void clear(int,int) + def clone() + void flip(int) + void flip(int,int) + boolean intersects(BitSet) + boolean isEmpty() + int length() + int nextClearBit(int) + int nextSetBit(int) + void or(BitSet) + int previousClearBit(int) + int previousSetBit(int) + void set(int) + void set(int,int) + void set(int,int,boolean) + int size() + byte[] toByteArray() + long[] toLongArray() + BitSet valueOf(long[]) + void xor(BitSet) +} + +class Calendar -> java.util.Calendar extends Comparable,Object { + int ALL_STYLES + int AM + int AM_PM + int APRIL + int AUGUST + int DATE + int DAY_OF_MONTH + int DAY_OF_WEEK + int DAY_OF_WEEK_IN_MONTH + int DAY_OF_YEAR + int DECEMBER + int DST_OFFSET + int ERA + int FEBRUARY + int FIELD_COUNT + int FRIDAY + int HOUR + int HOUR_OF_DAY + int JANUARY + int JULY + int JUNE + int LONG + int LONG_FORMAT + int LONG_STANDALONE + int MARCH + int MAY + int MILLISECOND + int MINUTE + int MONDAY + int MONTH + int NARROW_FORMAT + int NARROW_STANDALONE + int NOVEMBER + int OCTOBER + int PM + int SATURDAY + int SECOND + int SEPTEMBER + int SHORT + int SHORT_FORMAT + int SHORT_STANDALONE + int SUNDAY + int THURSDAY + int TUESDAY + int UNDECIMBER + int WEDNESDAY + int WEEK_OF_MONTH + int WEEK_OF_YEAR + int YEAR + int ZONE_OFFSET + void add(int,int) + boolean after(Object) + boolean before(Object) + void clear() + void clear(int) + def clone() + int get(int) + int getActualMaximum(int) + int getActualMinimum(int) + Set getAvailableCalendarTypes() + Locale[] getAvailableLocales() + String getCalendarType() + String getDisplayName(int,int,Locale) + Map getDisplayNames(int,int,Locale) + int getFirstDayOfWeek() + int getGreatestMinimum(int) + Calendar getInstance() + Calendar getInstance(TimeZone) + Calendar getInstance(TimeZone,Locale) + int getLeastMaximum(int) + int getMaximum(int) + int getMinimalDaysInFirstWeek() + int getMinimum(int) + Date getTime() + long getTimeInMillis() + TimeZone getTimeZone() + int getWeeksInWeekYear() + int getWeekYear() + boolean isLenient() + boolean isSet(int) + boolean isWeekDateSupported() + void roll(int,int) + void set(int,int) + void set(int,int,int) + void set(int,int,int,int,int) + void set(int,int,int,int,int,int) + void setFirstDayOfWeek(int) + void setLenient(boolean) + void setMinimalDaysInFirstWeek(int) + void setTime(Date) + void setTimeInMillis(long) + void setTimeZone(TimeZone) + void setWeekDate(int,int,int) +} + +class Calendar.Builder -> java.util.Calendar$Builder extends Object { + Calendar.Builder () + Calendar build() + Calendar.Builder set(int,int) + Calendar.Builder setCalendarType(String) + Calendar.Builder setDate(int,int,int) + Calendar.Builder setFields(int[]) + Calendar.Builder setInstant(long) + Calendar.Builder setLenient(boolean) + Calendar.Builder setLocale(Locale) + Calendar.Builder setTimeOfDay(int,int,int) + Calendar.Builder setTimeOfDay(int,int,int,int) + Calendar.Builder setTimeZone(TimeZone) + Calendar.Builder setWeekDate(int,int,int) + Calendar.Builder setWeekDefinition(int,int) +} + +class Collections -> java.util.Collections extends Object { + List EMPTY_LIST + Map EMPTY_MAP + Set EMPTY_SET + boolean addAll(Collection,def[]) + Queue asLifoQueue(Deque) + int binarySearch(List,def) + int binarySearch(List,def,Comparator) + void copy(List,List) + boolean disjoint(Collection,Collection) + Enumeration emptyEnumeration() + Iterator emptyIterator() + List emptyList() + ListIterator emptyListIterator() + Map emptyMap() + NavigableMap emptyNavigableMap() + NavigableSet emptyNavigableSet() + Set emptySet() + SortedMap emptySortedMap() + SortedSet emptySortedSet() + Enumeration enumeration(Collection) + void fill(List,def) + int frequency(Collection,def) + int indexOfSubList(List,List) + int lastIndexOfSubList(List,List) + ArrayList list(Enumeration) + def max(Collection) + def max(Collection,Comparator) + def min(Collection) + def min(Collection,Comparator) + List nCopies(int,def) + Set newSetFromMap(Map) + boolean replaceAll(List,def,def) + void reverse(List) + Comparator reverseOrder() + Comparator reverseOrder(Comparator) + void rotate(List,int) + void shuffle(List) + void shuffle(List,Random) + Set singleton(def) + List singletonList(def) + Map singletonMap(def,def) + void sort(List) + void sort(List,Comparator) + void swap(List,int,int) + Collection unmodifiableCollection(Collection) + List unmodifiableList(List) + Map unmodifiableMap(Map) + NavigableMap unmodifiableNavigableMap(NavigableMap) + NavigableSet unmodifiableNavigableSet(NavigableSet) + Set unmodifiableSet(Set) + SortedMap unmodifiableSortedMap(SortedMap) + SortedSet unmodifiableSortedSet(SortedSet) +} + +class Currency -> java.util.Currency extends Object { + Set getAvailableCurrencies() + String getCurrencyCode() + int getDefaultFractionDigits() + String getDisplayName() + String getDisplayName(Locale) + Currency getInstance(String) + int getNumericCode() + String getSymbol() + String getSymbol(Locale) +} + +class Date -> java.util.Date extends Comparable,Object { + Date () + Date (long) + boolean after(Date) + boolean before(Date) + def clone() + long getTime() + void setTime(long) +} + +class Dictionary -> java.util.Dictionary extends Object { + Enumeration elements() + def get(def) + boolean isEmpty() + Enumeration keys() + def put(def,def) + def remove(def) + int size() +} + +class DoubleSummaryStatistics -> java.util.DoubleSummaryStatistics extends DoubleConsumer,Object { + DoubleSummaryStatistics () + void combine(DoubleSummaryStatistics) + double getAverage() + long getCount() + double getMax() + double getMin() + double getSum() +} + +class EventListenerProxy -> java.util.EventListenerProxy extends EventListener,Object { + EventListener getListener() +} + +class EventObject -> java.util.EventObject extends Object { + EventObject (Object) + Object getSource() +} + +class FormattableFlags -> java.util.FormattableFlags extends Object { + int ALTERNATE + int LEFT_JUSTIFY + int UPPERCASE +} + +class Formatter -> java.util.Formatter extends Object { + Formatter () + Formatter (Appendable) + Formatter (Appendable,Locale) + Formatter format(Locale,String,def[]) + Formatter format(String,def[]) + Locale locale() + Appendable out() +} + +class GregorianCalendar -> java.util.GregorianCalendar extends Calendar,Comparable,Object { + int AD + int BC + GregorianCalendar () + GregorianCalendar (int,int,int) + GregorianCalendar (int,int,int,int,int) + GregorianCalendar (int,int,int,int,int,int) + GregorianCalendar (TimeZone) + GregorianCalendar (TimeZone,Locale) + Date getGregorianChange() + boolean isLeapYear(int) + void setGregorianChange(Date) +} + +class HashMap -> java.util.HashMap extends AbstractMap,Map,Object { + HashMap () + HashMap (Map) + def clone() +} + +class HashSet -> java.util.HashSet extends AbstractSet,Set,Collection,Iterable,Object { + HashSet () + HashSet (Collection) + def clone() +} + +class Hashtable -> java.util.Hashtable extends Dictionary,Map,Object { + Hashtable () + Hashtable (Map) + def clone() +} + +class IdentityHashMap -> java.util.IdentityHashMap extends AbstractMap,Map,Object { + IdentityHashMap () + IdentityHashMap (Map) + def clone() +} + +class IntSummaryStatistics -> java.util.IntSummaryStatistics extends IntConsumer,Object { + IntSummaryStatistics () + void combine(IntSummaryStatistics) + double getAverage() + long getCount() + int getMax() + int getMin() + long getSum() +} + +class LinkedHashMap -> java.util.LinkedHashMap extends HashMap,AbstractMap,Map,Object { + LinkedHashMap () + LinkedHashMap (Map) +} + +class LinkedHashSet -> java.util.LinkedHashSet extends HashSet,AbstractSet,Set,AbstractCollection,Collection,Iterable,Object { + LinkedHashSet () + LinkedHashSet (Collection) +} + +class LinkedList -> java.util.LinkedList extends AbstractSequentialList,AbstractList,List,Deque,Queue,AbstractCollection,Collection,Iterable,Object { + LinkedList () + LinkedList (Collection) + def clone() +} + +class Locale -> java.util.Locale extends Object { + Locale CANADA + Locale CANADA_FRENCH + Locale CHINA + Locale CHINESE + Locale ENGLISH + Locale FRANCE + Locale FRENCH + Locale GERMAN + Locale GERMANY + Locale ITALIAN + Locale ITALY + Locale JAPAN + Locale JAPANESE + Locale KOREA + Locale KOREAN + Locale PRC + char PRIVATE_USE_EXTENSION + Locale ROOT + Locale SIMPLIFIED_CHINESE + Locale TAIWAN + Locale TRADITIONAL_CHINESE + Locale UK + char UNICODE_LOCALE_EXTENSION + Locale US + Locale (String) + Locale (String,String) + Locale (String,String,String) + def clone() + List filter(List,Collection) + List filterTags(List,Collection) + Locale forLanguageTag(String) + Locale[] getAvailableLocales() + String getCountry() + Locale getDefault() + Locale getDefault(Locale.Category) + String getDisplayCountry() + String getDisplayCountry(Locale) + String getDisplayLanguage() + String getDisplayLanguage(Locale) + String getDisplayName() + String getDisplayName(Locale) + String getDisplayScript() + String getDisplayScript(Locale) + String getDisplayVariant() + String getDisplayVariant(Locale) + String getExtension(char) + Set getExtensionKeys() + String getISO3Country() + String getISO3Language() + String[] getISOCountries() + String[] getISOLanguages() + String getLanguage() + String getScript() + Set getUnicodeLocaleAttributes() + Set getUnicodeLocaleKeys() + String getUnicodeLocaleType(String) + String getVariant() + boolean hasExtensions() + Locale lookup(List,Collection) + String lookupTag(List,Collection) + Locale stripExtensions() + String toLanguageTag() +} + +class Locale.Builder -> java.util.Locale$Builder extends Object { + Locale.Builder () + Locale.Builder addUnicodeLocaleAttribute(String) + Locale build() + Locale.Builder clear() + Locale.Builder clearExtensions() + Locale.Builder removeUnicodeLocaleAttribute(String) + Locale.Builder setExtension(char,String) + Locale.Builder setLanguage(String) + Locale.Builder setLanguageTag(String) + Locale.Builder setLocale(Locale) + Locale.Builder setRegion(String) + Locale.Builder setScript(String) + Locale.Builder setUnicodeLocaleKeyword(String,String) + Locale.Builder setVariant(String) +} + +class Locale.LanguageRange -> java.util.Locale$LanguageRange extends Object { + double MAX_WEIGHT + double MIN_WEIGHT + Locale.LanguageRange (String) + Locale.LanguageRange (String,double) + String getRange() + double getWeight() + List mapEquivalents(List,Map) + List parse(String) + List parse(String,Map) +} + +class LongSummaryStatistics -> java.util.LongSummaryStatistics extends LongConsumer,Object { + LongSummaryStatistics () + void combine(LongSummaryStatistics) + double getAverage() + long getCount() + long getMax() + long getMin() + long getSum() +} + +class Objects -> java.util.Objects extends Object { + int compare(def,def,Comparator) + boolean deepEquals(Object,Object) + boolean equals(Object,Object) + int hash(Object[]) + int hashCode(Object) + boolean isNull(Object) + boolean nonNull(Object) + def requireNonNull(def) + def requireNonNull(def,String) + String toString(Object) + String toString(Object,String) +} + +class Observable -> java.util.Observable extends Object { + Observable () + void addObserver(Observer) + int countObservers() + void deleteObserver(Observer) + void deleteObservers() + boolean hasChanged() + void notifyObservers() + void notifyObservers(Object) +} + +class Optional -> java.util.Optional extends Object { + Optional empty() + Optional filter(Predicate) + Optional flatMap(Function) + def get() + void ifPresent(Consumer) + boolean isPresent() + Optional map(Function) + Optional of(def) + Optional ofNullable(def) + def orElse(def) + def orElseGet(Supplier) + def orElseThrow(Supplier) +} + +class OptionalDouble -> java.util.OptionalDouble extends Object { + OptionalDouble empty() + double getAsDouble() + void ifPresent(DoubleConsumer) + boolean isPresent() + OptionalDouble of(double) + double orElse(double) + double orElseGet(DoubleSupplier) + double orElseThrow(Supplier) +} + +class OptionalInt -> java.util.OptionalInt extends Object { + OptionalInt empty() + int getAsInt() + void ifPresent(IntConsumer) + boolean isPresent() + OptionalInt of(int) + int orElse(int) + int orElseGet(IntSupplier) + int orElseThrow(Supplier) +} + +class OptionalLong -> java.util.OptionalLong extends Object { + OptionalLong empty() + long getAsLong() + void ifPresent(LongConsumer) + boolean isPresent() + OptionalLong of(long) + long orElse(long) + long orElseGet(LongSupplier) + long orElseThrow(Supplier) +} + +class PriorityQueue -> java.util.PriorityQueue extends AbstractQueue,Queue,AbstractCollection,Collection,Iterable,Object { + PriorityQueue () + PriorityQueue (Comparator) +} + +class Random -> java.util.Random extends Object { + Random () + Random (long) + DoubleStream doubles(long) + DoubleStream doubles(long,double,double) + IntStream ints(long) + IntStream ints(long,int,int) + LongStream longs(long) + LongStream longs(long,long,long) + boolean nextBoolean() + void nextBytes(byte[]) + double nextDouble() + float nextFloat() + double nextGaussian() + int nextInt() + int nextInt(int) + long nextLong() + void setSeed(long) +} + +class SimpleTimeZone -> java.util.SimpleTimeZone extends TimeZone,Object { + int STANDARD_TIME + int UTC_TIME + int WALL_TIME + SimpleTimeZone (int,String) + SimpleTimeZone (int,String,int,int,int,int,int,int,int,int) + SimpleTimeZone (int,String,int,int,int,int,int,int,int,int,int) + SimpleTimeZone (int,String,int,int,int,int,int,int,int,int,int,int,int) + int getDSTSavings() + void setDSTSavings(int) + void setEndRule(int,int,int) + void setEndRule(int,int,int,int) + void setEndRule(int,int,int,int,boolean) + void setStartRule(int,int,int) + void setStartRule(int,int,int,int) + void setStartRule(int,int,int,int,boolean) + void setStartYear(int) +} + +class Spliterators -> java.util.Spliterators extends Object { + Spliterator.OfDouble emptyDoubleSpliterator() + Spliterator.OfInt emptyIntSpliterator() + Spliterator.OfLong emptyLongSpliterator() + Spliterator emptySpliterator() + Iterator iterator(Spliterator) + Spliterator spliterator(Collection,int) + Spliterator spliterator(Iterator,long,int) + Spliterator spliteratorUnknownSize(Iterator,int) +} + +class Stack -> java.util.Stack extends Vector,AbstractList,List,AbstractCollection,Collection,Iterable,RandomAccess,Object { + Stack () + def push(def) + def pop() + def peek() + boolean empty() + int search(def) +} + +class StringJoiner -> java.util.StringJoiner extends Object { + StringJoiner (CharSequence) + StringJoiner (CharSequence,CharSequence,CharSequence) + StringJoiner add(CharSequence) + int length() + StringJoiner merge(StringJoiner) + StringJoiner setEmptyValue(CharSequence) +} + +class StringTokenizer -> java.util.StringTokenizer extends Enumeration,Object { + StringTokenizer (String) + StringTokenizer (String,String) + StringTokenizer (String,String,boolean) + int countTokens() + boolean hasMoreTokens() + String nextToken() + String nextToken(String) +} + +class TimeZone -> java.util.TimeZone extends Object { + int LONG + int SHORT + def clone() + String[] getAvailableIDs() + String[] getAvailableIDs(int) + TimeZone getDefault() + String getDisplayName() + String getDisplayName(boolean,int) + String getDisplayName(boolean,int,Locale) + String getDisplayName(Locale) + int getDSTSavings() + String getID() + int getOffset(int,int,int,int,int,int) + int getOffset(long) + int getRawOffset() + TimeZone getTimeZone(String) + boolean hasSameRules(TimeZone) + boolean inDaylightTime(Date) + boolean observesDaylightTime() + boolean useDaylightTime() +} + +class TreeMap -> java.util.TreeMap extends AbstractMap,NavigableMap,SortedMap,Map,Object { + TreeMap () + TreeMap (Comparator) + def clone() +} + +class TreeSet -> java.util.TreeSet extends AbstractSet,NavigableSet,SortedSet,Set,AbstractCollection,Collection,Iterable,Object { + TreeSet () + TreeSet (Comparator) + def clone() +} + +class UUID -> java.util.UUID extends Comparable,Object { + UUID (long,long) + int clockSequence() + UUID fromString(String) + long getLeastSignificantBits() + long getMostSignificantBits() + UUID nameUUIDFromBytes(byte[]) + long node() + long timestamp() + int variant() + int version() +} + +class Vector -> java.util.Vector extends AbstractList,List,AbstractCollection,Collection,Iterable,RandomAccess,Object { + Vector () + Vector (Collection) + void addElement(def) + void copyInto(Object[]) + def elementAt(int) + Enumeration elements() + def firstElement() + void insertElementAt(def,int) + def lastElement() + int lastIndexOf(def,int) + void removeAllElements() + boolean removeElement(def) + void removeElementAt(int) + void setElementAt(def,int) + def clone() +} + +#### Enums + +class Formatter.BigDecimalLayoutForm -> java.util.Formatter$BigDecimalLayoutForm extends Enum,Comparable,Object { + Formatter.BigDecimalLayoutForm DECIMAL_FLOAT + Formatter.BigDecimalLayoutForm SCIENTIFIC +} + +class Locale.Category -> java.util.Locale$Category extends Enum,Comparable,Object { + Locale.Category DISPLAY + Locale.Category FORMAT + Locale.Category valueOf(String) + Locale.Category[] values() +} + +class Locale.FilteringMode -> java.util.Locale$FilteringMode extends Enum,Comparable,Object { + Locale.FilteringMode AUTOSELECT_FILTERING + Locale.FilteringMode EXTENDED_FILTERING + Locale.FilteringMode IGNORE_EXTENDED_RANGES + Locale.FilteringMode MAP_EXTENDED_RANGES + Locale.FilteringMode REJECT_EXTENDED_RANGES + Locale.FilteringMode valueOf(String) + Locale.FilteringMode[] values() +} + +#### Exceptions + +class ConcurrentModificationException -> java.util.ConcurrentModificationException extends RuntimeException,Exception { + ConcurrentModificationException () + ConcurrentModificationException (String) +} + +class DuplicateFormatFlagsException -> java.util.DuplicateFormatFlagsException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + DuplicateFormatFlagsException (String) + String getFlags() +} + +class EmptyStackException -> java.util.EmptyStackException extends RuntimeException,Exception { + EmptyStackException () +} + +class FormatFlagsConversionMismatchException -> java.util.FormatFlagsConversionMismatchException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + FormatFlagsConversionMismatchException (String,char) + char getConversion() + String getFlags() +} + +class FormatterClosedException -> java.util.FormatterClosedException extends IllegalStateException,RuntimeException,Exception { + FormatterClosedException () +} + +class IllegalFormatCodePointException -> java.util.IllegalFormatCodePointException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + IllegalFormatCodePointException (int) + int getCodePoint() +} + +class IllegalFormatConversionException -> java.util.IllegalFormatConversionException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + char getConversion() +} + +class IllegalFormatException -> java.util.IllegalFormatException extends IllegalArgumentException,RuntimeException,Exception { +} + +class IllegalFormatFlagsException -> java.util.IllegalFormatFlagsException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + IllegalFormatFlagsException (String) + String getFlags() +} + +class IllegalFormatPrecisionException -> java.util.IllegalFormatPrecisionException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + IllegalFormatPrecisionException (int) + int getPrecision() +} + +class IllegalFormatWidthException -> java.util.IllegalFormatWidthException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + IllegalFormatWidthException (int) + int getWidth() +} + +class IllformedLocaleException -> java.util.IllformedLocaleException extends RuntimeException,Exception { + IllformedLocaleException () + IllformedLocaleException (String) + IllformedLocaleException (String,int) + int getErrorIndex() +} + +class InputMismatchException -> java.util.InputMismatchException extends NoSuchElementException,RuntimeException,Exception { + InputMismatchException () + InputMismatchException (String) +} + +class MissingFormatArgumentException -> java.util.MissingFormatArgumentException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + MissingFormatArgumentException (String) + String getFormatSpecifier() +} + +class MissingFormatWidthException -> java.util.MissingFormatWidthException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + MissingFormatWidthException (String) + String getFormatSpecifier() +} + +class MissingResourceException -> java.util.MissingResourceException extends RuntimeException,Exception { + MissingResourceException (String,String,String) + String getClassName() + String getKey() +} + +class NoSuchElementException -> java.util.NoSuchElementException extends RuntimeException,Exception { + NoSuchElementException () + NoSuchElementException (String) +} + +class TooManyListenersException -> java.util.TooManyListenersException extends Exception { + TooManyListenersException () + TooManyListenersException (String) +} + +class UnknownFormatConversionException -> java.util.UnknownFormatConversionException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + UnknownFormatConversionException (String) + String getConversion() +} + +class UnknownFormatFlagsException -> java.util.UnknownFormatFlagsException extends IllegalFormatException,IllegalArgumentException,RuntimeException,Exception { + UnknownFormatFlagsException (String) + String getFlags() +} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/org.elasticsearch.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/org.elasticsearch.txt new file mode 100644 index 00000000000..a4af7c318ec --- /dev/null +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/org.elasticsearch.txt @@ -0,0 +1,127 @@ +# +# Licensed to Elasticsearch under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Elasticsearch licenses this file to you 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. +# + +# +# Painless definition file. This defines the hierarchy of classes, +# what methods and fields they have, etc. +# + +#### Primitive types + +class void -> void { +} + +class boolean -> boolean { +} + +class byte -> byte { +} + +class short -> short { +} + +class char -> char { +} + +class int -> int { +} + +class long -> long { +} + +class float -> float { +} + +class double -> double { +} + +class def -> java.lang.Object { + boolean equals(Object) + int hashCode() + String toString() +} + +#### ES Scripting API + +class GeoPoint -> org.elasticsearch.common.geo.GeoPoint extends Object { + double getLat() + double getLon() +} + +class Strings -> org.elasticsearch.index.fielddata.ScriptDocValues$Strings extends List,Collection,Iterable,Object { + String getValue() + List getValues() +} + +class Longs -> org.elasticsearch.index.fielddata.ScriptDocValues$Longs extends List,Collection,Iterable,Object { + long getValue() + List getValues() +} + +class Doubles -> org.elasticsearch.index.fielddata.ScriptDocValues$Doubles extends List,Collection,Iterable,Object { + double getValue() + List getValues() +} + +class GeoPoints -> org.elasticsearch.index.fielddata.ScriptDocValues$GeoPoints extends List,Collection,Iterable,Object { + GeoPoint getValue() + List getValues() + double getLat() + double getLon() + double[] getLats() + double[] getLons() + + # geo distance functions... so many... + double factorDistance(double,double) + double factorDistanceWithDefault(double,double,double) + double factorDistance02(double,double) + double factorDistance13(double,double) + double arcDistance(double,double) + double arcDistanceWithDefault(double,double,double) + double arcDistanceInKm(double,double) + double arcDistanceInKmWithDefault(double,double,double) + double arcDistanceInMiles(double,double) + double arcDistanceInMilesWithDefault(double,double,double) + double distance(double,double) + double distanceWithDefault(double,double,double) + double distanceInKm(double,double) + double distanceInKmWithDefault(double,double,double) + double distanceInMiles(double,double) + double distanceInMilesWithDefault(double,double,double) + double geohashDistance(String) + double geohashDistanceInKm(String) + double geohashDistanceInMiles(String) +} + +# for testing. +# currently FeatureTest exposes overloaded constructor, field load store, and overloaded static methods +class FeatureTest -> org.elasticsearch.painless.FeatureTest extends Object { + FeatureTest () + FeatureTest (int,int) + int getX() + int getY() + void setX(int) + void setY(int) + boolean overloadedStatic() + boolean overloadedStatic(boolean) +} + +# currently needed internally +class Executable -> org.elasticsearch.painless.Executable { +} diff --git a/modules/lang-painless/src/test/java/org/elasticsearch/painless/BasicAPITests.java b/modules/lang-painless/src/test/java/org/elasticsearch/painless/BasicAPITests.java index 338e3f00113..043b614cadd 100644 --- a/modules/lang-painless/src/test/java/org/elasticsearch/painless/BasicAPITests.java +++ b/modules/lang-painless/src/test/java/org/elasticsearch/painless/BasicAPITests.java @@ -19,6 +19,9 @@ package org.elasticsearch.painless; +import java.util.Arrays; +import java.util.Collections; + public class BasicAPITests extends ScriptTestCase { public void testListIterator() { @@ -90,4 +93,8 @@ public class BasicAPITests extends ScriptTestCase { assertBytecodeExists("def x = 1F", "INVOKESTATIC java/lang/Float.valueOf (F)Ljava/lang/Float;"); assertBytecodeExists("def x = 1D", "INVOKESTATIC java/lang/Double.valueOf (D)Ljava/lang/Double;"); } + + void testStream() { + assertEquals(11, exec("params.list.stream().sum()", Collections.singletonMap("list", Arrays.asList(1,2,3,5)))); + } }