/* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ /** * @test * @bug 8008744 * @key closed-security * @summary Check that ClassLoaderUtils has been moved to packages that need * it and made package-private */ import java.lang.reflect.Method; import java.lang.reflect.Modifier; public class ClassLoaderUtils { public static void main(String[] args) throws Exception { String xmlsec = "com.sun.org.apache.xml.internal.security."; String[] classes = { xmlsec + "algorithms.ClassLoaderUtils", xmlsec + "transforms.ClassLoaderUtils", xmlsec + "utils.ClassLoaderUtils" }; for (String cl : classes) { Class c = Class.forName(cl); if (Modifier.isPublic(c.getModifiers())) { throw new Exception(cl + " is public"); } Method[] methods = c.getDeclaredMethods(); for (Method m : methods) { if (Modifier.isPublic(m.getModifiers())) { throw new Exception("Method " + m.getName() + " of " + cl + " is public"); } } } } }