bugGNU Octave - Bugs: bug #60396, Java Methods expecting native java...

 
 

bug #60396: Java Methods expecting native java char type input cannot be used

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Wed 14 Apr 2021 08:29:25 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  None Assigned to:  None
Originator Name:  Tasos Papastylianou Open/Closed:  * Open
Release:  * 6.2.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 24 Nov 2021 10:48:07 AM UTC, comment #1: 

I think this issue needs a fix or walkaround.  Many open source api cannot be used because of this.  Equivalently, this issue is like one cannot pass 'o' as a marker in plot command in Octave.  I build a simple code to demonstrate the issue:

import java.lang.String;
import java.lang.Integer;
import java.lang.Double;
import java.lang.Character;

public final class test_char {

public test_char() {}

public static Integer case_string(String s) {
Integer ii = 1;
        return ii;
}
public static Double  case_char(Character s){
Double ii = 2.;
        return ii;
}
}
/**

I think this issue needs a fix or walkaround.  Many open source api cannot be used because this.  Equivalently, this issue is like one cannot pass 'o' as a marker in plot command.  I build a simple code to demonstrate this issue:

The observations are:
(1) 'o' and javaObject('java.lang.String', 'o') are both passed to this java code as string
(2) No solution to create a java character. 


>> javaMethod('case_string', 'test_char', javaObject('java.lang.String', 'o'))

ans = 1

>> javaMethod('case_string', 'test_char', 'o')

ans = 1

>> javaMethod('case_char', 'test_char', 'o')

error: [java] java.lang.NoSuchMethodException: case_char

>> javaObject('java.lang.Character', '1')

error: [java] java.lang.NoSuchMethodException: java.lang.Character

(file #52336, file #52337)

Liang Tang <lt1234>
Wed 14 Apr 2021 08:29:25 PM UTC, original submission:  

If a java method expects a 'char' input (i.e. a 'java char' type, not an octave 'char'), it is impossible to call it with valid input.

Example:


dfs = javaObject ( 'java.text.DecimalFormatSymbols' )
dfs.setDecimalSeparator( '.' )


I assume this is because octave treats '.' as a string and passes it to java as a string object? Or something along those lines?

There are a couple of other bugs in the bug tracker here involving java and chars, but these seem to mostly relate to conversions from java outputs, not the inability to pass a 'java char value'.

Tasos Papastylianou <tpapastylianou>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #52336:  test_char.java added by lt1234 (1KiB - application/octet-stream)
file #52337:  test_char.jar added by lt1234 (783B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lt1234 (Updated the item)
  • -email is unavailable- added by tpapastylianou (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-24 lt1234 Attached File- Added test_char.java, #52336
        Attached File- Added test_char.jar, #52337

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code