Make Builders sensitive to @Deprecated annotations 46/85246/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 12 Oct 2019 13:54:37 +0000 (15:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 19 Oct 2019 15:24:39 +0000 (17:24 +0200)
commita03975cd9688cd8ee9df94209e8f90d8decf57a6
tree552bfe2ac81df9d6667c2315645268a30d937c07
parent09eaba934808853fc1e53f9949f990cce9baabdb
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)
(cherry picked from commit 4479cc2e987417218982644ce3815c38019f54c1)
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