文字大小:

xlang5.0更新说明

版本发布2025-04-12 16:32:57




编译器

错误修复

  1. 修复导出 xl 链接库时,如果导出的类基于标准库类时,引用的项目链接时不能找到基类中方法的问题。
  2. 修复了 编译 xsp 动态页面文件时,行号对应不正确的问题。

 

虚拟机

修复和优化

  1. 修复执行字符串 switch 跳转表时 key 泄露的bug。
  2. 修复对使用 xl 链接的匿名类进行重定位时,可能导致 crash 的错误。
  3. 优化栈结构, 降低本地栈用量
  4. gc 策略中增加堆增量判断策略。
  5. 统一所有 Buffer 参数的判断行为。
  6. 修复 Websocket Session 可能造成死锁的问题
  7. 更新 mimetype 表

 


标准库

新内容

 新增 Calendar 类, 用于进行日期时间相关操作, 原型如下:

class Calendar{
    public static const int ERA = 0;
    public static const int YEAR = 1;
    public static const int MONTH = 2;
    public static const int WEEK_OF_YEAR = 3;
    public static const int WEEK_OF_MONTH = 4;
    public static const int DATE = 5;
    public static const int DAY_OF_MONTH = 5;
    public static const int DAY_OF_YEAR = 6;
    public static const int DAY_OF_WEEK = 7;
    public static const int DAY_OF_WEEK_IN_MONTH = 8;
    public static const int AM_PM = 9;
    public static const int HOUR = 10;
    public static const int HOUR_OF_DAY = 11;
    public static const int MINUTE = 12;
    public static const int SECOND = 13;
    public static const int MILLISECOND = 14;
    public static const int ZONE_OFFSET = 15;
    public static const int DST_OFFSET = 16;
    public static const int FIELD_COUNT = 17;
    public static const int SUNDAY = 1;
    public static const int MONDAY = 2;
    public static const int TUESDAY = 3;
    public static const int WEDNESDAY = 4;
    public static const int THURSDAY = 5;
    public static const int FRIDAY = 6;
    public static const int SATURDAY = 7;
    public static const int JANUARY = 0;
    public static const int FEBRUARY = 1;
    public static const int MARCH = 2;
    public static const int APRIL = 3;
    public static const int MAY = 4;
    public static const int JUNE = 5;
    public static const int JULY = 6;
    public static const int AUGUST = 7;
    public static const int SEPTEMBER = 8;
    public static const int OCTOBER = 9;
    public static const int NOVEMBER = 10;
    public static const int DECEMBER = 11;
    public static const int UNDECIMBER = 12;
    public static const int AM = 0;
    public static const int PM = 1;
    public static const int ALL_STYLES = 0;
    public static const int STANDALONE_MASK = 0x8000;
    public static const int SHORT = 1;
    public static const int LONG = 2;
    public static const int NARROW_FORMAT = 4;
    public static const int NARROW_STANDALONE = 0x8004;
    public static const int SHORT_FORMAT = 1;
    public static const int LONG_FORMAT = 2;
    public static const int SHORT_STANDALONE = 0x8001;
    public static const int LONG_STANDALONE = 0x8002;
    
    public static Calendar getInstance();
    public static Calendar getInstance(int zoneOffset);
    
    public Calendar();
    public void setTimeInMillis(long millis);
    public long getTimeInMillis();
    public int get(int field);
    public void set(int field, int value);
    public void set(int year, int month, int date);
    public void set(int year, int month, int date, int hourOfDay, int minute, int second);
    public void clear(int field);
    public void clear();
    public int compareTo(Calendar anotherCalendar);
    public void setTimeZoneOffset(int value);
    public int getTimeZoneOffset();
    public String getTime();
    public void setTime(String time, String format);
    public String toString();
};

 

变更内容

Stream 类

增加 read/write/readAllBytes 方法 , 方法原型如下:

   public  final byte read() //读取一个字节
		IllegalArgumentException, 
		IOException, 
		TimeoutException, 
		InterruptedException;

    public  final void write(byte v) //写入一个字节
		IllegalArgumentException, 
		IOException, 
		TimeoutException, 
		InterruptedException;

    public  final byte [] readAllBytes() //读取全部内容, 注意: 内容过大可能抛出 OutofMemoryError 错误
        IllegalArgumentException, 
		IOException, 
		TimeoutException, 
		InterruptedException;

 

 

StreamSocket 类增加了使用 InetAddress 进行连接的方法,原型如下:

public bool connect(InetAddress @address, int timeout)TimeoutException, InterruptedException;

 

 

HttpRequest 类

  1. 新增getResponseHeaderKey方法
  2. putFormField 方法中的参数 fieldName 去掉了 NotNilptr 限制
  3. 修复 post 空 body 时发生阻塞无法返回的问题

 

变更如下

//新增方法
public String getResponseHeaderKey(int n); // 读取响应头 key

//变更前:
public bool putFormField(@NotNilptr String name,@NotNilptr  String fieldName, String fieldType,@NotNilptr  byte [] data);

// 变更后
public bool putFormField(@NotNilptr String name,String fieldName, String fieldType,@NotNilptr  byte [] data);

 

 

XmlObject 类

  1. 修复 asJson 方法转换为 JsonObject 时,某些特定结构无法成功转换的问题。

 

JsonNode 类

asXml 方法增加 rootkey 参数,使其转换为 xml 时可以设置默认key

变更如下

//变更前
XmlObject asXml();

//变更后
XmlObject asXml(String rootKey);

 

HttpServletRequest 类

  1. 新增 setSessionId 支持自定义设置 Session Id
public bool setSessionId(String sessionId);

 

WebSite 类

  1. 新增 guessContentTypeFromName、 getSessionCount、setSessionName、setSessionParam

原型如下

    public static String guessContentTypeFromName(String filename); // 根据文件名获取Mimetype
    public int getSessionCount(); //获取会话数量
    public void setSessionName(String name); //设置Session key
    public void setSessionParam(String param); //设置Session 内容

 

HttpServletResponse 类

  1. 新增 setSessionParam

原型如下

    public void setSessionParam(String param);// 设置当前会话的Sesssion 内容

 

Cipher类

 新增 updateAAD 方法 (变更之前的版本使用 update 处理AAD数据, 变更后提出来作为单独功能)

 init 方法变更为3个参数(增加 key 参数)

 

变更如下

// 新增
public void updateAAD(byte[] data, int pos, int length);


// 变更前
public bool init(int mode, Object initParam);
//变更后
public bool init(int mode, Key key, Object initParam);

 

Key 类

  1. 新增常量RSA_E_3、RSA_E_17、RSA_E_F4、RSA_BITS、RSA_e
  2. translateKey 增加一个参数param

原型如下

// 新增常量
public  static const int RSA_E_3 = 3;  //RSA算法常数E
public  static const int RSA_E_17 = 17;
public  static const int RSA_E_F4 = 0x10001;
public  static const String RSA_BITS = "RSA_bitsLength";
public  static const String RSA_e = "RSA_e";

//变更前
public Key translateKey(Key key);
//变更后
public Key translateKey(Key key, Object param);

 

 

KeyFactory 类

新增方法 generateKey 、 registryKeyFactory

原型如下

public Key generateKey(Key key, Object param);
public static bool registryKeyFactory(String transformation, KeyFactory key);

 

加解密、签名类新增了大量常用算法, 详情点击此处查看.

 


LSP

同步以上更新.

 

第三方库

 

  1. FileStream 包中类去掉了 read 方法,改用 readAllBytes 方法
  2. 修复 xsql 包中的 mysql 库中读取数据时判断数据是否为 NULL的错误
  3. jsengine 包中的 js引擎更换为 quickjs-ng 并完善了 js < - > xlang 的双向调用接口
  4. Qt 库增加部分常用方法并修复了 cef 视图无法响应非ascii按键的问题

 

XStudio

  1. 优化窗口层次和结构
  2. 优化辅助输入功能

 

周边

XStudio for STM32 同步以上更新.

 






上一篇:xlang加解密算法支持说明下一篇:用 xlang 写一个在线反汇编的网站

评论

写评论

点击刷新