You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Declared by a class compatible with its return type
Above criteria do not meet what I would expect from a coercion operator, because there is no way for a non-static parameterless method declared by the expected return type, to convert a value from another type (that cannot be supplied). Eventually, it should be provided by a type assignable from the operand type.
we can see that the actual criteria could be
either:
Static
Provided by a type assignable from the coercion type
Accepting a parameter compatible with the provided operand type
Returning a type compatible with the coercion method
like String::valueOf
or
Non-Static
Provided by a type assignable from the operand type
Parameterless
Returning a type compatible with the coercion method
like Long.intValue().
At least, the default coercion methods seem to fall in the above categories (and to be honest, I would avoid the strict check over the declaring type: why a static method provided by another class to perform the conversion is not allowed?).
The check to ensure the method singature of a method-based
UnaryExpression
expression is probably not correct.The current method is
procyon/Procyon.Expressions/src/main/java/com/strobel/expressions/Expression.java
Lines 3200 to 3230 in fec0d7a
which means that the coercion method must be:
To be a valid operator, as per the following function
procyon/Procyon.Expressions/src/main/java/com/strobel/expressions/Expression.java
Lines 3145 to 3169 in fec0d7a
it must be:
Above criteria do not meet what I would expect from a coercion operator, because there is no way for a non-static parameterless method declared by the expected return type, to convert a value from another type (that cannot be supplied). Eventually, it should be provided by a type assignable from the operand type.
Looking at the 'default' coercion methods
procyon/Procyon.Reflection/src/main/java/com/strobel/util/TypeUtils.java
Lines 265 to 285 in fec0d7a
we can see that the actual criteria could be
either:
like
String::valueOf
or
like
Long.intValue()
.At least, the default coercion methods seem to fall in the above categories (and to be honest, I would avoid the strict check over the declaring type: why a static method provided by another class to perform the conversion is not allowed?).
For reference the current .NET implementation requires the method to be:
The text was updated successfully, but these errors were encountered: