Make Builders sensitive to @Deprecated annotations 03/85203/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 12 Oct 2019 13:54:37 +0000 (15:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 18 Oct 2019 11:19:55 +0000 (13:19 +0200)
commit4479cc2e987417218982644ce3815c38019f54c1
tree37bd1ca0e070a7b4a29f2fa632c8451e8c9e4af9
parent7535d00d94c2806aca33842a134e3d8aa2cb8d7d
Make Builders sensitive to @Deprecated annotations

When we are generating a builder for a deprecated type, we need to
consider how it deals with deprecated elements.

There are two scenarios here:

1) status=deprecated -> @Deprecated
In this case it is fair game to produce data, hence the builder
is not deprecated and therefore has @SuppressWarnings("deprecation")

2) status=obsolete -> @Deprecated(forRemoval = true)
In this case the data should not be produced at all, hence
the builder needs to be @Deprecated(forRemoval), too.

We recognize both these conditions and act accordingly. We misue
bug-586 test case to hijack compilation testing.

JIRA: MDSAL-485
Change-Id: I9d08116615cf8c5bdb6a8f4977c9810686618cda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e4ccdeadb4ffddae62860f8d080cb2a391a02f1f)
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/AbstractBuilderTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BaseTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderImplTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/InterfaceTemplate.xtend
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/bug586/foo.yang