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
At the moment, "JavaParserFacade.get()" IS ""the problem""because
1. it is a GLOBAL/STATIC method
2. it caches ALL type solvers
3. it is used in several places inside the library
4. it is NOT synchronized
I tried to remove it, but I have not implemented this part.
The current ""possible"" solution is
1. to create a JavaParserFacadeFactory that contains the map typesolver -> JavaParserFacade (the current static part of JavaParserFacade inserted in a separated class)
2. to extend TypeSolver with a method "getFactory" that return a JavaParserFacadeFactory >
The call (repeat, used in the library implementation)
In this way, the root typeSolver contains the ""thread-local"" cache of type solvers, and with a minimum impact on the current code. The problem is to change the current typeSolver interface.
But I am not sure.
MysterAitch
added a commit
to MysterAitch/javaparser
that referenced
this issue
May 22, 2020
…get`. Note that this is specifically in response to javaparser#2668 and is not indicative of JavaParser being safe to use within a multi-threaded environment.
In this moment, it is not possible to use JavaSymbolResolver in parallel.
The problem is in JavaParserFacade, in the static method get:
instances is a WeakHashMap but this class is not thread-safe.
It can be enough to convert this method in a "synchronized" method:
The text was updated successfully, but these errors were encountered: