-
Notifications
You must be signed in to change notification settings - Fork 704
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix MemberResolver.lookupMethod bug when super class has more precise…
… match When onlyExact=false and super class have a more precise match, it should not return with current class's maybe result. New added testSuperCall reveals the problem.
- Loading branch information
Showing
3 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package javassist; | ||
|
||
class Animal { | ||
} | ||
|
||
class Bear extends Animal { | ||
} | ||
|
||
|
||
/** | ||
* Base class has a method with precise type. | ||
*/ | ||
class Man { | ||
String feed(Bear bear) { | ||
return "Man feed(Bear)"; | ||
} | ||
} | ||
|
||
/** | ||
* Derived class has a method which has same name with base class's and more imprecise type. | ||
*/ | ||
class Keeper extends Man { | ||
String feed(Animal animal) { | ||
return "Keeper feed(Animal)"; | ||
} | ||
} | ||
|
||
/** | ||
* Derived class has a method which call super method with precise type. | ||
*/ | ||
class BearKeeper extends Keeper { | ||
public BearKeeper() { | ||
} | ||
|
||
String javacResult() { | ||
return super.feed(new Bear()); | ||
} | ||
} |