diff options
-rw-r--r-- | Readme.html | 2 | ||||
-rw-r--r-- | src/main/javassist/compiler/MemberCodeGen.java | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/Readme.html b/Readme.html index 28d2a1f6..e7d90560 100644 --- a/Readme.html +++ b/Readme.html @@ -283,7 +283,7 @@ see javassist.Dump. <p>-version 3.11 <ul> - <li>JIRA JASSIST-74, 75 was fixed. + <li>JIRA JASSIST-74, 75, 76 were fixed. </ul> <p>-version 3.10 on March 5, 2009 diff --git a/src/main/javassist/compiler/MemberCodeGen.java b/src/main/javassist/compiler/MemberCodeGen.java index 72848036..892fc154 100644 --- a/src/main/javassist/compiler/MemberCodeGen.java +++ b/src/main/javassist/compiler/MemberCodeGen.java @@ -632,13 +632,19 @@ public class MemberCodeGen extends CodeGen { } else if (isSpecial) // if (isSpecial && notStatic(acc)) bytecode.addInvokespecial(declClass, mname, desc); - else if (declClass.isInterface()) - bytecode.addInvokeinterface(declClass, mname, desc, count); - else - if (isStatic) - throw new CompileError(mname + " is not static"); + else { + if (!Modifier.isPublic(declClass.getModifiers()) + || declClass.isInterface() != targetClass.isInterface()) + declClass = targetClass; + + if (declClass.isInterface()) + bytecode.addInvokeinterface(declClass, mname, desc, count); else - bytecode.addInvokevirtual(declClass, mname, desc); + if (isStatic) + throw new CompileError(mname + " is not static"); + else + bytecode.addInvokevirtual(declClass, mname, desc); + } setReturnType(desc, isStatic, popTarget); } |