Hello Guest

[FIXED] Compilation Error in Version 2.9.0 of org.lwjgl.LWJGLUtil.java

  • 1 Replies
  • 3912 Views
The following code generates an unresolved variable error:

Code: [Select]
private static String getPathFromClassLoader(final String libname, final ClassLoader classloader) {
  try {
    log("getPathFromClassLoader: searching for: " + libname);
    Class<?> c = classloader.getClass();
    while (c != null) {
      final Class<?> clazz = c;
      try {
        return AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
          public String run() throws Exception {
            Method findLibrary = clazz.getDeclaredMethod("findLibrary", String.class);
   findLibrary.setAccessible(true);
   String path = (String)findLibrary.invoke(classloader, libname);
   return path;
 }
});
      } catch (PrivilegedActionException e) {
        log("Failed to locate findLibrary method: " + e.getCause());
c = c.getSuperclass();
      }
    }
  } catch (Exception e) {
    log("Failure locating " + e + " using classloader:" + c);
  }
  return null;
}

The variable c in the last catch block is undefined.  There is a variable c defined above, but it is scoped to the outer try block and not visible within the catch block.  Without changing the source code, this will never compile.  How does code that cannot compile get into a release distribution?
« Last Edit: September 05, 2013, 09:01:11 by kappa »

*

Offline kappa

  • *****
  • 1315
Re: Compilation Error in Version 2.9.0 of org.lwjgl.LWJGLUtil.java
« Reply #1 on: September 05, 2013, 09:00:40 »
doh, wrongly assumed a tiny tweak patch like that submitted on github could be merged safely, anyway fixed, sorry for the inconvenience.

thx.
« Last Edit: September 05, 2013, 18:27:25 by kappa »