Bug? java.lang.IllegalArgumentException: Can not set static anywheresoftware.b4j.objects.MenuItemWrapper$

EJLib

Member
Licensed User
Longtime User
In B4J, I added some lines of code and the breakpoints began acting strangely. The program would stop on the expected line and highlight it, but while single stepping (F8), the highlighting disappears.

I used undo to delete the lines of code and removed my break point and re-ran the program getting this error which points to a completely different part of the code right after AppStart:

java.lang.IllegalArgumentException: Can not set static anywheresoftware.b4j.objects.MenuItemWrapper$ConcreteMenuItemWrapper field b4j.example.main._mnulogin to anywheresoftware.b4j.objects.MenuItemWrapper

I upgraded to the latest B4J and that fixed the problem for a while. But, after adding a couple hundred more lines of code, the problem is back. Rebooting and reinstalling B4J didn't fix it this time. The program is about 5000 lines of code and comments.

Any suggestions?

Thanks,
Eric
 

EJLib

Member
Licensed User
Longtime User
You can try to clean the project if it happens (Ctrl + P) and then run again.

Can you post the full error message from the logs?

Ctrl+P didn't solve the problem. Here is the full error message.

Program started.
Error occurred on line: 5461
java.lang.IllegalArgumentException: Can not set static anywheresoftware.b4j.objects.MenuItemWrapper$ConcreteMenuItemWrapper field b4j.example.main._mnulogin to anywheresoftware.b4j.objects.MenuItemWrapper
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeStaticObjectFieldAccessorImpl.set(UnsafeStaticObjectFieldAccessorImpl.java:79)
at java.lang.reflect.Field.set(Field.java:764)
at anywheresoftware.b4a.shell.Shell.setStateBeforeUserSub(Shell.java:379)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:287)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.start(main.java:36)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
at com.sun.javafx.application.LauncherImpl$$Lambda$53/483920725.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl$$Lambda$45/1915503092.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$48/599658954.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/1567581361.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
at com.sun.glass.ui.win.WinApplication$$Lambda$36/1645995473.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
 
Top