VarArgsToArrayAdapterState.class, loadConstant(callSiteBinder, userStateFactory, MethodHandle.class).invoke("invokeExact", Object.class), newArray(type(javaArrayType), argsLength).cast(Object.class)).ret());
.ifTrue(thisVariable.setField(selectedPositionsField, newArray(type(boolean[].class), positionCount))));
method.getBody().append(thisVariable.setField(selectedPositions, newArray(type(boolean[].class), 0))); });
String.class, constantString("Duplicate keys (%s) are not allowed"), newArray(type(Object[].class), ImmutableList.of(transformedKeySqlType.invoke("getObjectValue", Object.class, session, blockBuilder.cast(Block.class), position)))))) .throwObject();
VarArgsToArrayAdapterState.class, loadConstant(callSiteBinder, userStateFactory, MethodHandle.class).invoke("invokeExact", Object.class), newArray(type(javaArrayType), argsLength).cast(Object.class)).ret());
VarArgsToArrayAdapterState.class, loadConstant(callSiteBinder, userStateFactory, MethodHandle.class).invoke("invokeExact", Object.class), newArray(type(javaArrayType), argsLength).cast(Object.class)).ret());
@Test public void testNewArray() throws Exception { assertBytecodeExpressionType(newArray(type(boolean[].class), 5), type(boolean[].class)); assertBytecodeExpression(newArray(type(boolean[].class), 5).length(), 5, "new boolean[5].length"); assertBytecodeExpressionType(newArray(type(char[].class), 5), type(char[].class)); assertBytecodeExpression(newArray(type(char[].class), 5).length(), 5, "new char[5].length"); assertBytecodeExpressionType(newArray(type(float[].class), 5), type(float[].class)); assertBytecodeExpression(newArray(type(float[].class), 5).length(), 5, "new float[5].length"); assertBytecodeExpressionType(newArray(type(double[].class), 5), type(double[].class)); assertBytecodeExpression(newArray(type(double[].class), 5).length(), 5, "new double[5].length"); assertBytecodeExpressionType(newArray(type(byte[].class), 5), type(byte[].class)); assertBytecodeExpression(newArray(type(byte[].class), 5).length(), 5, "new byte[5].length"); assertBytecodeExpressionType(newArray(type(short[].class), 5), type(short[].class)); assertBytecodeExpression(newArray(type(short[].class), 5).length(), 5, "new short[5].length"); assertBytecodeExpressionType(newArray(type(int[].class), 5), type(int[].class)); assertBytecodeExpression(newArray(type(int[].class), 5).length(), 5, "new int[5].length"); assertBytecodeExpressionType(newArray(type(long[].class), 5), type(long[].class)); assertBytecodeExpression(newArray(type(long[].class), 5).length(), 5, "new long[5].length"); assertBytecodeExpressionType(constantString("foo bar baz").invoke("split", String[].class, constantString(" ")), type(String[].class)); assertBytecodeExpression(constantString("foo bar baz").invoke("split", String[].class, constantString(" ")).length(), 3, "\"foo bar baz\".split(\" \").length"); }
@Test public void testNewArrayPrefilled() throws Exception { assertBytecodeExpressionType(newArray(type(boolean[].class), ImmutableList.of(constantTrue(), constantFalse(), constantTrue())), type(boolean[].class)); assertBytecodeExpression( newArray(type(boolean[].class), ImmutableList.of(constantTrue(), constantFalse(), constantTrue())), new boolean[] {true, false, true}, "new boolean[] {true, false, true}"); assertBytecodeExpressionType(newArray(type(int[].class), ImmutableList.of(constantInt(65), constantInt(66), constantInt(99))), type(int[].class)); assertBytecodeExpression( newArray(type(int[].class), ImmutableList.of(constantInt(65), constantInt(66), constantInt(99))), new int[] {65, 66, 99}, "new int[] {65, 66, 99}"); assertBytecodeExpressionType(newArray(type(long[].class), ImmutableList.of(constantLong(1234L), constantLong(12345L), constantLong(9876543210L))), type(long[].class)); assertBytecodeExpression( newArray(type(long[].class), ImmutableList.of(constantLong(1234L), constantLong(12345L), constantLong(9876543210L))), new long[] {1234L, 12345L, 9876543210L}, "new long[] {1234L, 12345L, 9876543210L}"); assertBytecodeExpressionType(newArray(type(String[].class), ImmutableList.of(constantString("grape"), constantNull(String.class), constantString("new"), constantString("array"))), type(String[].class)); assertBytecodeExpression( newArray(type(String[].class), ImmutableList.of(constantString("grape"), constantNull(String.class), constantString("new"), constantString("array"))), new String[] {"grape", null, "new", "array"}, "new String[] {\"grape\", null, \"new\", \"array\"}"); }
@Test public void testSetElement() throws Exception { BytecodeExpression stringArray = constantString("foo bar baz").invoke("split", String[].class, constantString(" ")); assertBytecodeExpressionType(stringArray, type(String[].class)); assertBytecodeExpression(stringArray.length(), 3, "\"foo bar baz\".split(\" \").length"); assertBytecodeExpression(stringArray.getElement(0), "foo", "\"foo bar baz\".split(\" \")[0]"); assertBytecodeExpression(stringArray.getElement(1), "bar", "\"foo bar baz\".split(\" \")[1]"); assertBytecodeExpression(stringArray.getElement(2), "baz", "\"foo bar baz\".split(\" \")[2]"); assertBytecodeExpression(invokeStatic(typeMethodMap.get(boolean[].class), newArray(type(boolean[].class), 5), constantInt(0), constantTrue()), true, classLoader); assertBytecodeExpression(invokeStatic(typeMethodMap.get(int[].class), newArray(type(int[].class), 5), constantInt(0), constantInt(999)), 999, classLoader); assertBytecodeExpression(invokeStatic(typeMethodMap.get(float[].class), newArray(type(float[].class), 5), constantInt(0), constantFloat(0.777f)), 0.777f, classLoader); assertBytecodeExpression(invokeStatic(typeMethodMap.get(double[].class), newArray(type(double[].class), 5), constantInt(0), constantDouble(0.888d)), 0.888d, classLoader); assertBytecodeExpression(invokeStatic(typeMethodMap.get(String[].class), stringArray, constantInt(0), constantString("hello")), "hello", classLoader); }
String.class, constantString("No constructor for union [%s] with field ID [%s] found"), newArray(type(Object[].class), constantString(metadata.getStructClass().getName()), fieldId.cast(Object.class))));
.ifTrue(thisVariable.setField(selectedPositionsField, newArray(type(boolean[].class), positionCount))));
.ifTrue(thisVariable.setField(selectedPositionsField, newArray(type(boolean[].class), positionCount))));
method.getBody().append(thisVariable.setField(selectedPositions, newArray(type(boolean[].class), 0))); });
method.getBody().append(thisVariable.setField(selectedPositions, newArray(type(boolean[].class), 0))); });
String.class, constantString("Duplicate keys (%s) are not allowed"), newArray(type(Object[].class), ImmutableList.of(transformedKeySqlType.invoke("getObjectValue", Object.class, session, blockBuilder.cast(Block.class), position)))))) .throwObject();
String.class, constantString("Duplicate keys (%s) are not allowed"), newArray(type(Object[].class), ImmutableList.of(transformedKeySqlType.invoke("getObjectValue", Object.class, session, blockBuilder.cast(Block.class), position)))))) .throwObject();