summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/mirror/class.h2
-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
6 files changed, 81 insertions, 1 deletions
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 1e254fa..3c72b46 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -549,7 +549,7 @@ class MANAGED Class FINAL : public Object {
}
// Check for protected access from a sub-class, which may or may not be in the same package.
if (member_flags & kAccProtected) {
- if (this->IsSubClass(access_to)) {
+ if (!this->IsInterface() && this->IsSubClass(access_to)) {
return true;
}
}
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;
+ }
+}