@Test public void testIsSystemClass() { assertFalse(isSystemClass("org.example.Foo", null)); assertTrue(isSystemClass("org.example.Foo", classes("org.example.Foo"))); assertTrue(isSystemClass("/org.example.Foo", classes("org.example.Foo"))); assertTrue(isSystemClass("org.example.Foo", classes("org.example."))); assertTrue(isSystemClass("net.example.Foo", classes("org.example.,net.example."))); assertFalse(isSystemClass("org.example.Foo", classes("-org.example.Foo,org.example."))); assertTrue(isSystemClass("org.example.Bar", classes("-org.example.Foo.,org.example."))); }
public static boolean isSystemClass(String name, List<String> systemClasses) { if (systemClasses != null) { String canonicalName = name.replace('/', '.'); while (canonicalName.startsWith(".")) { canonicalName=canonicalName.substring(1); } for (String c : systemClasses) { boolean result = true; if (c.startsWith("-")) { c = c.substring(1); result = false; } if (c.endsWith(".") && canonicalName.startsWith(c)) { return result; } else if (canonicalName.equals(c)) { return result; } } } return false; }
ApplicationClassLoader extends URLClassLoader { public static boolean isSystemClass(String name, List<String> systemClasses) { if (systemClasses != null) { String canonicalName = name.replace('/', '.'); while (canonicalName.startsWith(".")) { canonicalName=canonicalName.substring(1); } for (String c : systemClasses) { boolean result = true; if (c.startsWith("-")) { c = c.substring(1); result = false; } if (c.endsWith(".") && canonicalName.startsWith(c)) { return result; } else if (canonicalName.equals(c)) { return result; } } } return false; } }
ApplicationClassLoader extends URLClassLoader { public static boolean isSystemClass(String name, List<String> systemClasses) { if (systemClasses != null) { String canonicalName = name.replace('/', '.'); while (canonicalName.startsWith(".")) { canonicalName=canonicalName.substring(1); } for (String c : systemClasses) { boolean result = true; if (c.startsWith("-")) { c = c.substring(1); result = false; } if (c.endsWith(".") && canonicalName.startsWith(c)) { return result; } else if (canonicalName.equals(c)) { return result; } } } return false; } ApplicationClassLoader(URL[] urls, ClassLoader parent,
      List<String> systemClasses);  ApplicationClassLoader(String classpath, ClassLoader parent,
      List<String> systemClasses); }
ApplicationClassLoader extends URLClassLoader { public static boolean isSystemClass(String name, List<String> systemClasses) { if (systemClasses != null) { String canonicalName = name.replace('/', '.'); while (canonicalName.startsWith(".")) { canonicalName=canonicalName.substring(1); } for (String c : systemClasses) { boolean result = true; if (c.startsWith("-")) { c = c.substring(1); result = false; } if (c.endsWith(".") && canonicalName.startsWith(c)) { return result; } else if (canonicalName.equals(c)) { return result; } } } return false; } ApplicationClassLoader(URL[] urls, ClassLoader parent,
      List<String> systemClasses);  ApplicationClassLoader(String classpath, ClassLoader parent,
      List<String> systemClasses); @Override URL getResource(String name); @Override Class<?> loadClass(String name); static boolean isSystemClass(String name, List<String> systemClasses); }
ApplicationClassLoader extends URLClassLoader { public static boolean isSystemClass(String name, List<String> systemClasses) { if (systemClasses != null) { String canonicalName = name.replace('/', '.'); while (canonicalName.startsWith(".")) { canonicalName=canonicalName.substring(1); } for (String c : systemClasses) { boolean result = true; if (c.startsWith("-")) { c = c.substring(1); result = false; } if (c.endsWith(".") && canonicalName.startsWith(c)) { return result; } else if (canonicalName.equals(c)) { return result; } } } return false; } ApplicationClassLoader(URL[] urls, ClassLoader parent,
      List<String> systemClasses);  ApplicationClassLoader(String classpath, ClassLoader parent,
      List<String> systemClasses); @Override URL getResource(String name); @Override Class<?> loadClass(String name); static boolean isSystemClass(String name, List<String> systemClasses); static final String SYSTEM_CLASSES_DEFAULT; }