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.

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
Post a Comment