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
As the title says, SniperJavaPrettyPrinter.calculate crashes if the printer is set with Environment.setPrettyPrinterCreatorafter one builds the model. The reason for this is that when building the model, this happens:
I have a use case where I need to collect some information from the model to feed to a printer preprocessor, which one typically sets in the supplier passed to setPrettyPrinterCreator. That's how I encountered this problem. It's easy enough to work around (e.g. by setting a "dummy" sniper printer before building the model), but the crash isn't easy to understand if you don't know too much about Spoon.
Any ideas on a solution? The easy solution would of course be to always attach the change collector, but I don't know what kinds of overhead that would impose on non-sniper use cases.
The text was updated successfully, but these errors were encountered:
Hi,
As the title says,
SniperJavaPrettyPrinter.calculate
crashes if the printer is set withEnvironment.setPrettyPrinterCreator
after one builds the model. The reason for this is that when building the model, this happens:spoon/src/main/java/spoon/support/compiler/jdt/JDTBasedSpoonCompiler.java
Lines 128 to 131 in 55bdd96
And in the call to calculate, the sniper tries to access that change collector (with
getChangeCollector()
:spoon/src/main/java/spoon/support/sniper/SniperJavaPrettyPrinter.java
Line 138 in 55bdd96
I have a use case where I need to collect some information from the model to feed to a printer preprocessor, which one typically sets in the supplier passed to
setPrettyPrinterCreator
. That's how I encountered this problem. It's easy enough to work around (e.g. by setting a "dummy" sniper printer before building the model), but the crash isn't easy to understand if you don't know too much about Spoon.Any ideas on a solution? The easy solution would of course be to always attach the change collector, but I don't know what kinds of overhead that would impose on non-sniper use cases.
The text was updated successfully, but these errors were encountered: