jdk/test/com/sun/security/sasl/util/CheckAccess.java
author vinnie
Fri, 17 Jul 2009 20:43:53 +0100
changeset 3472 ff6f0e6f7c83
child 5506 202f599c92aa
permissions -rw-r--r--
6657695: AbstractSaslImpl.logger is a static mutable (findbugs) Reviewed-by: alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3472
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     1
/*
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     4
 *
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     8
 *
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    13
 * accompanied this code).
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    14
 *
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    18
 *
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    21
 * have any questions.
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    22
 */
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    23
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    24
/**
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    25
 * @test
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    26
 * @bug 6657695
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    27
 * @summary AbstractSaslImpl.logger is a static mutable (findbugs)
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    28
 * @author Vincent Ryan
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    29
 */
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    30
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    31
import java.lang.reflect.*;
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    32
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    33
/*
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    34
 * Check that the 'logger' class member is immutable.
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    35
 */
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    36
public class CheckAccess {
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    37
    public static final void main(String[] args) throws Exception {
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    38
            Class clazz =
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    39
                Class.forName("com.sun.security.sasl.util.AbstractSaslImpl");
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    40
            Field field = clazz.getDeclaredField("logger");
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    41
            if (! Modifier.isFinal(field.getModifiers())) {
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    42
                throw new Exception(
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    43
                    "class member 'logger' must be immutable");
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    44
            }
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    45
    }
ff6f0e6f7c83 6657695: AbstractSaslImpl.logger is a static mutable (findbugs)
vinnie
parents:
diff changeset
    46
}