java - Forbid developer to use some API in Eclipse -


do have plugin/way in eclipse forbids(show error/warning) while using method. in code, want way confirm system.currenttimemillis() / calendar.getinstance() not being called if tries use this, eclipse should show error.

thanks ankush

you write own findbugs plugin relies on findbugs api provide metadata method invocations (among other opcodes found in bytecode). you'll need implement custom bytecodescanningdetector can verify if operation involves execution of set of banned apis (system.currenttimemillis() , calendar.getinstance()) in case.

here's tutorial started on writing findbugs plugin. can use plugin in eclipse, preferable run in ci server part of build.

you may find other static analysis tools pmd may have same features, exposed using own apis.

also, if want run part of build, can delegate these checks sonar, allows easy construction of architectural rules these. note - haven't tried on methods, , i'd warn sonar architectural constraints appear better suited when want ban entire class usages instead of method usages.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -