summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/verifier/method_verifier.cc5
-rw-r--r--test/852-invoke-super/expected-stderr.txt0
-rw-r--r--test/852-invoke-super/expected-stdout.txt0
-rw-r--r--test/852-invoke-super/info.txt1
-rw-r--r--test/852-invoke-super/smali/invoke-super.smali31
-rw-r--r--test/852-invoke-super/src/Main.java35
-rw-r--r--test/knownfailures.json1
7 files changed, 73 insertions, 0 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 18593a9338..9830bfc8d7 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -4147,12 +4147,14 @@ ArtMethod* MethodVerifier<kVerifierDebug>::VerifyInvocationArgs(
// We cannot differentiate on whether this is a class change error or just
// a missing method. This will be handled at runtime.
Fail(VERIFY_ERROR_NO_METHOD) << "Unable to find referenced class from invoke-super";
+ VerifyInvocationArgsUnresolvedMethod(inst, method_type, is_range);
return nullptr;
}
if (reference_type.GetClass()->IsInterface()) {
if (!GetDeclaringClass().HasClass()) {
Fail(VERIFY_ERROR_NO_CLASS) << "Unable to resolve the full class of 'this' used in an"
<< "interface invoke-super";
+ VerifyInvocationArgsUnresolvedMethod(inst, method_type, is_range);
return nullptr;
} else if (!reference_type.IsStrictlyAssignableFrom(GetDeclaringClass(), this)) {
Fail(VERIFY_ERROR_CLASS_CHANGE)
@@ -4161,6 +4163,7 @@ ArtMethod* MethodVerifier<kVerifierDebug>::VerifyInvocationArgs(
<< dex_file_->PrettyMethod(dex_method_idx_) << " to method "
<< dex_file_->PrettyMethod(method_idx) << " references "
<< "non-super-interface type " << mirror::Class::PrettyClass(reference_type.GetClass());
+ VerifyInvocationArgsUnresolvedMethod(inst, method_type, is_range);
return nullptr;
}
} else {
@@ -4169,6 +4172,7 @@ ArtMethod* MethodVerifier<kVerifierDebug>::VerifyInvocationArgs(
Fail(VERIFY_ERROR_NO_METHOD) << "unknown super class in invoke-super from "
<< dex_file_->PrettyMethod(dex_method_idx_)
<< " to super " << res_method->PrettyMethod();
+ VerifyInvocationArgsUnresolvedMethod(inst, method_type, is_range);
return nullptr;
}
if (!reference_type.IsStrictlyAssignableFrom(GetDeclaringClass(), this) ||
@@ -4178,6 +4182,7 @@ ArtMethod* MethodVerifier<kVerifierDebug>::VerifyInvocationArgs(
<< " to super " << super
<< "." << res_method->GetName()
<< res_method->GetSignature();
+ VerifyInvocationArgsUnresolvedMethod(inst, method_type, is_range);
return nullptr;
}
}
diff --git a/test/852-invoke-super/expected-stderr.txt b/test/852-invoke-super/expected-stderr.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/852-invoke-super/expected-stderr.txt
diff --git a/test/852-invoke-super/expected-stdout.txt b/test/852-invoke-super/expected-stdout.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/852-invoke-super/expected-stdout.txt
diff --git a/test/852-invoke-super/info.txt b/test/852-invoke-super/info.txt
new file mode 100644
index 0000000000..38447d4770
--- /dev/null
+++ b/test/852-invoke-super/info.txt
@@ -0,0 +1 @@
+Regression test on checking argument types for unresolved invoke-super.
diff --git a/test/852-invoke-super/smali/invoke-super.smali b/test/852-invoke-super/smali/invoke-super.smali
new file mode 100644
index 0000000000..6fb9c35ff1
--- /dev/null
+++ b/test/852-invoke-super/smali/invoke-super.smali
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2023 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.class public LZ;
+.super LA;
+
+.method public constructor <init>()V
+.registers 1
+ invoke-direct {v0}, LA;-><init>()V
+ return-void
+.end method
+
+.method public foo()V
+.registers 3
+ new-instance v0, LY;
+ invoke-direct {v0}, LY;-><init>()V
+ invoke-super {v0, v0}, LY;->foo()V
+ return-void
+.end method
diff --git a/test/852-invoke-super/src/Main.java b/test/852-invoke-super/src/Main.java
new file mode 100644
index 0000000000..317dde58a0
--- /dev/null
+++ b/test/852-invoke-super/src/Main.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+class A {
+ public void foo() { }
+}
+
+class Y extends A {
+ public void foo() { super.foo(); }
+}
+
+public class Main {
+
+ public static void main(String[] args) throws Exception {
+ try {
+ Class.forName("Z");
+ throw new Error("Expected VerifyError");
+ } catch (VerifyError e) {
+ // Expected.
+ }
+ }
+}
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 5bb15e0bda..a49865248a 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -1030,6 +1030,7 @@
"823-cha-inlining",
"842-vdex-hard-failure",
"850-checker-branches",
+ "852-invoke-super",
"900-hello-plugin",
"901-hello-ti-agent",
"903-hello-tagging",