How to create custom warning in Eclipse for a standard Java API -


i want eclipse warn use of old date/calendar api in java project, allowing java 8 brand new date-time api 1 beeing used in source.

how can configure eclipse display warning if, example, java.util.date used?

i happly accept additional comments on approach, other alternatives. aware should apply type of validation in ci build, java policy might alternative.

you can add access rule project causes eclipse show warning when class used. right-click on project -> properties -> java build path -> libraries. expand jre system library (since target class java.util.date) , select access rules, click on edit.

enter image description here

in shown dialog, click add , fill in resolution (e.g. discouraged generate warning) , pattern match. in case, pattern java/util/date.

another alternative write custom annotations , use java annotation processing api (jsr269) process them generate warning. require annotate places in code use class.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -