-
-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException when using Spoon #1191
Comments
I'm not sure to understand your problem here: if you deleted the file CatchProcess.java and you use it in your program it seems natural that you've an error, no? Or do I miss something? |
I compiled CatchProcess.java and got CatchProcess.class. |
You're right, you don't need it to run Spoon if it's already compiled. I assume you're using a command line like that to run spoon: Then what's your input project (-i argument)? |
My input project is MapReduce framework source code (in a different dir from the dir of CatchProcess.java). At the beginning, I tried to launch spoon inside the main function. But it throws above NPE error. How can I launch spoon only with the generated class files? |
The easiest way is certainly to use the maven plugin: https://github.com/SpoonLabs/spoon-maven-plugin You can also get the jar-with-dependencies from the latest release: https://github.com/INRIA/spoon/releases/download/spoon-core-5.5.0/spoon-core-5.5.0-jar-with-dependencies.jar and to call it specifying in the classpath, the path of your compiled processor:
|
Thanks for the reply. Another thing is: I try to replace a method parameter (add one more parameter). |
There's also a gradle plugin for Spoon: https://github.com/SpoonLabs/spoon-gradle-plugin :)
We assume in our example that you created and installed a maven/gradle project locally containing your processor: basically you create a maven project with your new processor and necessary dependencies, and you locally install it with
You should be able to do it by using the |
Very cool! My task is to add parameter to existing methods and keep all other things the same.
Thanks again for your help. |
Actually you should have another file for the second class in the output. If you want to keep the same CompilationUnit you can use the following option:
with value "compilationunits".
I did not understand your question there: if I execute your code, currently nothing happens during the substition, I obtain exactly the same print method. What do you want to do there? |
Hi, I use spoon 5.5.0 under Ubuntu with jvm7. The experiment I did is:
Everything works well.
But if I delete the generated spooned dir and CatchProcess.java, NPE is thrown as following:
The text was updated successfully, but these errors were encountered: