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

idea: fix ThisEscapedInConstructor idea violation for AbstractClassCouplingCheck.FileContext class #4861

Closed
Nimfadora opened this issue Jul 31, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@Nimfadora
Copy link
Contributor

commented Jul 31, 2017

sub-task of #4681

fix 'this' reference escaped in object construction for AbstractClassCouplingCheck.FileContext class

@romani romani added the approved label Jul 31, 2017

@rnveach

This comment has been minimized.

Copy link
Member

commented Feb 20, 2019

@romani If we made ClassContext a nested class of FileContext and removed the static on the class so this is passed by the compiler, would the violation go away?

@romani

This comment has been minimized.

Copy link
Member

commented Mar 3, 2019

yes, inspection tools trust compiler :). Compiler do a lot of links between objects that are not visible to human, it is ok. Humans care in code that they produce/see in priority.

Generated byte code is not following best practices of design, as design is focused on human understanding of code, on byte code level nobody care about human, all focus is on JVM internals.

@rnveach

This comment has been minimized.

Copy link
Member

commented Mar 4, 2019

@romani This produces another violation on my local intellij.

'ClassContext' is too deeply nested (nesting level = 2)

Do we want to increase the count, suppress it, move it to it's own file, or ... ?
It does remove the original violation.

@romani

This comment has been minimized.

Copy link
Member

commented Mar 28, 2019

FileContext require redesign, to remove private ClassContext classContext = new .. from fields initialization at all, class context should be created only when class is detected, not when file processing is started.

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 1, 2019

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 1, 2019

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 1, 2019

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 1, 2019

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 2, 2019

rnveach added a commit to rnveach/checkstyle that referenced this issue Apr 2, 2019

rnveach added a commit that referenced this issue Apr 3, 2019

@rnveach rnveach added this to the 8.20 milestone Apr 3, 2019

@rnveach

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

Fix was merged

@rnveach rnveach closed this Apr 3, 2019

Vantuz added a commit to Vantuz/checkstyle that referenced this issue Apr 3, 2019

peterdemaeyer added a commit to peterdemaeyer/checkstyle that referenced this issue Apr 27, 2019

peterdemaeyer added a commit to peterdemaeyer/checkstyle that referenced this issue Apr 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.