Only JDWP exposes ACC_SUPER.
Also track the use of suppressed exceptions with ClassNotFoundException.
Change-Id: I5349d2e397f94c162cf44435cd36cab71f233480
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 62d3df7..bc8e333 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1386,8 +1386,6 @@
uint32_t access_flags = dex_class_def.access_flags_;
// Make sure that none of our runtime-only flags are set.
CHECK_EQ(access_flags & ~kAccJavaFlagsMask, 0U);
- // Set ACC_SUPER; dex files don't contain this flag, but all classes are supposed to have it set.
- access_flags |= kAccSuper;
klass->SetAccessFlags(access_flags);
klass->SetClassLoader(class_loader);
DCHECK_EQ(klass->GetPrimitiveType(), Primitive::kPrimNot);
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index 99916bd..7914aa7 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -469,15 +469,17 @@
return ERR_NONE;
}
-/*
- * Return the modifiers (a/k/a access flags) for a reference type.
- */
static JdwpError handleRT_Modifiers(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
uint32_t access_flags;
if (!Dbg::GetAccessFlags(refTypeId, access_flags)) {
return ERR_INVALID_CLASS;
}
+
+ // Set ACC_SUPER; dex files don't contain this flag, but all classes are supposed to have it set.
+ // Class.getModifiers doesn't return it, but JDWP does, so we set it here.
+ access_flags |= kAccSuper;
+
expandBufAdd4BE(pReply, access_flags);
return ERR_NONE;
}
diff --git a/test/003-omnibus-opcodes/expected.txt b/test/003-omnibus-opcodes/expected.txt
index 3e7ce84..33322eb 100644
--- a/test/003-omnibus-opcodes/expected.txt
+++ b/test/003-omnibus-opcodes/expected.txt
@@ -69,11 +69,19 @@
UnresTest1...
UnresTest2...
java.lang.ClassNotFoundException: Didn't find class "UnresClass" on path: /data/art-test/003-omnibus-opcodes.jar
- at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
- at java.lang.ClassLoader.loadClass(ClassLoader.java:509)
+ at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:64)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at UnresTest2.run(UnresTest2.java:33)
at Main.run(Main.java:64)
at Main.main(Main.java:26)
+ Suppressed: java.lang.ClassNotFoundException: UnresClass
+ at java.lang.Class.classForName(Native Method)
+ at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
+ at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
+ at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
+ ... 4 more
+ Caused by: java.lang.NoClassDefFoundError: Class "LUnresClass;" not found
+ ... 8 more
InternedString.run
Done!