Where can I find the OFFICIAL Java Coding/Style Standards? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I use CheckStyle plugin for Eclipse and it does a wonderful job. I would like to know if there an official Code/Style standard (and there should be!) out there by Sun/Oracle... The ones I am finding are so out-dated, they don't even include any Java 1.6 specific syntax, etc...
Here is what I found so far:
http://developers.sun.com/sunstudio/products/archive/whitepapers/java-style.pdf (last modified 2000)
http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html (last modified 1999 - CheckStyle website references this)
I understand that to a degree most of the Java syntax has not changed much but you'd think it wouldn't be over 10 years old!!! Any ideas where to find an updated version or if there is any that I am just not finding?
Thanks

Try looking at the -Xlint compiler flag for javac for a programmatic check (if that's your question). It checks most things for you.
Also, what's wrong with having a code style document that's > 10 years old? That means the language is fairly stable and older code looks much like newer code, making maintenance easier. The library may have expanded but much of the syntax is identical. Your second link is what my searches returned and seems very comprehensive.
EDIT: If you want the nitty gritty details on the new Java syntax, check out the Java Specifications.

To the best of my knowledge the internal Sun coding stds document was never officially updated to include conventions to encompass language changes such as Generics, Annotations, or now (in JDK 8) Lambdas etc.
I personally have always used the empirical style derived from the JDK itself, i.e if my code doesn't look like JDK code, then I am not following the coding practice.

The links above are broken now since Oracle reorganized their web site.
http://web.archive.org/web/20090911103851/http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

Related

checking tool for spelling and javadoc validation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
apologies if the question is a duplicate.
Actually I am looking for a automated checking tool to identify:
the missing javadoc,
incomplete javadoc or
missing brief
test and identify spelling or grammar mistakes in javadoc comments.
I know there are few tools available to do these things such as checkstyle and open javadoc check etc. But I would need suggestions if there are any more tools available if yes, which one would be more suitable for my need.
IDEs (Integrated Development Environments) commonly include spell-checking in javadocs and comments. I know that Eclipse definitely does ( http://www.eclipse.org/downloads/ - pick IDE for java developers 150mb).
Also, you shouldn't have to apoligize for whether the question is a duplicate - your first resource should be to google, your second resource SO search, and your third resource the "Similar Questions" box you get while typing your title.
About spelling and grammar - do you do code reviews before people check their code in? How about checking the spelling and grammar then?
For the already existing classes - if you really need a better grammar check, you would either have to use a commercial tool or write a tool yourself (e.g. a python script that parses all javadocs and runs a spell and grammar checker on it)

Is there a simple CLI Java linter? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've been trying to find a Java linter capable of running on the CLI that is separate from Eclipse that I can call as a commit hook for git or from our automated build script. Does such a thing exist?
Ideally it needs to check for unused imports and variables, that style guidelines are followed, exceptions are used properly, etc. Though some subset of those features would be better that what we have now - nothing!
SpotBugs (earlier Findbugs) for finding existing bugs. VERY GOOD!
PMD for finding patterns that can lead to bugs (e.g. unused variables)
Checkstyle to enforce coding standards and conventions (e.g. whitespace, Javadoc)
Error Prone hooks right into your application's compile step
clang-format supports java and may be available on your system already
All these tools have some overlapping rules. There are many other similar tools, but these are the most popular and supported.
Also, check out Sonar, which combines many of the other tools and provides a nice view for it too.
rules from Checkstyle, FindBugs, PMD, Clirr, fb-contrib.
Not sure exactly how to add it to a post-commit hook, but http://docs.codehaus.org/display/SONAR/Analyzing+with+Maven might be a good starting point (especially if you're using maven).
Maybe even consider using one of the approaches listed in http://docs.codehaus.org/display/SONAR/Continuous+Integration since it seems that you might be trying to look for better tooling for your whole team ("Though some subset of those features would be better that what we have now - nothing!"
This is EXACTLY what I am working on: a tool CLI-friendly to be used to check the quality of Java code. It has also an interactive modality. You can run single queries (to check for single warnings) or all queries together.
The tools is in its early stage but I am working on it almost every day. It is available here:
https://github.com/ftomassetti/effectivejava
Please let me know what do you think about it and feel free to ask questions.

What is the best free JavaScript obfuscator that is available as a Java library? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I know this question has been asked many times, but here are my specific needs. The obfuscator needs to come in a form of a java library, so I can make an Ant task in order to automate the build process. IE7, 8, Firefox and Chrome must be able to interpret the resulting js very fast (original js file is pretty big - 18k lines of code). If none exist which satisfy these requirements I'm willing to consider a commercial solution.
Some options:
YUI compressor. See Julien Lecomte's blog for example use from Ant.
LCA Soft provide a free Ant task interface to the Dojo Toolkit compressor.
Jawr - Ant task.
(I've not used Jawr or Dojo, so can't comment on which is best.)
Google's closure-compiler is another alternative.
There is a newer free option for Javascript Obfuscation - Roquson. They provide completely free Javascript Obfuscation with additional features like Variable renaming, Domain Locking and Expiration Date.
Check it out here: http://roquson.com
I still believe that jsutility.pjoneil.net provides the best compression of any program available except for gzip. It's obfuscation support is avoids most of the problems with obfuscation. It also now support batch operations.

Where to find source code for java.lang native methods? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm vaguely familiar with the JNI, and I'm curious to see my machine-specific implementation for some native methods in the java.lang package. Thread#currentThread(), for example.
I've found a bunch of DLLs in [JDK_HOME]/jre/bin, but like I said I'm trying to find the source code.
Does anyone know where the native source code can be found? Is it even available, or is it classified by Sun (oops I mean "We're In It To Win It" Oracle)?
For JDK6 you can download the source from java.net. For java.lang the story begins at j2se/src/share/native/java/lang/, and then search... JDK7 rearranges the directory structure a little.
Some methods, such as Object.hashCode, may be implemented by hotspot instead or in addition to through JNI/Java.
JDK6 is freely licensed through the Java Research License (JRL) and Java Internal Use License (JIUL). JDK7 and OpenJDK6 is licensed under GPL 2 with CLASSPATH exception (roughly speaking you can link to it without catching the GNU virus). I am not a lawyer.
(BTW: The real lawyers would like to point out that I am still an employee of Sun Microsystems. Sun UK is no more. It is now Oracle.)
Update (Adding location for Thread.c):
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/Thread.c
You can look at the source code for OpenJDK (licensed under GPLv2 with Classpath Exception). Probably the best way to study the JDK implementation internals, unless you want to be bound by the Java Research Licence, in which case you can access the actual JDK 6 source.

Java Lucene English Stemmer? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I need help indexing and searching English text using Java Lucene over Google App Engine. The only solution I have found so far was the SnowballAnalyzer (in the contrib packages), but it only supports Lucene 3.0, and GAELucene only supports lucene 2.3.1. Just changing jars doesn't really work.
Can anyone help me index my text with an English stemmer?
The SnowballAnalyzer has been with Lucene for a long time now, including 2.x versions (see its entry in the 2.4.1 API docs).
Bizarrely, though, it doesn't come as part of the standard Lucene distribution, even if it is in the documentation. You'll have to hunt down a version of the contrib package that is to be used for 2.3.1.
Edit: Looks like there's a copy here.
The PorterStemFilter is in the lucene core. It can be used with the StandardAnalyzer for english stemming.
Various companies also sell more sophisticated and/or speedier alternatives to Porter Stemmers implemented in a Snowball interpreter. If you have needs in that direction, post a comment and I'll elaborate, but I don't want to get accused of unjustified advertising, so I'll leave it there for now.
You can use lucene-2.3.1.zip or its neighboring files in the Lucene archive. I am unsure, however, about the degree of customization available from GAELucene. It does not appear to be open to accept arbitrary analyzers.

Categories