-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
Renaming the package name, is creating a compilation issue #1522
Comments
Could you give us more insight on the way you're renaming the package: what is the exact context of this piece of code: (element instanceof CtPackage){
((CtPackage) element).setSimpleName("newtest");
} I tried to reproduce your issue but without success yet. What version of Spoon do you use? |
Hello @surli I am using this maven repository core
I am parsing the file, and i wanted to change the package name for example Src Input file
The processor which I wrote to process the .java file is:
The output after the process should be The final output of the folder package should be src/main/java/newtest/App.java --> package newtest But the output in the App.java file is occurring as
With PACKAGE_SEPERATOR '.' before as shown above. Which is creating the compilation issue. I hope I was able to explain my requirement. Your insights would help in understanding if I am missing something here. Regards |
Ok it might be a bug in Spoon but you can already fix it in So in if(element instanceof CtPackage){ use: if(element instanceof CtPackage && element != getFactory().Package().getRootPackage()){ |
Hello,
Please find the below code
I am parsing the code using spoon, and I am trying to change the name of the package app
The output of the code is occurring as:
There is PACKAGE_SEPERATOR '.' added before the package. I am not sure if this is the correct way of renaming the package for a class.
Regards
Sourabh
The text was updated successfully, but these errors were encountered: