Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow compact record constructors to be missing a body, for parsing stubs #72

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

neilccbrown
Copy link

A change to the stub parser to allow compact record constructors to lack a body. This lets you write stubs like:

public record Foo(int x) {
    @MyConstructorAnnotation Foo;
}

It feels a bit strange to allow annotations on a single word without a sign to the parser that it's a constructor, but I don't think it's ambiguous because every field needs a type, and all other methods and constructors need parentheses. The only other way I can see to do it is to require the empty curly brackets instead -- which I would personally be fine with, but the approach in this PR felt more consistent with the way stubs usually work.

@codecov-commenter
Copy link

Codecov Report

Merging #72 (64a5214) into master (9e23e9d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##              master       #72   +/-   ##
===========================================
  Coverage     57.062%   57.062%           
  Complexity      2562      2562           
===========================================
  Files            618       618           
  Lines          34499     34499           
  Branches        5802      5802           
===========================================
  Hits           19686     19686           
  Misses         12848     12848           
  Partials        1965      1965           
Flag Coverage Δ
AlsoSlowTests 57.062% <ø> (ø)
javaparser-core 52.607% <ø> (ø)
javaparser-symbol-solver 35.279% <ø> (ø)
jdk-10 57.055% <ø> (ø)
jdk-11 57.055% <ø> (ø)
jdk-12 57.055% <ø> (ø)
jdk-13 57.055% <ø> (+0.005%) ⬆️
jdk-14 57.055% <ø> (ø)
jdk-15 57.055% <ø> (ø)
jdk-16 57.052% <ø> (-0.003%) ⬇️
jdk-8 57.054% <ø> (ø)
jdk-9 57.055% <ø> (+0.002%) ⬆️
macos-latest 57.053% <ø> (ø)
ubuntu-latest 57.048% <ø> (ø)
windows-latest 57.053% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e23e9d...64a5214. Read the comment docs.

@mernst mernst merged commit 217ddb9 into typetools:master Aug 12, 2021
@mernst
Copy link
Member

mernst commented Aug 12, 2021

Thanks for this enhancement!
Sorry for the delay in merging -- I was traveling for the past week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants