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

check for "this" in non-static methods #65

Closed
yegor256 opened this issue Apr 21, 2013 · 17 comments
Closed

check for "this" in non-static methods #65

yegor256 opened this issue Apr 21, 2013 · 17 comments
Assignees

Comments

@yegor256
Copy link
Owner

migrated from Trac, where originally posted by yegor256 on 25-Dec-2011 6:08pm

Let's create a Checkstyle or PMD check that will validate that every non-static method has at least one reference to this.

@ghost ghost assigned yegor256 Apr 21, 2013
@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 1-Jan-2011 7:05am

Dmitry, can you help? The budget is 1 hour.

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 4-Jan-2012 4:59pm

Please, explain what to realise: method must contain in his body at least one reference to this?

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 4-Jan-2012 7:09pm

If a method is non-static than it has to have at least one reference to this in its body. For example, this method violates the declared rule:

public String name() {
  return "test";
}

And it has to be refactored:

public static String name() {
  return "test";
}

Got the idea?

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 10-Jan-2012 12:45pm

In [412/qulice]:

#CommitTicketReference repository="qulice" revision="412"
refs #65 - new branch

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 10-Jan-2012 1:48pm

In [413/qulice]:

#CommitTicketReference repository="qulice" revision="413"
refs #65 - done

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 22-Jan-2012 6:37pm

How about this:

public void method() {
  return "this.";
}

Will it work?

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 22-Jan-2012 11:39pm

Milestone PROTOTYPE deleted

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 24-Jan-2012 5:58pm

In [432/qulice]:

#CommitTicketReference repository="qulice" revision="432"
refs #65 - done

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 24-Jan-2012 6:18pm

I can't merge:
svn: Can't read from connection: Connection reset by peer

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 25-Jan-2012 1:28am

Try again, maybe there were some problems on the server.

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 26-Jan-2012 5:19pm

In [433/qulice]:

#CommitTicketReference repository="qulice" revision="433"
refs #65 - done

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by dmitry.bashkin on 26-Jan-2012 5:21pm

try this.

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 26-Jan-2012 7:18pm

trying...

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by guard on 26-Jan-2012 7:28pm

In [434/qulice]:

#CommitTicketReference repository="qulice" revision="434"
refs #65 - /branches/ticket65 merged into /trunk, 1 hours spent

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by guard on 26-Jan-2012 7:28pm

In [435/qulice]:

#CommitTicketReference repository="qulice" revision="435"
refs #65 - /branches/ticket65 successfully closed

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor256 on 1-Apr-2012 6:09pm

thanks!

@yegor256
Copy link
Owner Author

migrated from Trac, where originally posted by yegor on 21-Apr-2013 12:03pm

we moved to Github

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

No branches or pull requests

1 participant