Could removing an annotation cause a runtime crash?

The following library is causing conflicts in my project, so I need to remove it.

compile 'org.glassfish: javax.annotation: 10.0-b28'

If I remove this dependency, then I have to remove these annotations from the project.

@generated ("org.jsonschema2pojo")

It does not currently affect startup and compilation times.

But I need confirmation about this. I've been looking for this, but I still have some confusion.

  • Do these annotations mean any impact on the code? I know they should, so we add them, but what an impact.

  • Deleting this data could result in minor or major impact at runtime? As with compile-time, it did not issue any warnings or error messages.

+3


source to share


2 answers


It won't be affected. This annotation uses the source code of the label that was generated. From the document.

The generated annotation is used to refer to the source code that has been generated.



Use javax annotation

Also, you don't need to have a dependency org.glassfish:javax.annotation:10.0-b28

to use the annotation @Generated

. It is included in the javax packages. Just import javax.annotation.Generated;

and you don't have to remove the annotation.

+1


source


It depends on the type of annotation used. In your case @Generated

, this is just a marker annotation used to indicate that a piece of code has been auto-generated. Removing this will not affect the behavior of your code.



Take annotation as an example @Autowired

, this annotation is used to inject an object, deleting which will certainly have consequences.

+2


source







All Articles