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

Fix checkstyle issue with redundant public keyword #26

Merged
merged 3 commits into from
Feb 1, 2016

Conversation

smarr
Copy link
Contributor

@smarr smarr commented Jan 29, 2016

The latest Eclipse Checkstyle plugin (version 6.14) flagged public and private keywords as redundant on inner classes that are declared for instance as private.

It also flagged redundant static keywords for enum, because they are implicitly static.

Note, this is a rather crosscutting change that touches quite a bit of code. This should probably be carefully considered before merging.

Since there are quite a few places also in Graal that have these issues, it might not be desirable to change it all at once (Eclipse has a quick fix feature, but it didn't work for me). Here the patch to mx, that worked for me (note, no 6.14.1 jar on lafo yet.

diff --git a/mx.mx/suite.py b/mx.mx/suite.py
index 528c414..8e3640b 100644
--- a/mx.mx/suite.py
+++ b/mx.mx/suite.py
@@ -59,15 +59,15 @@ suite = {

     "CHECKSTYLE" : {
       "urls" : [
-        "https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/checkstyle-6.0-all.jar",
-        "jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/6.0/checkstyle-6.0-bin.zip/download!/checkstyle-6.0/checkstyle-6.0-all.jar",
+        "https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/checkstyle-6.14.1-all.jar",
+        "jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/6.14.1/checkstyle-6.14.1-bin.zip/download!/checkstyle-6.14.1/checkstyle-6.14.1-all.jar",
       ],
-      "sha1" : "2bedc7feded58b5fd65595323bfaf7b9bb6a3c7a",
+      "sha1" : "8e2c3a2bcef100c084e6ea80cc426b3443632d8c",
       "licence" : "LGPLv21",
       "maven" : {
         "groupId" : "com.puppycrawl.tools",
         "artifactId" : "checkstyle",
-        "version" : "6.0",
+        "version" : "6.14.1",
       }
     },

@smarr smarr force-pushed the fix/minor-checkstyle-issue branch from d6fbf9e to 5c86414 Compare January 30, 2016 00:09
@woess
Copy link
Member

woess commented Jan 30, 2016

Looks good to me. We'll have to fix all projects, though. I think Manuel already did that for Graal.

@lukasstadler
Copy link
Member

to be honest, I think having default modifiers in all kinds of places will take some getting used to.

@smarr
Copy link
Contributor Author

smarr commented Jan 30, 2016

Yeah, the other option would be disabling the rule, I guess.
On the other hand, I always wondered what a private class with a public constructor is supposed to mean.

Perhaps @jtulach has a more informed opinion. One of the considerations I found is about code evolution. So, it indicates more explicitly the visibility of the constructor when the class visibility is changed: http://stackoverflow.com/a/243276/916546

@jtulach
Copy link
Contributor

jtulach commented Feb 1, 2016

I like the removal of public constructors from non-public classes. Having them public is misleading.

jtulach added a commit that referenced this pull request Feb 1, 2016
Fix checkstyle issue with redundant public keyword
@jtulach jtulach merged commit 19ff391 into oracle:master Feb 1, 2016
@mrigger
Copy link
Contributor

mrigger commented Feb 2, 2016

I fixed these issues for Graal and JVMCI. We probably still have to clean up new violations before upgrading Checkstyle.

dougxc pushed a commit that referenced this pull request May 4, 2016
…uffle:nodeclass_cleanup to master

* commit 'ce0dc4c77915817754f92f9625f28ccdfe04741c':
  Update sigtest snapshot
  Remove NodeField interface and add equivalent methods to NodeClass instead
  Sort node fields by kind, so that iteration can be stopped early
  Replace assertAssignable with more descriptive IllegalArgumentException
  Deprecate NodeFieldAccessor
  Introduce NodeClass.NodeField as replacement for NodeFieldAccessor
  Remove child and children field arrays and rewrite NodeIterator to not need them
  NodeClass cleanup
  SL: avoid use of Node.getChildren()
@smarr smarr deleted the fix/minor-checkstyle-issue branch June 22, 2016 13:25
jerboaa pushed a commit to jerboaa/graal that referenced this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants