diff options
author | Shigeru Chiba <chibash@users.noreply.github.com> | 2023-12-10 00:47:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-10 00:47:26 +0900 |
commit | 310fb8fe71b1d6950ac35219358dda6ffcacc69f (patch) | |
tree | 0ce0674728ec2a0b4a2c1d35d33dfa81a5cea3cc /src/main | |
parent | 158294371e39b24f003f15933bd74f2b26bbf3aa (diff) | |
parent | c04c375e813597eaeb305a641f58a89fe665ea54 (diff) | |
download | javassist-310fb8fe71b1d6950ac35219358dda6ffcacc69f.tar.gz javassist-310fb8fe71b1d6950ac35219358dda6ffcacc69f.zip |
Merge pull request #466 from shifujun/pr-fix-lookupMethod
Fix MemberResolver.lookupMethod bug when super class has more preciseā¦
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/javassist/compiler/MemberResolver.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/main/javassist/compiler/MemberResolver.java b/src/main/javassist/compiler/MemberResolver.java index c01974df..dd271368 100644 --- a/src/main/javassist/compiler/MemberResolver.java +++ b/src/main/javassist/compiler/MemberResolver.java @@ -130,9 +130,7 @@ public class MemberResolver implements TokenId { if (onlyExact) maybe = null; - else - if (maybe != null) - return maybe; + //else maybe super class has more precise match int mod = clazz.getModifiers(); boolean isIntf = Modifier.isInterface(mod); @@ -143,8 +141,11 @@ public class MemberResolver implements TokenId { if (pclazz != null) { Method r = lookupMethod(pclazz, methodName, argTypes, argDims, argClassNames, onlyExact); - if (r != null) - return r; + if (r != null) { + if (maybe == null || maybe.notmatch > r.notmatch) { + maybe = r; + } + } } } } @@ -156,8 +157,11 @@ public class MemberResolver implements TokenId { Method r = lookupMethod(intf, methodName, argTypes, argDims, argClassNames, onlyExact); - if (r != null) - return r; + if (r != null) { + if (maybe == null || maybe.notmatch > r.notmatch) { + maybe = r; + } + } } if (isIntf) { @@ -166,8 +170,11 @@ public class MemberResolver implements TokenId { if (pclazz != null) { Method r = lookupMethod(pclazz, methodName, argTypes, argDims, argClassNames, onlyExact); - if (r != null) - return r; + if (r != null) { + if (maybe == null || maybe.notmatch > r.notmatch) { + maybe = r; + } + } } } } |