本文整理了Java中java.lang.ClassLoader.resolveClass()
方法的一些代码示例,展示了ClassLoader.resolveClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassLoader.resolveClass()
方法的具体详情如下:
包路径:java.lang.ClassLoader
类名称:ClassLoader
方法名:resolveClass
[英]Forces a class to be linked (initialized). If the class has already been linked this operation has no effect.
Note: In the Android reference implementation, this method has no effect.
[中]强制链接(初始化)类。如果类已链接,则此操作无效。
注意:在Android参考实现中,此方法无效。
代码示例来源:origin: spotbugs/spotbugs
private Class<?> findClass(@DottedClassName String name, byte [] b) {
try {
if (TypeQualifierValue.DEBUG_CLASSLOADING) {
System.out.println("Loading " + b.length + " bytes for class " + name);
}
Class<?> result = defineClass(name, b, 0, b.length);
super.resolveClass(result);
if (TypeQualifierValue.DEBUG_CLASSLOADING) {
System.out.println("defined class " + name);
}
return result;
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
}
代码示例来源:origin: stackoverflow.com
if( resolve ) resolveClass(c);
if( listener != null ) listener.classLoaded(c);
return c;
代码示例来源:origin: stackoverflow.com
resolveClass(c);
代码示例来源:origin: org.actframework/act
public Class<?> defineClass(String name, byte[] b, int off, int len, boolean resolve) {
Class<?> c = super.defineClass(name, b, off, len, DOMAIN);
if (resolve) {
super.resolveClass(c);
}
return c;
}
代码示例来源:origin: org.drombler.acp/drombler-acp-core-commons
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class<?> clazz = (parent == null) ? findClass(name) : super.loadClass(name, false);
if (resolve) {
super.resolveClass(clazz);
}
return clazz;
}
}
代码示例来源:origin: net.imglib2/imglib2
private Class< ? > bytesToClass( final String className, final byte[] bytes )
{
final Class< ? > copiedClass = super.defineClass( className, bytes, 0, bytes.length );
super.resolveClass( copiedClass );
return copiedClass;
}
}
代码示例来源:origin: stackoverflow.com
public class AgentClassLoader extends ClassLoader
{
public void loadThisClass(ClassByte classByte_)
{
resolveClass(defineClass(classByte_.getName(),
classByte_.getBytes(),
0,
classByte_.getBytes().length));
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.osgi
protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class clazz = (parent == null) ? findClass(name) : super.loadClass(name, false);
if (resolve)
super.resolveClass(clazz);
return clazz;
}
}
代码示例来源:origin: org.apache.openjpa/openjpa-osgi
protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class clazz = (parent == null) ? findClass(name) : super.loadClass(name, false);
if (resolve)
super.resolveClass(clazz);
return clazz;
}
代码示例来源:origin: actframework/actframework
public Class<?> defineClass(String name, byte[] b, int off, int len, boolean resolve) {
Class<?> c = super.defineClass(name, b, off, len, DOMAIN);
if (resolve) {
super.resolveClass(c);
}
return c;
}
代码示例来源:origin: contra/JMD
public Class<?> loadClass(String name, byte[] crap) {
//name = name.substring(0, name.lastIndexOf('.'));
Class c = null;
try {
//c = super.defineClass(crap, 0, crap.length);
c = super.defineClass(name, crap, 0, crap.length);
} catch (Exception e) {
return c;
}
super.resolveClass(c);
return c;
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.commons.classloader
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class<?> clazz = this.findClass(name);
if (resolve) {
super.resolveClass(clazz);
}
return clazz;
}
}
代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.component
protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class clazz = (parent == null) ? findClass(name) : super.loadClass(name, false);
if (resolve)
super.resolveClass(clazz);
return clazz;
}
}
代码示例来源:origin: imglib/imglib2
private Class< ? > bytesToClass( final String className, final byte[] bytes )
{
final Class< ? > copiedClass = super.defineClass( className, bytes, 0, bytes.length );
super.resolveClass( copiedClass );
return copiedClass;
}
}
代码示例来源:origin: ca.eandb.util/eandb-util
@Override
protected Class<?> findClass(final String name) throws ClassNotFoundException {
ByteBuffer def = AccessController.doPrivileged(new PrivilegedAction<ByteBuffer>() {
public ByteBuffer run() {
return strategy.getClassDefinition(name);
}
});
if (def != null) {
Class<?> result = super.defineClass(name, def, null);
if (result != null) {
super.resolveClass(result);
return result;
}
}
throw new ClassNotFoundException(name);
}
代码示例来源:origin: bioinformatics-ua/dicoogle
public Class defineClass(byte[] b)
{
Class c = defineClass(null, b, 0, b.length);
//System.out.println(c.getName().substring(0, c.getName().lastIndexOf('.')));
//super.definePackage(c.getPackage().getName(), c.getPackage().getSpecificationTitle(), c.getPackage().getSpecificationVersion(), c.getPackage().getSpecificationVendor(),
// c.getPackage().getImplementationTitle(), c.getPackage().getImplementationVersion(), c.getPackage().getImplementationVendor(), null);
super.resolveClass(c);
//System.out.println(c.getClassLoader().toString());
return c;
/* try
{
this.loadClass(c.getName());
System.out.println(c.getName());
} catch (ClassNotFoundException ex)
{
LoggerFactory.getLogger(ServerOptions.class).error(ex.getMessage(), ex);
}*/
}
}
代码示例来源:origin: com.google.code.findbugs/findbugs
private Class<?> findClass(@DottedClassName String name, byte [] b) {
try {
if (TypeQualifierValue.DEBUG_CLASSLOADING) {
System.out.println("Loading " + b.length + " bytes for class " + name);
}
Class<?> result = defineClass(name, b, 0, b.length);
super.resolveClass(result);
if (TypeQualifierValue.DEBUG_CLASSLOADING) {
System.out.println("defined class " + name);
}
return result;
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
}
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-server
void makeProxyType(ProxyCompiler compiler)
throws Exception
{
this.compiler = compiler; // temporary, for use during loading
byte code[] = compiler.getCode();
compiler.proxyType = super.defineClass(compiler.getProxyClassName(), code, 0, code.length);
super.resolveClass(compiler.proxyType);
// set the Foo$Impl.info pointer to myself
Field field = compiler.proxyType.getField(RUNTIME_FN);
field.set(null, this);
compiler = null;
}
代码示例来源:origin: stackoverflow.com
resolveClass(c);
System.out.println("Steve I am loading another copy of Dummy class. Soon Permgen will fill.");
return c;
代码示例来源:origin: stackoverflow.com
resolveClass(c);
return c;
内容来源于网络,如有侵权,请联系作者删除!