@Override public boolean isCompilable() { for (SpelNodeImpl child: this.children) { if (!child.isCompilable()) { return false; } } return true; }
@Override public boolean isCompilable() { SpelNodeImpl condition = this.children[0]; SpelNodeImpl ifNullValue = this.children[1]; return (condition.isCompilable() && ifNullValue.isCompilable() && condition.exitTypeDescriptor != null && ifNullValue.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { SpelNodeImpl condition = this.children[0]; SpelNodeImpl left = this.children[1]; SpelNodeImpl right = this.children[2]; return (condition.isCompilable() && left.isCompilable() && right.isCompilable() && CodeFlow.isBooleanCompatible(condition.exitTypeDescriptor) && left.exitTypeDescriptor != null && right.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { if (this.indexedType == IndexedType.ARRAY) { return (this.exitTypeDescriptor != null); } else if (this.indexedType == IndexedType.LIST) { return this.children[0].isCompilable(); } else if (this.indexedType == IndexedType.MAP) { return (this.children[0] instanceof PropertyOrFieldReference || this.children[0].isCompilable()); } else if (this.indexedType == IndexedType.OBJECT) { // If the string name is changing the accessor is clearly going to change (so no compilation possible) return (this.cachedReadAccessor != null && this.cachedReadAccessor instanceof ReflectivePropertyAccessor.OptimalPropertyAccessor && getChild(0) instanceof StringLiteral); } return false; }
@Override public boolean isCompilable() { if (!getLeftOperand().isCompilable()) { return false; } if (this.children.length > 1) { if (!getRightOperand().isCompilable()) { return false; } } return (this.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { if (!getLeftOperand().isCompilable()) { return false; } if (this.children.length > 1) { if (!getRightOperand().isCompilable()) { return false; } } return (this.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { if (!getLeftOperand().isCompilable()) { return false; } if (this.children.length > 1) { if (!getRightOperand().isCompilable()) { return false; } } return (this.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { SpelNodeImpl child = this.children[0]; return (child.isCompilable() && CodeFlow.isBooleanCompatible(child.exitTypeDescriptor)); }
@Override public boolean isCompilable() { if (!getLeftOperand().isCompilable()) { return false; } if (this.children.length > 1) { if (!getRightOperand().isCompilable()) { return false; } } return (this.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { if (!getLeftOperand().isCompilable()) { return false; } if (this.children.length > 1) { if (!getRightOperand().isCompilable()) { return false; } } return (this.exitTypeDescriptor != null); }
@Override public boolean isCompilable() { return (this.exitTypeDescriptor != null && getLeftOperand().isCompilable()); }
@Override public boolean isCompilable() { Method method = this.method; if (method == null) { return false; } int methodModifiers = method.getModifiers(); if (!Modifier.isStatic(methodModifiers) || !Modifier.isPublic(methodModifiers) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) { return false; } for (SpelNodeImpl child : this.children) { if (!child.isCompilable()) { return false; } } return true; }
@Override public boolean isCompilable() { SpelNodeImpl left = getLeftOperand(); SpelNodeImpl right = getRightOperand(); if (!left.isCompilable() || !right.isCompilable()) { return false; } String leftDesc = left.exitTypeDescriptor; String rightDesc = right.exitTypeDescriptor; DescriptorComparison dc = DescriptorComparison.checkNumericCompatibility(leftDesc, rightDesc, this.leftActualDescriptor, this.rightActualDescriptor); return (!dc.areNumbers || dc.areCompatible); }
protected boolean isCompilableOperatorUsingNumerics() { SpelNodeImpl left = getLeftOperand(); SpelNodeImpl right = getRightOperand(); if (!left.isCompilable() || !right.isCompilable()) { return false; } // Supported operand types for equals (at the moment) String leftDesc = left.exitTypeDescriptor; String rightDesc = right.exitTypeDescriptor; DescriptorComparison dc = DescriptorComparison.checkNumericCompatibility( leftDesc, rightDesc, this.leftActualDescriptor, this.rightActualDescriptor); return (dc.areNumbers && dc.areCompatible); }
@Override public boolean isCompilable() { SpelNodeImpl left = getLeftOperand(); SpelNodeImpl right = getRightOperand(); if (!left.isCompilable() || !right.isCompilable()) { return false; } String leftDesc = left.exitTypeDescriptor; String rightDesc = right.exitTypeDescriptor; DescriptorComparison dc = DescriptorComparison.checkNumericCompatibility(leftDesc, rightDesc, this.leftActualDescriptor, this.rightActualDescriptor); return (!dc.areNumbers || dc.areCompatible); }
@Override public boolean isCompilable() { SpelNodeImpl left = getLeftOperand(); SpelNodeImpl right = getRightOperand(); return (left.isCompilable() && right.isCompilable() && CodeFlow.isBooleanCompatible(left.exitTypeDescriptor) && CodeFlow.isBooleanCompatible(right.exitTypeDescriptor)); }
@Override public boolean isCompilable() { SpelNodeImpl left = getLeftOperand(); SpelNodeImpl right = getRightOperand(); return (left.isCompilable() && right.isCompilable() && CodeFlow.isBooleanCompatible(left.exitTypeDescriptor) && CodeFlow.isBooleanCompatible(right.exitTypeDescriptor)); }
@Override public boolean isCompilable() { if (!(this.cachedExecutor instanceof ReflectiveConstructorExecutor) || this.exitTypeDescriptor == null) { return false; } if (getChildCount() > 1) { for (int c = 1, max = getChildCount();c < max; c++) { if (!this.children[c].isCompilable()) { return false; } } } ReflectiveConstructorExecutor executor = (ReflectiveConstructorExecutor) this.cachedExecutor; if (executor == null) { return false; } Constructor<?> constructor = executor.getConstructor(); return (Modifier.isPublic(constructor.getModifiers()) && Modifier.isPublic(constructor.getDeclaringClass().getModifiers())); }
/** * A method reference is compilable if it has been resolved to a reflectively accessible method * and the child nodes (arguments to the method) are also compilable. */ @Override public boolean isCompilable() { CachedMethodExecutor executorToCheck = this.cachedExecutor; if (executorToCheck == null || executorToCheck.hasProxyTarget() || !(executorToCheck.get() instanceof ReflectiveMethodExecutor)) { return false; } for (SpelNodeImpl child : this.children) { if (!child.isCompilable()) { return false; } } ReflectiveMethodExecutor executor = (ReflectiveMethodExecutor) executorToCheck.get(); if (executor.didArgumentConversionOccur()) { return false; } Class<?> clazz = executor.getMethod().getDeclaringClass(); if (!Modifier.isPublic(clazz.getModifiers()) && executor.getPublicDeclaringClass() == null) { return false; } return true; }
@Test public void functionReferenceNonCompilableArguments_SPR12359() throws Exception { StandardEvaluationContext context = new StandardEvaluationContext(new Object[] {"1"}); context.registerFunction("negate", SomeCompareMethod2.class.getDeclaredMethod( "negate", Integer.TYPE)); context.setVariable("arg", "2"); int[] ints = new int[] {1,2,3}; context.setVariable("ints",ints); expression = parser.parseExpression("#negate(#ints.?[#this<2][0])"); assertEquals("-1", expression.getValue(context, Integer.class).toString()); // Selection isn't compilable. assertFalse(((SpelNodeImpl)((SpelExpression) expression).getAST()).isCompilable()); }