Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Recursive supertype and superinterface validation #733
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). 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
|
|
I signed it! |
|
CLAs look good, thanks! |
0dbfc0d
to
3a4d4a2
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
| return isValidBaseElement(e) | ||
| && validateElements(e.getTypeParameters()) | ||
| && validateTypes(e.getInterfaces()) | ||
| && validateType(e.getSuperclass()); | ||
| && validateType(superclass) | ||
| && e.getInterfaces().stream().map(MoreTypes::asElement).allMatch(SuperficialValidation::validateElement) |
ronshapiro
May 15, 2019
Contributor
If you want, e -> validateElement(e) is a little shorter than the method reference
If you want, e -> validateElement(e) is a little shorter than the method reference
Leland-Takamine
May 15, 2019
Author
Would prefer to leave as is - e conflicts with the existing method parameter and the IDE produces a warning with the lambda.
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
|
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.