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

LexicalPreservingPrinter throws UnsupportedOperationException when removing comments #2024

Closed
JustinKissling opened this issue Jan 14, 2019 · 0 comments

Comments

@JustinKissling
Copy link
Contributor

JustinKissling commented Jan 14, 2019

Hi,
Whenever I try to delete a line or block comment while using the LexicalPreservingPrinter, I get an UnsupportedOperationException. Javadoc comments seem to work fine.

Example:

        FileInputStream in = new FileInputStream(path);
        CompilationUnit compilationUnit = LexicalPreservingPrinter.setup(JavaParser.parse(in));
		
		List<Comment> comments = compilationUnit.getAllContainedComments();
		
		for (Comment comment : comments) {
			// throws UnsupportedOperationException unless it's a Javadoc comment
			comment.remove();
		}
@JustinKissling JustinKissling changed the title LexicalPreservationPrinter throw UnsupportedOperationException when removing comments LexicalPreservationPrinter throws UnsupportedOperationException when removing comments Jan 14, 2019
@JustinKissling JustinKissling changed the title LexicalPreservationPrinter throws UnsupportedOperationException when removing comments LexicalPreservingPrinter throws UnsupportedOperationException when removing comments Jan 14, 2019
matozoid added a commit that referenced this issue Feb 13, 2019
Fixed issue #2024, can now remove line and block comments with LexicalPreservingPrinter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants