【问题标题】:How to avoid this warning:warning: com.sun.org.apache.regexp.internal.RE is Sun proprietary API and may be removed in a future release如何避免此警告:警告:com.sun.org.apache.regexp.internal.RE 是 Sun 专有 API,可能会在将来的版本中删除
【发布时间】:2011-10-12 05:02:16
【问题描述】:

private static RE _TaskTypeRE = new RE("~:~([0-9]*)~");

这需要import com.sun.org.apache.regexp.internal.RE;

所以在编译时我收到以下警告。

 warning: com.sun.org.apache.regexp.internal.RE is Sun proprietary API and may be removed in a future release
    [javac] import com.sun.org.apache.regexp.internal.RE;

一种解决方案是不使用该类。

另一种解决方案是忽略警告。 如果我想避免这门课,有什么更好的选择。 谢谢

【问题讨论】:

    标签: java


    【解决方案1】:

    如果您需要正则表达式,请使用Pattern class

    private static Pattern p = Pattern.compile("~:~([0-9]*)~");
    

    看看我链接到的 JavaDoc。它可能会有所不同。

    【讨论】:

      猜你喜欢
      • 2013-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-01
      • 2014-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多