Open thradec opened 8 years ago
Well, no, a union type isn't one of those listed types ;)
This is probably quite hard to implement FTR.
Perhaps generate bytecode that uses separate parameters, one for each type with different name suffixes, that are transparently merged to appear as one in ceylon?
Annotation args can't be null in Java :-(
You'd need a "discriminator" annotation type member at the java level, to know which was actually chosen at the use-site, and then to provide "dummy" arguments for the rest. Then at runtime you could get the value of the member selected by the discriminator and ignore the rest. It would be awkward to use from Java.
What's your use case @thradec?
Well that's one way. The other way is one I suggested a long time ago which is to serialize the value to a json string. Or perhaps even to a base64-encoded binary string. That's a more general solution that would accommodate many more types.
What's your use case @thradec?
For parameterized tests, I thought it would be comfortable for simple scenarios with few values, specify them directly in annotation, eg.
test
shared void fibonacci(
parameters({1, 2, 3, 4, 5, 6}) Integer input,
parameters({1, 1, 2, 3, 5, 8}) Integer result) => ...
(I know, I can workaround it with parameter for each supported type, just it won't be so nice ;-))
I thought, that
String|Integer
will fulfill spec conditionbut I got error "illegal annotation parameter type: 'String|Integer'", can we support this?