}
// 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;
}
}
access test
Blort.
+1
+2
+3
+5
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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;
+}
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);
}
}
--- /dev/null
+/*
+ * 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;
+ }
+}