You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are historical Java classes which are thread-unsafe, and/or have been superseded.
Those classes should be avoided in regular code. At most one could wrap them in a library, so the gotchas are abstracted away.
Task
Create a linter that analyzes :imports (or even a whole namespace - imports aren't mandatory) finding references to a class blacklist: SimpleDateFormat, URL, GregorianCalendar, DecimalFormat, and etc (research).
Acceptance criteria
Analyzes :imports with different syntaxes
Or better: Uses ns-publics or such to query the currently imported clases
Analyzes whole namespaces (each defn, etc), including metadata
This is necesary (even if querying ns-publics) since code can refer to classes that were not :imported
Semi-related, (def foo (java.text.Collator/getInstance)) is correct but potentially slow in a threaded context because it's a synchronized class. It's better but in a defn.
Context
There are historical Java classes which are thread-unsafe, and/or have been superseded.
Those classes should be avoided in regular code. At most one could wrap them in a library, so the gotchas are abstracted away.
Task
Create a linter that analyzes
:imports
(or even a whole namespace - imports aren't mandatory) finding references to a class blacklist:SimpleDateFormat
,URL
,GregorianCalendar
,DecimalFormat
, and etc (research).Acceptance criteria
:import
s with different syntaxesns-publics
or such to query the currently imported clasesdefn
, etc), including metadatans-publics
) since code can refer to classes that were not:import
edAdditional resources
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html#equals(java.lang.Object)
https://www.callicoder.com/java-simpledateformat-thread-safety-issues/
The text was updated successfully, but these errors were encountered: