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

Correctly emit protected constructors #92

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

vegegoku
Copy link
Member

if a class has a private constructors and all other constructors are ignored, we should be emitting a protected constructor. currently we dont since we dont filter for private constructors. this commit should fix that

@vegegoku vegegoku added the bug Something isn't working label Oct 25, 2023
@vegegoku vegegoku added this to the 1.0.0 milestone Oct 25, 2023
@vegegoku vegegoku requested a review from niloc132 October 25, 2023 15:25
@vegegoku vegegoku self-assigned this Oct 25, 2023
@vegegoku vegegoku enabled auto-merge (squash) October 25, 2023 15:25
@@ -756,6 +756,7 @@ public boolean requiresProtectedConstructor() {
element.getEnclosedElements().stream()
.map(enclosedElement -> TsElement.of(enclosedElement, env))
.filter(TsElement::isConstructor)
.filter(tsElement -> !tsElement.isPrivate())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as you're in here, wouldnt it make more sense to also move the isIgnored filter here - functionally, we filter out ignored and private constructors in the same way (and this list isn't used anywhere else).

Don't even need the list property then, just a findAny().isPresent() to assign to allIgnored?

if a class has a private constructors and all other constructors are ignored, we should be emitting a protected constructor. currently we dont since we dont filter for private constructors. this commit should fix that
@vegegoku vegegoku force-pushed the correctly-emit-protected-ctor branch from f1483f2 to 7a4cdc8 Compare October 25, 2023 16:14
@vegegoku vegegoku requested a review from niloc132 October 25, 2023 16:15
@vegegoku vegegoku merged commit 017556c into Vertispan:main Oct 25, 2023
2 checks passed
vegegoku added a commit that referenced this pull request Oct 29, 2023
if a class has a private constructors and all other constructors are
ignored, we should be emitting a protected constructor. currently we
dont since we dont filter for private constructors. this commit should
fix that

(cherry picked from commit 017556c)
vegegoku added a commit that referenced this pull request Oct 29, 2023
if a class has a private constructors and all other constructors are
ignored, we should be emitting a protected constructor. currently we
dont since we dont filter for private constructors. this commit should
fix that

(cherry picked from commit 017556c)
vegegoku added a commit that referenced this pull request Oct 29, 2023
if a class has a private constructors and all other constructors are
ignored, we should be emitting a protected constructor. currently we
dont since we dont filter for private constructors. this commit should
fix that

(cherry picked from commit 017556c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants