jmultimethod

multimethods for Java using annotations
git clone https://logand.com/git/jmultimethod.git/
Log | Files | Refs | LICENSE

commit 5809f73c0137d840be5d60e6973e6c8c53fc2e86
parent ff34246932785c0fbd42b6c30ddb95d7b206130d
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sat, 26 Dec 2015 23:51:57 +0100

fix method sorting

Diffstat:
Msrc/jmultimethod/Multimethod.java | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/jmultimethod/Multimethod.java b/src/jmultimethod/Multimethod.java @@ -56,12 +56,17 @@ public class Multimethod { String lv = value(l, i); String rv = value(r, i); if(lv == null) { - if(rv != null) { + if(rv == null) { + if(lc[i].isAssignableFrom(rc[i])) { + return 1; + } + } else { return 1; } - } - if(lc[i].isAssignableFrom(rc[i])) { - return 1; + } else { + if(rv == null) { + return -1; + } } } return -1;