Java Byte interpretation on 10.0.0.2595

Byte was interpreted by Oxygene as unsigned byte. After installing 2595 it is signed byte.

1 Like

This sounds like it could be related to the fixes for Byte comparison in Oxygene - #13 by RemObjectsSoftware. Do you have a concrete tetscase I can have a look at?

I believe that code like this worked previously

class method Main(args: array of String): Int32;
begin
  var i : Byte ;
  
  for i:=0 to 255 do
    writeLn('The magic happens here.');
end;

Now writeLn is never called.

However, I should go back an d Install previous Elements to be sure.

No meed to; it this doesnt work now, its a bug, regardless if previous didn’t too ok or not. i’ve added a note to the re-opened issue.

Indeed. This should be fixed now.

Could you send us build for test?

I’ll send you one later today.

Done.

Marc,

Better but:

type
  T_Test = class
    Value : Byte   ;
  end ;

  Program = class
  public
    class method Main(args: array of String): Int32;
    begin
      var o := new T_Test() ;

      o.Value := $D7;

      case o.Value of
        $D7 : writeln( 'OK' )
        else  writeln( 'BAD' )  // it's bad !!!
      end ;

      var b : Byte ;

      b := $D7;

      case b of
        $D7 : writeln( 'OK' ) // it's OK
        else  writeln( 'BAD' )
      end ;
    end;
  end;
end.

I’ll reopen the issue.

Additional strange case - but this time minor

class method Main(args: array of String): Int32;
begin
  var b : Byte ;
  var i : Integer ;
  
  b := 200 ;
  
  i := 2 * b ;
  assert( i=400 ); //OK

  i := Integer(b) + Integer(b) ;
  assert( i=400 ); //OK
  
  i := b + b ;
  assert( i=400 ); //BAD?
end;

Added to the issue, thanx.

so this one:

begin
  var b : Byte ;
  var i : Integer ;
  
  b := 200 ;
  
  i := 2 * b ;
  assert( i=400 ); //OK

  i := Integer(b) + Integer(b) ;
  assert( i=400 ); //OK
  
  i := b + b ;
  assert( i=400 ); //BAD?
end;

The first case: b is a byte, 2 defaults to int. Thats why it works. The last case byte+ byte = byte and it ends up as a negative number.

Bit inconsistent with Oxygene->NET (test succeeded on non-Java)

The problem I believe is that Java has there Byte class type with is signed… but I’ll look @ck in for further thoughts next week.

hrmm you are right that is odd. I’ll take a look. again. The trick here is that java doesn’t actually support unsigned types no.

1 Like

Thanks, logged as bugs://85484

Let me log an issue so i don’t lose track of this

Hi
Any news about this issue? Can Byte-SByte compatibility be restored like in the previous stables (that we used) or maybe we could use a compiler directive to have a switch if you cannot merge both sides (other issues related to SByte)?

I bumped the priority up.

1 Like