Sys.java: Don't use reflection to create platform specific implementations

This commit is contained in:
Elias Naur 2007-01-17 12:49:20 +00:00
parent 4a1b565c74
commit 7742185e34

View file

@ -111,27 +111,14 @@ public final class Sys {
String class_name;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_LINUX:
class_name = "org.lwjgl.LinuxSysImplementation";
break;
return new LinuxSysImplementation();
case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.WindowsSysImplementation";
break;
return new org.lwjgl.WindowsSysImplementation();
case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.MacOSXSysImplementation";
break;
return new org.lwjgl.MacOSXSysImplementation();
default:
throw new IllegalStateException("Unsupported platform");
}
try {
Class impl_class = Class.forName(class_name);
return (SysImplementation)impl_class.newInstance();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
/**