Cannot stop ant from generating compiler Sun proprietary API warnings

前端 未结 6 912
栀梦
栀梦 2020-12-07 01:13

I call javac from my ant script like this:



        
6条回答
  •  抹茶落季
    2020-12-07 01:42

    Recommendation: Don't ignore your compiler's warnings. The warnings are there for a reason. My company's legacy codebase is moving towards a "treat warnings as errors and fail the build" model as we can expend the effort to fix warnings produced during our compile cycle.

    In your case, the warning is:

    warning: sun.reflect.Reflection is Sun proprietary API and may be removed in a future release
    

    It has always been a warning to not import from sun packages as long as I can remember, because they're a non-public API. There's even a FAQ about it on the official Oracle Java site.

    You haven't posted your actual code, so it's hard to provide further recommendations...What are you using in sun.reflect.Reflection that you couldn't also do through something in java.lang.reflect?

提交回复
热议问题