java.lang.LinkageError类的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(139)

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

LinkageError介绍

[英]LinkageError is the superclass of all error classes that occur when loading and linking class files.
[中]LinkageError是加载和链接类文件时发生的所有错误类的超类。

代码示例

代码示例来源:origin: jenkinsci/jenkins

throw (LinkageError)new LinkageError("Failed to resolve "+c).initCause(x);

代码示例来源:origin: jenkinsci/jenkins

private void fireBeforeShutdown(List<Throwable> errors) {
  LOGGER.log(Level.FINE, "Notifying termination");
  for (ItemListener l : ItemListener.all()) {
    try {
      l.onBeforeShutdown();
    } catch (OutOfMemoryError e) {
      // we should just propagate this, no point trying to log
      throw e;
    } catch (LinkageError e) {
      LOGGER.log(Level.WARNING, "ItemListener " + l + ": " + e.getMessage(), e);
      // safe to ignore and continue for this one
    } catch (Throwable e) {
      LOGGER.log(Level.WARNING, "ItemListener " + l + ": " + e.getMessage(), e);
      // save for later
      errors.add(e);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Calls all delegates. */
public void notify(int severity, Throwable t) {
  if (delegates.isEmpty()) {
    if (enterLogger()) return;
    try {
      AnnException ext = AnnException.extras.get(t);
      if (ext != null) {
        t = ext;
      }
      logger().log(convertSeverity(severity, true, OwnLevel.UNKNOWN), t.getMessage(), t);
    } finally {
      exitLogger();
    }
    return;
  }
  try {
    for (ErrorManager em : delegates) {
      em.notify(severity, t);
    }
  } catch (RuntimeException e) {
    // #20467
    e.printStackTrace();
    t.printStackTrace();
  } catch (LinkageError e) {
    // #20467
    e.printStackTrace();
    t.printStackTrace();
  }
}

代码示例来源:origin: neo4j/neo4j

LinkageError error = new LinkageError( "No static field of type sun.misc.Unsafe" );
    error.addSuppressed( e );
    throw error;
throw new LinkageError( "Cannot access sun.misc.Unsafe", e );

代码示例来源:origin: neo4j/neo4j

/**
 * @throws java.lang.LinkageError if the Unsafe tools are not available on in this JVM.
 */
public static void assertHasUnsafe()
{
  if ( unsafe == null )
  {
    throw new LinkageError( "Unsafe not available" );
  }
}

代码示例来源:origin: martin-lizner/trezor-ssh-agent

private void initCoreClasses() throws Exception {
  try {
    libU = User32.INSTANCE;
    libK = Kernel32.INSTANCE;
  } catch (java.lang.UnsatisfiedLinkError | java.lang.NoClassDefFoundError ex) {
    TrayProcess.handleException(ex);
    throw new Exception(ex.toString());
  }
}

代码示例来源:origin: neo4j/neo4j

public T create( InvocationHandler handler )
{
  try
  {
    return constructor.newInstance( handler );
  }
  catch ( Exception e )
  {
    throw new LinkageError( "Failed to create proxy instance", e );
  }
}

代码示例来源:origin: net.java.sezpoz/sezpoz

/**
 * Get the live annotated element.
 * @return a {@link Class}, {@link Method}, or {@link Field}
 * @throws InstantiationException if the class cannot be loaded or there is some other reflective problem
 */
public AnnotatedElement element() throws InstantiationException {
  if (element == null) {
    try {
      Class<?> impl = loader.loadClass(className());
      if (structure.isMethod) {
        element = impl.getMethod(structure.memberName);
      } else if (structure.memberName != null) {
        element = impl.getField(structure.memberName);
      } else {
        element = impl;
      }
      LOGGER.log(Level.FINER, "Loaded annotated element: {0}", element);
    } catch (Exception x) {
      throw (InstantiationException) new InstantiationException(labelFor(resource) + " might need to be rebuilt: " + x).initCause(x);
    } catch (LinkageError x) {
      throw (InstantiationException) new InstantiationException(x.toString()).initCause(x);
    }
  }
  return element;
}

代码示例来源:origin: javaee/glassfish

@Override
  public Object run() {
    LinkageError x = new LinkageError("injection failed on " + cls + " from " + cls.getClassLoader());
    x.initCause(e);
    throw x;
  }
});

代码示例来源:origin: neo4j/neo4j

/**
 * Get the object-relative field offset.
 */
public static long getFieldOffset( Class<?> type, String field )
{
  try
  {
    return unsafe.objectFieldOffset( type.getDeclaredField( field ) );
  }
  catch ( NoSuchFieldException e )
  {
    String message = "Could not get offset of '" + field + "' field on type " + type;
    throw new LinkageError( message, e );
  }
}

代码示例来源:origin: jenkinsci/jenkins

@Override
  public void run() {
    for( Computer c : computers.values() ) {
      try {
        c.interrupt();
        killComputer(c);
        pending.add(c.disconnect(null));
      } catch (OutOfMemoryError e) {
        // we should just propagate this, no point trying to log
        throw e;
      } catch (LinkageError e) {
        LOGGER.log(Level.WARNING, "Could not disconnect " + c + ": " + e.getMessage(), e);
        // safe to ignore and continue for this one
      } catch (Throwable e) {
        LOGGER.log(Level.WARNING, "Could not disconnect " + c + ": " + e.getMessage(), e);
        // save for later
        errors.add(e);
      }
    }
  }
});

代码示例来源:origin: org.netbeans.api/org-openide-util

private static DelegatingErrorManager getDefaultDelegate() {
  DelegatingErrorManager c = new DelegatingErrorManager(""); // NOI18N
  try {
    c.initialize();
    synchronized (ErrorManager.class) {
      if (current == null) {
        current = c;
        // r is not null after c.initialize();
        current.r.addLookupListener(current);
      }
    }
  } catch (RuntimeException e) {
    // #20467
    e.printStackTrace();
    current = c;
  } catch (LinkageError e) {
    // #20467
    e.printStackTrace();
    current = c;
  }
  return current;
}

代码示例来源:origin: io.snappydata/snappydata-store-core

/**
*/
private Object newInstance(Class classObject) {
  try {
    return classObject.newInstance();
  }
  catch (InstantiationException e) {
    report(classObject.getName() + " " + e.toString());
  }
   catch (IllegalAccessException e) {
    report(classObject.getName() + " " + e.toString());
  }
  catch (LinkageError le) {
    report(classObject.getName() + " " + le.toString());
    reportException(le);
  }
  return null;
}

代码示例来源:origin: org.glassfish.hk2/auto-depends

@Override
  public Object run() {
    LinkageError x = new LinkageError("injection failed on " + cls + " from " + cls.getClassLoader());
    x.initCause(e);
    throw x;
  }
});

代码示例来源:origin: neo4j/neo4j

@SuppressWarnings( "unchecked" )
ProxyFactory( Class<T> type ) throws LinkageError
{
  this.type = type;
  try
  {
    this.constructor = (Constructor<? extends T>) Proxy
        .getProxyClass( ConsistencyReporter.class.getClassLoader(), type )
        .getConstructor( InvocationHandler.class );
    instances.put( type, this );
  }
  catch ( NoSuchMethodException e )
  {
    throw new LinkageError( "Cannot access Proxy constructor for " + type.getName(), e );
  }
}

代码示例来源:origin: hawtio/hawtio

e.getMessage());
return;

代码示例来源:origin: pentaho/mondrian

} catch (LinkageError ignored) {
  ignored.printStackTrace();

代码示例来源:origin: io.snappydata/gemfirexd-core

/**
*/
private Object newInstance(Class classObject) {
  try {
    return classObject.newInstance();
  }
  catch (InstantiationException e) {
    report(classObject.getName() + " " + e.toString());
  }
   catch (IllegalAccessException e) {
    report(classObject.getName() + " " + e.toString());
  }
  catch (LinkageError le) {
    report(classObject.getName() + " " + le.toString());
    reportException(le);
  }
  return null;
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

@Override
  public Object run() {
    LinkageError x = new LinkageError("injection failed on " + cls + " from " + cls.getClassLoader());
    x.initCause(e);
    throw x;
  }
});

代码示例来源:origin: neo4j/neo4j

@Override
public void close()
{
  try
  {
    cleanHandle.invoke( cleaner );
  }
  catch ( Throwable throwable )
  {
    throw new LinkageError( "Unable to clean cleaner.", throwable );
  }
}

相关文章