Project: SWT
Bug 21706 BidiUtil in win32 has Class.forName() usage
Reported: 2002-07-18 14:40:19 | Status: resolved fixed

Well, kind of. And so what if it does? OK, 2047 has a line in org.eclipse.swt.internal.BidiUtil of: static Callback callback = new Callback (BidiUtil.class, "windowProc", 4); The BidiUtil.class is syntactic sugar for Class.forName("org...BidiUtil"). The problem with this is that method throws a NoClassDefFoundError, which is not defined in the CLDC class libraries, which causes us a little problem in the CLDC version of SWT. You'd only see this problem if you verified or used jxeLink or something; the compiler gens the call itself, and just assumes NoClassDefFoundError is around, so you won't ever get a compiler error from the eclipse compiler (nor Sun's compiler). So, I'd like this changed. Here's the simplest way to change to remove the reflection. - add a private constructor. There are no non-static methods in this class, so actually, this would be a good thing to do anyway. Might as well prevent people from instantiating the class if there's no need to. You're not adding any size, because the compiler gives you a free public constructor anyway. You're just making the contructor private instead of public. - change the line above to: static Callback callback = new Callback (new BidiUtil().getClass (), "windowProc", 4); I haven't tested it, but it should do exactly the same thing.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java