LWJGL Forum

Archive => Resolved Bugs/RFE => Topic started by: mbmast on September 04, 2013, 22:53:09

Title: [FIXED] Compilation Error in Version 2.9.0 of org.lwjgl.LWJGLUtil.java
Post by: mbmast on September 04, 2013, 22:53:09
The following code generates an unresolved variable error:


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?
Title: Re: Compilation Error in Version 2.9.0 of org.lwjgl.LWJGLUtil.java
Post by: kappa 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.