summaryrefslogtreecommitdiffstats
path: root/test/026-access
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-08-08 19:55:37 -0700
committerAndreas Gampe <agampe@google.com>2014-08-08 20:44:20 -0700
commit81db6a7c20aa008c7edbb7377b4bc3a9afe91bb7 (patch)
tree8d01a5af133afb621f7d53b8b300707afe79adbc /test/026-access
parent4ef12f5b0e26c6016c87866f6a33da5ed8e98d74 (diff)
downloadart-81db6a7c20aa008c7edbb7377b4bc3a9afe91bb7.zip
art-81db6a7c20aa008c7edbb7377b4bc3a9afe91bb7.tar.gz
art-81db6a7c20aa008c7edbb7377b4bc3a9afe91bb7.tar.bz2
ART: Do not check interface being subclass for member access
When checking access to a protected member, do not try to see whether an interface is a subclass of the declaring class. Bug: 16904661 Change-Id: I3e1fa4ce9753e0a96633fff0fba807d72bc0b19d
Diffstat (limited to 'test/026-access')
-rw-r--r--test/026-access/expected.txt4
-rw-r--r--test/026-access/src/Iface.java22
-rw-r--r--test/026-access/src/Iface2.java25
-rw-r--r--test/026-access/src/Main.java5
-rw-r--r--test/026-access/src/Unrelated.java24
5 files changed, 80 insertions, 0 deletions
diff --git a/test/026-access/expected.txt b/test/026-access/expected.txt
index dabfb37..89fa21a 100644
--- a/test/026-access/expected.txt
+++ b/test/026-access/expected.txt
@@ -1,2 +1,6 @@
access test
Blort.
+1
+2
+3
+5
diff --git a/test/026-access/src/Iface.java b/test/026-access/src/Iface.java
new file mode 100644
index 0000000..24f4b03
--- /dev/null
+++ b/test/026-access/src/Iface.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+/**
+ * Another interface.
+ */
+public interface Iface {
+ public final static int X = 1;
+}
diff --git a/test/026-access/src/Iface2.java b/test/026-access/src/Iface2.java
new file mode 100644
index 0000000..d2de3f7
--- /dev/null
+++ b/test/026-access/src/Iface2.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+/**
+ * Another interface.
+ */
+public interface Iface2 extends Iface {
+ public final static int Y = Iface.X + 1;
+
+ public final static int A = new Unrelated(3).instance_x;
+ public final static int B = Unrelated.static_x;
+}
diff --git a/test/026-access/src/Main.java b/test/026-access/src/Main.java
index 6b509a3..fe1a1eb 100644
--- a/test/026-access/src/Main.java
+++ b/test/026-access/src/Main.java
@@ -22,5 +22,10 @@ public class Main {
PublicAccess pa = new PublicAccess();
pa.main();
+
+ System.out.println(Iface.X);
+ System.out.println(Iface2.Y);
+ System.out.println(Iface2.A);
+ System.out.println(Iface2.B);
}
}
diff --git a/test/026-access/src/Unrelated.java b/test/026-access/src/Unrelated.java
new file mode 100644
index 0000000..c3e4248
--- /dev/null
+++ b/test/026-access/src/Unrelated.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 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 Unrelated {
+ protected int instance_x;
+ protected static int static_x = 5;
+
+ protected Unrelated(int x) {
+ instance_x = x;
+ }
+}