Recursive supertype and superinterface validation#733
Recursive supertype and superinterface validation#733Leland-Takamine wants to merge 1 commit intogoogle:mainfrom
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
0dbfc0d to
3a4d4a2
Compare
common/src/main/java/com/google/auto/common/SuperficialValidation.java
Outdated
Show resolved
Hide resolved
common/src/test/java/com/google/auto/common/SuperficialValidationTest.java
Show resolved
Hide resolved
common/src/test/java/com/google/auto/common/SuperficialValidationTest.java
Outdated
Show resolved
Hide resolved
|
I'll try to run this through google-wide presubmit to check if anything breaks. |
3a4d4a2 to
2c98c18
Compare
| && validateTypes(e.getInterfaces()) | ||
| && validateType(e.getSuperclass()); | ||
| && validateType(superclass) | ||
| && e.getInterfaces().stream().map(MoreTypes::asElement).allMatch(SuperficialValidation::validateElement) |
There was a problem hiding this comment.
If you want, e -> validateElement(e) is a little shorter than the method reference
There was a problem hiding this comment.
Would prefer to leave as is - e conflicts with the existing method parameter and the IDE produces a warning with the lambda.
|
Unfortunately this is introducing some cycles. Here's a repro: @Component
class Foo extends java.lang.ref.Reference {}Looks like there's a cycle between I'm going to think more, but I think we may want to use something like When I ran this through google's global tests, the test framework failed it's smoke tests with a 50% failure rate. Seems like enough things refer to |
|
@ronshapiro Would it be sufficient to just keep track of visited |
|
We could try that. I think passing those around may be icky, so that's why I suggested |
|
Wouldn't we need to handle cycles manually when building to graph in order to leverage |
Ah never mind - I see now that Traverser.forGraph accepts a function not a graph. |
2c98c18 to
56bf699
Compare
|
Updated to handle cycles by keeping track of visited Elements at the instance level. This requires making all internal logic non-static. Public static API is unchanged. |
|
@ronshapiro Mind taking another look? |
|
I'll send this through our tests again and report back |
|
I'm seeing a few cases of this come up now:
From within
|
|
@ronshapiro Are you able to track down which tests are failing? I'd like to figure out a repro case so I can write a test for that. |
|
I haven't had time yet to investigate
…On Thu, May 23, 2019, 4:51 AM Leland Takamine ***@***.***> wrote:
@ronshapiro <https://github.com/ronshapiro> Are you able to track down
which tests are failing? I'd like to figure out a repro case so I can write
a test for that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#733?email_source=notifications&email_token=AAGBRXLHA5C26RDLQXPH6RTPWZLKLA5CNFSM4HM5QQFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWBQYPQ#issuecomment-495127614>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGBRXMXHSFODZPBXGQ3VA3PWZLKLANCNFSM4HM5QQFA>
.
|
|
@ronshapiro I've taken a look at the code but I'm still unclear on how we'd be visiting a null type. It would be really helpful to see the failing tests to help debug. |
|
Ping on this :) |
Fixes #660
This change adds recursive validation for supertypes and superinterfaces to
SuperficialValidation.