2011-10-12 33 views
2

private static RE _TaskTypeRE = new RE("~:~([0-9]*)~");如何避免這樣的警告:警告:com.sun.org.apache.regexp.internal.RE是Sun的專有API,並可能在將來的版本

被刪除,這需要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; 

一個解決方案是不使用該類。

另一個解決方案是忽略警告。 如果我想避免這個類是什麼更好的選擇。 謝謝

回答

1

如果您需要正則表達式,請使用Pattern class

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

看看我掛雖然JavaDoc的。它的工作可能不同。

相關問題