Do not set ACC_SUPER flag for interfaces
The debugger's GetModifier method forces the ACC_SUPER flag set for all
classes and interfaces because dex files don't contain this flag.
But according to the JVM Spec (Class File Structure) the ACC_SUPER flag
must not be set for interfaces:
If the ACC_INTERFACE flag of this class file is set,
its ACC_ABSTRACT flag must also be set (JLS 9.1.1.1). Such a class
file must not have its ACC_FINAL, ACC_SUPER or ACC_ENUM flags set.
The patch sets ACC_SUPER only if ACC_INTERFACE is not set.
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
Change-Id: I6cc4b215a6584d177845a4f8cce1efeb1650f646
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 733e843..f7dcaee 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -680,9 +680,12 @@
uint32_t access_flags = c->GetAccessFlags() & kAccJavaFlagsMask;
- // Set ACC_SUPER; dex files don't contain this flag, but all classes are supposed to have it set.
+ // Set ACC_SUPER. Dex files don't contain this flag but only classes are supposed to have it set,
+ // not interfaces.
// Class.getModifiers doesn't return it, but JDWP does, so we set it here.
- access_flags |= kAccSuper;
+ if ((access_flags & kAccInterface) == 0) {
+ access_flags |= kAccSuper;
+ }
expandBufAdd4BE(pReply, access_flags);