Skip to content
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

jcp removes comments even if /r is not specified #24

Closed
ndw opened this issue Sep 23, 2020 · 6 comments
Closed

jcp removes comments even if /r is not specified #24

ndw opened this issue Sep 23, 2020 · 6 comments
Assignees
Labels

Comments

@ndw
Copy link

ndw commented Sep 23, 2020

I've been upgrading some code in a project. It had been using jcp 5.3.2 and when I upgraded to 7.0.3, I discovered that comments were being stripped out even though the "r" option was not specified.

I tried a few versions up to 6.1.4 and confirmed that this behavior first appears in 7.0.0.

@raydac
Copy link
Owner

raydac commented Sep 23, 2020

could you provide example of comments which were removed?
do you use jcp directly or as a plugin for ant/maven/gradle process?

@raydac raydac self-assigned this Sep 23, 2020
@ndw
Copy link
Author

ndw commented Sep 23, 2020

I want to have more than one preprocess step and that doesn't appear (from my position of relative gradle ignorance) to be possible, so I'm just running it directly as a JavaExec step.

I put the attached file (renamed to .txt to make GitHub uploading happy) in /tmp/x/src and run this command:

$ java -jar ~/.gradle/caches/modules-2/files-2.1/com.igormaznitsa/jcp/6.1.4/3cfbec66a0d86bc5b62a8b02e65c6a388c5ed3fc/jcp-6.1.4.jar /c /i:/tmp/x/src /o:/tmp/x/out /p:TEST=false
Java Comment Preprocessor v 6.1.4
Project page: https://github.com/raydac/java-comment-preprocessor
2003-2017 Author: Igor A. Maznitsa (igor.maznitsa@igormaznitsa.com)
[JCP.INFO] -----------------------------------------------------------------
[JCP.INFO] Completed, preprocessed 1 files, copied 0 files, elapsed time 34ms

The resulting file in /tmp/x/out has comments. If I run the same command with version 7:

$ java -jar ~/.gradle/caches/modules-2/files-2.1/com.igormaznitsa/jcp/7.0.3/a23fece25fb6b6764a4e71cdab77b646d73565db/jcp-7.0.3.jar /c /i:/tmp/x/src /o:/tmp/x/out /p:TEST=false
Java Comment Preprocessor v7.0.3a
Project page: https://github.com/raydac/java-comment-preprocessor
Copyright (C) 2002-2020 Igor A. Maznitsa (https://www.igormaznitsa.com)
Base directory: /Users/ndw/.gradle/caches/modules-2/files-2.1/com.igormaznitsa/jcp/7.0.3/a23fece25fb6b6764a4e71cdab77b646d73565db/jcp-7.0.3.jar
[JCP.INFO] File extensions: [htm, txt, java, html] excluded [xml]
[JCP.INFO] -----------------------------------------------------------------
[JCP.INFO] Preprocessed 1 files, copied 0 files, ignored 0 files, elapsed time 29 ms

the resulting file in /tmp/x/out does not have any comments.

SampleClass.txt

@raydac raydac added the bug label Sep 23, 2020
@raydac
Copy link
Owner

raydac commented Sep 23, 2020

yes, you're right, I will fix

@raydac
Copy link
Owner

raydac commented Sep 23, 2020

thanks for the report, exactly the keep comments flag in the pre-processor context was false by default
you can try fixed pre-built version
https://github.com/raydac/java-comment-preprocessor/releases/tag/7.0.4-S

@ndw
Copy link
Author

ndw commented Sep 24, 2020

👍 works for me

@raydac
Copy link
Owner

raydac commented Sep 26, 2020

I made maintenance release 7.0.4 with the fix

@raydac raydac closed this as completed Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants