summaryrefslogtreecommitdiffstats
path: root/libart
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-08-08 16:09:58 -0700
committerMathieu Chartier <mathieuc@google.com>2014-08-11 14:39:06 -0700
commitf1c8d808ea349df134c0ee0908c1fc8c91493e0a (patch)
tree63a95b42cb0b01a56a4e0a42275031b7c87b7210 /libart
parentcf5219256c9a44e9b215ac645c1823238ebd31d7 (diff)
downloadlibcore-f1c8d808ea349df134c0ee0908c1fc8c91493e0a.zip
libcore-f1c8d808ea349df134c0ee0908c1fc8c91493e0a.tar.gz
libcore-f1c8d808ea349df134c0ee0908c1fc8c91493e0a.tar.bz2
Don't allow Class.class.getDeclaredConstructor().setAccessible().
The new behavior is to throw a SecurityException. Bug: 16866726 Bug: https://code.google.com/p/android-developer-preview/issues/detail?id=561 Change-Id: I1fa0d9617f8b25bf4e93a52c4aed22f0be27555b
Diffstat (limited to 'libart')
-rw-r--r--libart/src/main/java/java/lang/reflect/AccessibleObject.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/libart/src/main/java/java/lang/reflect/AccessibleObject.java b/libart/src/main/java/java/lang/reflect/AccessibleObject.java
index dd57a12..a1e2743 100644
--- a/libart/src/main/java/java/lang/reflect/AccessibleObject.java
+++ b/libart/src/main/java/java/lang/reflect/AccessibleObject.java
@@ -71,6 +71,13 @@ public class AccessibleObject implements AnnotatedElement {
* IllegalAccessExceptions}.
*/
public void setAccessible(boolean flag) {
+ try {
+ if (equals(Class.class.getDeclaredConstructor())) {
+ throw new SecurityException("Can't make class constructor accessible");
+ }
+ } catch (NoSuchMethodException e) {
+ throw new AssertionError("Couldn't find class constructor");
+ }
this.flag = flag;
}