aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/reflect/AccessibleObject.java
blob: 8c869e167b0ade0f0795ac87cbc3ee95a5afa812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// AccessibleObject.java - Base for reflection objects.

/* Copyright (C) 1998, 1999  Cygnus Solutions

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */
 
package java.lang.reflect;

/**
 * @author Tom Tromey <tromey@cygnus.com>
 * @date December 12, 1998
 */
/* Written using JDK 1.2 beta docs.
 * Status:  Believed complete and correct.
 */

public class AccessibleObject
{
  protected AccessibleObject ()
    {
      flag = false;
    }

  boolean isAccessible ()
    {
      return flag;
    }

  static void setAccessible (AccessibleObject[] array, boolean flag)
    {
      checkPermission ();
      for (int i = 0; i < array.length; ++i)
	array[i].flag = flag;
    }

  void setAccessible (boolean flag)
    {
      checkPermission ();
      this.flag = flag;
    }

  private static final void checkPermission ()
    {
      SecurityManager sm = System.getSecurityManager();
      // FIXME: sm.checkPermission(ReflectPermission ("suppressAccessChecks"))
    }

  private boolean flag;
}