Here is a real weird one which had me stumped for quite a while in a much more complex piece of code - the complexity hid the real idiot coding error.
I have netted it down to this:
Spot the idiot error?
If you haven't: it is in the line "junk = 1 Then" - the "Then" should not be there.
But if you look at this under the B4J IDE there is no indication of an error (e.g. I would expect the "Then" to have an underline red squiggle and a red boo-boo message in the log).
If you attempt a Debug compile you get:
in the "Compile and Rapid Debug" window - which isn't real helpful.
If you change the "code" to:
Then everything works as you would expect and the bug is readily apparent.
As I said at the start my real life code was much more complex - and the complexity hid the error.
Does this rank as an IDE bug?
I have netted it down to this:
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Private success_flag As Boolean = True
Private junk As Long
If success_flag = True Then
junk = 1 Then
End If
End Sub
Spot the idiot error?
If you haven't: it is in the line "junk = 1 Then" - the "Then" should not be there.
But if you look at this under the B4J IDE there is no indication of an error (e.g. I would expect the "Then" to have an underline red squiggle and a red boo-boo message in the log).
If you attempt a Debug compile you get:
B4X:
B4J Version: 9.10
Parsing code. (0.00s)
Java Version: 11
Building folders structure. (0.00s)
Compiling code. (0.00s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
B4J line: 18
junk = 1 Then
src\b4j\example\main.java:70: error: ';' expected
_junk = (long) (1)} };
^
1 error
If you change the "code" to:
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Private success_flag As Boolean = True
Private junk As Long
If success_flag = True Then
junk = 1
Then
End If
End Sub
Then everything works as you would expect and the bug is readily apparent.
As I said at the start my real life code was much more complex - and the complexity hid the error.
Does this rank as an IDE bug?