Hi,
Using B4J 9.5 (64 Bit)
I am getting an error:
Peek (ClassCastException) java.lang.ClassCastException: class [F cannot be cast to class [I ([F and [I are in module java.base of loader 'bootstrap')
I am getting this error when I compile for release or I am in debug with NO break points.
As soon as I add one break point even though it is not being hit the error does not occur:
No Break Point or release mode
		
		
	
	
		 
	
With Break Point:
		 
	
The function is contained within a standard class and is being called from a timer.
I have seen this error in other situations.
The function where the error is occurring is:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The full error stack without the try statement is:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I tried putting a sleep() in the code irrationally thinking that might help, bit it didn't.
I don't remember seeing this happen in older versions of B4j, but I can't be sure about this.
The problem is that as soon as I try to debug it with a break-point the error does not occur.
Does anyone know what is happening?
 
Regards
Rob
PS Additional:
If I make the code more efficient:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The problem goes away.
Strange
			
			Using B4J 9.5 (64 Bit)
I am getting an error:
Peek (ClassCastException) java.lang.ClassCastException: class [F cannot be cast to class [I ([F and [I are in module java.base of loader 'bootstrap')
I am getting this error when I compile for release or I am in debug with NO break points.
As soon as I add one break point even though it is not being hit the error does not occur:
No Break Point or release mode
With Break Point:
The function is contained within a standard class and is being called from a timer.
I have seen this error in other situations.
The function where the error is occurring is:
			
				Circular Buffer Peek Function:
			
		
		
		'============================================================================================
' Examine the data at a place relative to the tail and return the value in data
' Data is not removed from buffer. If look ahead counter <= 0 or > current size
' then all entries are returned
public Sub cbuf_peek(look_ahead_counter As Int) As List
    Dim pos As Int
    Dim outList As List
    outList.Initialize
  
    Dim data(noFields) As Int
      
    'We can't look beyond the current buffer size
    If  cbuf_empty Then
        Return outList
    End If
    If look_ahead_counter > cbuf_size Or look_ahead_counter < 0 Then
        look_ahead_counter = cbuf_size
    End If
    pos = tail
    For k = 0 To look_ahead_counter
        pos = advance_headtail_value(pos)
    Next
  
    #IF MIN_LOGGING_ON Or LOGGING_ON
    Log(" Peek: Pos - 1  = " & (pos - 1) & " Cbuf Size = " &  cbuf_size & "  List Size = " & buffer.Size)
    #End If
  
    Try 
        data =     buffer.Get(pos - 1)
        outList.Add(data)
    Catch
        Log("Peek " & LastException)
    End Try 
    Return outList
End SubThe full error stack without the try statement is:
			
				Error:
			
		
		
		Waiting for debugger to connect...
Program started.
IPC: My ip is: 192.168.1.114
mcuClient Line 693(SQLiteException) org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (table cmdList already exists)
Cmd Timer - Tick .......
CMD_NULL Processed OK Nt =   Time 14-44-32
Cmd Timer - Tick .......
CMD_NULL Processed OK Nt =   Time 14-44-37
Cmd Timer - Tick .......
CMD_NULL Processed OK Nt =   Time 14-44-43
processPersistantCommands = True
Get temp control Vars
Packet Header No Recs = 20  No Recs Max Per Packet = 71
 Peek: Pos - 1  = 19 Cbuf Size = 20  List Size = 20
Error occurred on line: 399 (circBuffVars)
java.lang.ClassCastException: class [F cannot be cast to class [I ([F and [I are in module java.base of loader 'bootstrap')
    at b4j.shortBridgeMinLogging.circbuffvars._cbuf_peek(circbuffvars.java:218)
    at b4j.shortBridgeMinLogging.mcuproccmd._logtuningvarsfromcircbuffer(mcuproccmd.java:724)
    at b4j.shortBridgeMinLogging.mcuproccmd$ResumableSub_processTempTuningVars.resume(mcuproccmd.java:2022)
    at b4j.shortBridgeMinLogging.mcuproccmd._processtemptuningvars(mcuproccmd.java:1880)
    at b4j.shortBridgeMinLogging.mcuproccmd$ResumableSub_mcu_retData.resume(mcuproccmd.java:475)
    at b4j.shortBridgeMinLogging.mcuproccmd._mcu_retdata(mcuproccmd.java:202)
    at b4j.shortBridgeMinLogging.mcuclient._tcpstream_newdata(mcuclient.java:3312)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$2.run(BA.java:250)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)I tried putting a sleep() in the code irrationally thinking that might help, bit it didn't.
I don't remember seeing this happen in older versions of B4j, but I can't be sure about this.
The problem is that as soon as I try to debug it with a break-point the error does not occur.
Does anyone know what is happening?
Regards
Rob
PS Additional:
If I make the code more efficient:
			
				Peek:
			
		
		
		    Try   
        outList.Add(buffer.Get(pos - 1))
    Catch
        Log("Peek " & LastException)
    End TryThe problem goes away.
Strange
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		