java.lang.ClassLoader.setDefaultAssertionStatus()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中java.lang.ClassLoader.setDefaultAssertionStatus()方法的一些代码示例,展示了ClassLoader.setDefaultAssertionStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassLoader.setDefaultAssertionStatus()方法的具体详情如下:
包路径:java.lang.ClassLoader
类名称:ClassLoader
方法名:setDefaultAssertionStatus

ClassLoader.setDefaultAssertionStatus介绍

[英]Sets the default assertion status for this class loader.

Note: This method does nothing in the Android reference implementation.
[中]设置此类加载器的默认断言状态。
注意:此方法在Android参考实现中不起任何作用。

代码示例

代码示例来源:origin: PipelineAI/pipeline

public void setDefaultAssertionStatus(boolean enabled) {
  delegate.setDefaultAssertionStatus(enabled);
}

代码示例来源:origin: apache/nifi

@Override
public void setDefaultAssertionStatus(boolean enabled) {
  lookupClassLoader().setDefaultAssertionStatus(enabled);
}

代码示例来源:origin: apache/geode

@BeforeClass
public static void setUpOnce() {
 try {
  assert false;
  assertionsEnabled = false;
 } catch (AssertionError e) {
  assertionsEnabled = true;
 }
 ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
 System.out.println("assertionsEnabled = " + assertionsEnabled);
}

代码示例来源:origin: apache/geode

@AfterClass
public static void tearDownOnce() {
 ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(assertionsEnabled);
}

代码示例来源:origin: stackoverflow.com

parent.setDefaultAssertionStatus(enabled);

代码示例来源:origin: stackoverflow.com

ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);

代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core

@Override
public synchronized void setDefaultAssertionStatus(boolean enabled) {
  for (ClassLoader classloader : classLoaders) {
    classloader.setDefaultAssertionStatus(enabled);
  }
}

代码示例来源:origin: com.atlassian.plugins.rest/atlassian-rest-module

@Override
public synchronized void setDefaultAssertionStatus(boolean enabled) {
  for (ClassLoader classloader : classLoaders) {
    classloader.setDefaultAssertionStatus(enabled);
  }
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata-core

@Override
public synchronized void setDefaultAssertionStatus(boolean enabled) {
  for (ClassLoader cl : classLoaders) {
    cl.setDefaultAssertionStatus(enabled);
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.com.kjetland/gt-engine

@Override
public void setDefaultAssertionStatus(boolean b) {
  super.setDefaultAssertionStatus(b);
}

代码示例来源:origin: DirectProject/nhin-d

/**
 * {@inheritDoc}
 */
@Override
public synchronized void setDefaultAssertionStatus(boolean arg0) 
{
  for(ClassLoader loader : classLoaders)
    loader.setDefaultAssertionStatus(arg0);
  
  for(ClassLoader loader : resourceLoaders)
    loader.setDefaultAssertionStatus(arg0);
}

代码示例来源:origin: stackoverflow.com

public class AssertionBaseTest {
  static {
    //static block gets inherited too
    ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
  }
}

代码示例来源:origin: stackoverflow.com

import ....
public class TestXX....
...
  static {
    ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
  }
  ...
  @Test(expected=AssertionError.class)
  ...
...

代码示例来源:origin: stackoverflow.com

public class Activator implements BundleActivator {

  @Override
  public void start(BundleContext bundleContext) throws Exception {
    getClass().getClassLoader().setDefaultAssertionStatus(true);
  }

  @Override
  public void stop(BundleContext context) throws Exception {
  }
}

代码示例来源:origin: stackoverflow.com

boolean enabled = false;
  ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
  assert enabled = true;
  System.out.println("Asserts " + 
   (enabled ? "enabled" : "disabled"));

代码示例来源:origin: BruceEckel/OnJava8-Examples

public static void main(String[] args) {
  ClassLoader.getSystemClassLoader()
   .setDefaultAssertionStatus(true);
  new Loaded().go();
 }
}

代码示例来源:origin: org.ow2.jonas/jonas-commons

/**
 * @see java.lang.ClassLoader#setDefaultAssertionStatus(boolean)
 */
public synchronized void setDefaultAssertionStatus(boolean enabled) {
  getContextClassLoader().setDefaultAssertionStatus(enabled);
}

代码示例来源:origin: org.objectweb.jonas/jonas-commons

/**
 * @see java.lang.ClassLoader#setDefaultAssertionStatus(boolean)
 */
public synchronized void setDefaultAssertionStatus(boolean enabled) {
  getContextClassLoader().setDefaultAssertionStatus(enabled);
}

代码示例来源:origin: org.apache.openjpa/openjpa-osgi

/**
 * Sets the default assertion status for this class loader.
 *
 * @see ClassLoader#setDefaultAssertionStatus(boolean)
 */
@Override
public synchronized void setDefaultAssertionStatus(boolean enabled) {
  for (ClassLoader classLoader : getClassLoaders()) {
    classLoader.setDefaultAssertionStatus(enabled);
  }
}

代码示例来源:origin: org.jboss.ironjacamar/ironjacamar-core-impl

/**
* {@inheritDoc}
*/
@Override
public void setDefaultAssertionStatus(boolean enabled)
{
 if (resourceAdapterClassLoader != null)
   resourceAdapterClassLoader.setDefaultAssertionStatus(enabled);
 super.setDefaultAssertionStatus(enabled);
}

相关文章