cushon / issues-import

0 stars 0 forks source link

DepAnn check reports false positive on property that has no deprecation at all #245

Closed cushon closed 9 years ago

cushon commented 9 years ago

Original issue created by jens.nehlmeier on 2014-03-27 at 02:09 PM


What steps will reproduce the problem?

In a JPA Entity class I have:

@OneToOne(fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.ALL, targetEntity = EntityA.class ) @JoinColumn(name = "entityA_id") @Deprecated /**

@OneToOne(fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.ALL, targetEntity = EntityB.class ) @JoinColumn(name = "entityB_id") @Deprecated /**

@OneToMany(mappedBy = "someproperty") private List<EntityC> entityCs;

What is the expected output? What do you see instead?

The expected output would be no error output at all. Instead error-prone's DepAnn checker marks the line

private List<EntityC> entityCs;

as error, saying that a deprecated item is not annotated with @Deprecated. However this property it not deprecated at all.

What version of the product are you using? On what operating system?

IntelliJ 13.1.1 + newest error-prone plugin, Mac OS 10.9.2, Apple Java6 installed to run IntelliJ, project configured to use Oracle JDK 7 (u45 currently).

Please provide any additional information below.

The false positive goes away if I change the ordering of JavaDoc & annotations on entityB property.

@OneToOne(fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.ALL, targetEntity = EntityA.class ) @JoinColumn(name = "entityA_id") @Deprecated /**

/**

@OneToMany(mappedBy = "someproperty") private List<EntityC> entityCs;

cushon commented 9 years ago

Original comment posted by eaftan@google.com on 2014-04-07 at 10:13 PM


Liam looked into this, and I believe it is a javac bug that has been fixed in newer versions. Liam, is that right?


Status: Accepted Owner: cushon@google.com

cushon commented 9 years ago

Original comment posted by cushon@google.com on 2014-04-07 at 10:40 PM


Here's the javac bug: https://bugs.openjdk.java.net/browse/JDK-8028143

You can work around it by putting the @Deprecated annotation after the javadoc, e.g.:

/**


Status: WontFix