Bug? Orphan Case

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Good day

I ran into a problem, B4J 3.70 cannot compile this line

example:
B4X:
Select j
Case 0,1
End Select

the compile error is the follow:

B4J version: 3.70
Parsing code. (0.06s)
Compiling code. (0.15s)
Compiling layouts code. (0.01s)
Compiling generated Java code. Error
B4J line: 496
Select j
javac 1.8.0_60
src\b4j\example\patient.java:1462: error: orphaned case
case 1: {
^
1 error

if it is going to take some time to fix or may be i am just crazy, may i have the Link for B4J 3.61? i did not backed up the installer
 
Last edited:

BeneBarros

Active Member
Licensed User
Longtime User
also I had this problem. I changed my routine.

but try quoting

Case "0", "1"

I believe that works
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
I tried BeneBarros solution i found that the only Bug (known) is for the 1 and not for the "," or any other integer. it only happens when 1 is present with ",".
 

Daestrum

Expert
Licensed User
Longtime User
if you make the variable for the select an object it will work
ie,
This code won't work
B4X:
dim I as int = 4
select I
  case 1,2,3: doSomething()
  case ...
  ....
end select
but this will
B4X:
dim I as int = 4
dim II as object = I
select II
   case 1,2,3: doSomething()
   case ....
   ...
end select

In the first snippet the generated src code is incorrect
B4X:
case 3: {
RDebugUtils.currentLine=65546;
 //BA.debugLineNum = 65546;BA.debugLine="Case 3:Log(\"3\")";
anywheresoftware.b4a.keywords.Common.Log("3");
 break; }
case 4: {
case 5: {
case 6: {
 
Last edited:
Top