summaryrefslogtreecommitdiffstats
path: root/src/main/javassist/compiler/MemberCodeGen.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/compiler/MemberCodeGen.java')
-rw-r--r--src/main/javassist/compiler/MemberCodeGen.java18
1 files changed, 12 insertions, 6 deletions
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);
}