Java – Does removing comments cause runtime crashes?

Does removing comments cause runtime crashes?… here is a solution to the problem.

Does removing comments cause runtime crashes?

The following libraries are causing conflicts in my project, so I have to delete them.

compile ‘org.glassfish:javax.annotation:10.0-b28’

If you remove

this dependency, you must remove these comments from your project.

@Generated(“org.jsonschema2pojo”)

So far, it has had no effect on runtime and compile time.

But I need to confirm this. I googled this but I still have some confusion.

  • Do these annotations have an effect on the code?
    I know they have to do it, that’s why we added them, but what is the impact.

  • Will removing these have any slight or significant effects on the runtime? It does not give any warning or error messages at compile time.

Solution

This depends on the type of annotation you use. In your case, @Generated is just a markup comment to indicate that this code is automatically generated. Removing it will have no effect on the behavior of your code.

Take @Autowired annotation as an example, this annotation is used to inject objects, and removing it will definitely have an impact.

Related Problems and Solutions