Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(106)

Issue 30940043: Add support for @Inherited annotations (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 10 months ago by radoslaw.burny
Modified:
10 years, 9 months ago
Reviewers:
alexeagle, cushon, supertri
Visibility:
Public.

Description

This is a fix for https://code.google.com/p/error-prone/issues/detail?id=185 I'm afraid we can't fix annotations(); this is because it runs its submatcher over all AnnotationTrees attached to the given Tree. To take superclasses into account, it would need to access their Trees, and this seems impossible (compiler may not even have access to superclass' source code). We can, however, access inherited annotations as Attribute.Compound - "compiled" form, to run some less general matchers. I fixed hasAnnotation() this way. If needed, I could also add something a bit more general like: hasAnnotationWithArgument(String annotationClass, String argumentName, String value);

Patch Set 1 : #

Total comments: 4

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -8 lines) Patch
M core/src/main/java/com/google/errorprone/matchers/JUnitMatchers.java View 2 chunks +2 lines, -2 lines 0 comments Download
M core/src/main/java/com/google/errorprone/matchers/Matchers.java View 1 2 chunks +17 lines, -1 line 0 comments Download
M core/src/test/resources/com/google/errorprone/bugpatterns/JUnit3TestNotRunNegativeCase5.java View 1 chunk +0 lines, -5 lines 0 comments Download

Messages

Total messages: 10
radoslaw.burny
10 years, 10 months ago (2013-11-22 16:09:50 UTC) #1
radoslaw.burny
Changing reviewers since Eddie's OOO.
10 years, 9 months ago (2013-12-01 18:07:17 UTC) #2
supertri
cushon, Any comments on this CL? https://codereview.appspot.com/30940043/diff/20001/core/src/main/java/com/google/errorprone/matchers/Matchers.java File core/src/main/java/com/google/errorprone/matchers/Matchers.java (right): https://codereview.appspot.com/30940043/diff/20001/core/src/main/java/com/google/errorprone/matchers/Matchers.java#newcode526 core/src/main/java/com/google/errorprone/matchers/Matchers.java:526: } else if ...
10 years, 9 months ago (2013-12-04 17:56:26 UTC) #3
cushon
This looks good to me. The CL description say we can run 'less general' matchers ...
10 years, 9 months ago (2013-12-04 18:19:41 UTC) #4
radoslaw.burny
> The CL description say we can run 'less general' matchers on the annotation > ...
10 years, 9 months ago (2013-12-04 23:52:58 UTC) #5
radoslaw.burny
https://codereview.appspot.com/30940043/diff/20001/core/src/main/java/com/google/errorprone/matchers/Matchers.java File core/src/main/java/com/google/errorprone/matchers/Matchers.java (right): https://codereview.appspot.com/30940043/diff/20001/core/src/main/java/com/google/errorprone/matchers/Matchers.java#newcode522 core/src/main/java/com/google/errorprone/matchers/Matchers.java:522: Symbol inheritedSym = state.getSymbolFromString("java.lang.annotation.Inherited"); On 2013/12/04 18:19:42, cushon wrote: ...
10 years, 9 months ago (2013-12-04 23:53:21 UTC) #6
supertri
LGTM
10 years, 9 months ago (2013-12-05 02:22:54 UTC) #7
cushon
On 2013/12/04 23:52:58, radoslaw.burny wrote: > > The CL description say we can run 'less ...
10 years, 9 months ago (2013-12-05 04:52:26 UTC) #8
radoslaw.burny
Here's the patch. On Thu, Dec 5, 2013 at 5:52 AM, <cushon@google.com> wrote: > On ...
10 years, 9 months ago (2013-12-05 10:53:15 UTC) #9
cushon
10 years, 9 months ago (2013-12-11 18:48:22 UTC) #10
committed as aadcce35324ddb3fc9118f1585cc7fa766a1d31c
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b