Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

java - Suppress javac warning "...is internal proprietary API and may be removed in a future release"

When I compile the Spring JDBC source on OS X with JDK 1.7.0, I get this warning:

warning: CachedRowSetImpl is internal proprietary API and may be removed in a future release

How do I suppress the warning message during a compile?

I already know and use Java's @SuppressWarning annotations. I'm looking for the specific use of this to suppress the warning I've described.

My question specifically is, in this line of code:

@SuppressWarnings("valuegoeshere")

what should "valuegoeshere" be replaced with?

EDIT: People, I know that it is best to avoid the code that leads to the warning. And usually that would be my approach. However I'm compiling third-party code here which I don't want to rewrite. I just want to add the correct annotation to suppress the warning, so that warnings I can actually do something about don't get buried.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This particular warning cannot be suppressed. At least not officially.

The warning about proprietary API means that you should not use the API which causes the warning. Sun does not support such API and the warning will not be suppressible.

If you're particularly determined, you can use the highly undocumented javac -XDignore.symbol.file flag which will compile your program against Sun's internal rt.jar rather than the public-facing symbol file ct.sym. rt.jar doesn't produce this warning.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...