summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-02-22 17:04:54 -0800
committerElliott Hughes <enh@google.com>2013-02-22 17:04:54 -0800
commitb0919815627858dff6d288e4d3567914e89b3661 (patch)
treeb0cb2513132ee011fa1c23aba2637b2ab0cf3738 /tests
parente3b5678ea4bea457f2190adea6745ddba673a75e (diff)
downloadandroid_dalvik-b0919815627858dff6d288e4d3567914e89b3661.tar.gz
android_dalvik-b0919815627858dff6d288e4d3567914e89b3661.tar.bz2
android_dalvik-b0919815627858dff6d288e4d3567914e89b3661.zip
Abstract methods aren't implementations.
We should only be checking the visibility of actual implementations of interface methods. Intervening abstract methods are allowed to be non-public. Bug: https://code.google.com/p/android/issues/detail?id=42991 Change-Id: I510d0cc6c1f89d161d4ebad7ef058c03fa09e9b0
Diffstat (limited to 'tests')
-rw-r--r--tests/301-abstract-protected/expected.txt1
-rw-r--r--tests/301-abstract-protected/info.txt3
-rw-r--r--tests/301-abstract-protected/src/Main.java33
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/301-abstract-protected/expected.txt b/tests/301-abstract-protected/expected.txt
new file mode 100644
index 000000000..b0aad4deb
--- /dev/null
+++ b/tests/301-abstract-protected/expected.txt
@@ -0,0 +1 @@
+passed
diff --git a/tests/301-abstract-protected/info.txt b/tests/301-abstract-protected/info.txt
new file mode 100644
index 000000000..0751eff5a
--- /dev/null
+++ b/tests/301-abstract-protected/info.txt
@@ -0,0 +1,3 @@
+Tests a dalvik bug where we'd treat an abstract method as an implementation
+of an interface method; the RI only cares about the visibility of the actual
+implementation in non-abstract subclasses.
diff --git a/tests/301-abstract-protected/src/Main.java b/tests/301-abstract-protected/src/Main.java
new file mode 100644
index 000000000..9b19a9d56
--- /dev/null
+++ b/tests/301-abstract-protected/src/Main.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+public class Main {
+ public static void main(String args[]) throws Exception {
+ System.err.println(new C().m());
+ }
+}
+
+// An arbitrary interface.
+interface I { public String m(); }
+
+// This is I-like, but doesn't actually claim to implement I.
+abstract class Abstract { protected abstract String m(); }
+
+// This claims to implement I, but the inherited m isn't sufficiently visible.
+abstract class AbstractI extends Abstract implements I { }
+
+// This has a concrete m that's sufficiently visible, so all should be good.
+class C extends AbstractI { public String m() { return "passed"; }; }