http://jmt.tigris.org/
Does anyone know if any similar project like this exist or anyone compile jmt for java 1.5 or java 1.6. Now JMT have problems with generics, overrides becouse it is generated for java 1.4
There are several tools that scan for code issues and quality. The top projects are:
PMD at http://pmd.sourceforge.net, this is my favorite
Checkstyle at http://checkstyle.sourceforge.net
Findbugs at http://findbugs.sourceforge.net
The tool Sonar at http://www.sonarsource.org combines these and provides a UI, although as a developer I have had more luck with running the tools individually and adjusting them to my needs.
For that, a great entry point would be Sonar, which is totally focused on code quality and metrics generation, with also a good spot on vizualisation of these metrics.
Related
What is the best way to migrate Java code of an older jdk (1.5) to a more recent Java version (1.8) to provide from its new features and improvements.
We have a large Java jdk 5 code base and want to migrate to jdk 8.
There are a lot of compiler warnings and hints (e.g. diamond operator, multicatch, unnecessary (un)boxing, etc) which will improve the performance, code readability, etc.
We are using Netbeans IDE. Are there any plugins which we can use or are there migration scripts?
The likelihood of your code being incompatible with Java 8 is slim, since Java has taken great strides to ensure backwards compatibility with all previous versions.
The issues that you'll likely run into lie much deeper, likely in implementations of collections or methods who have changed over the years.
If you don't have a test suite that covers the critical paths of your code, start there. You'll need that test suite to ensure that the migration hasn't horribly broken anything.
Next, peruse the compatibility guides for Java 1.7 and Java 1.8 and be sure that nothing that you're using in particular is impacted by those changes.
Lastly, the code cleanup piece can be tackled, but it shouldn't be addressed right now. The only thing you need to concern yourself with is to get the platform running on the new version of Java. As you work in the code base, discipline yourself and the team to use the newer Java idioms, such as the diamond notation, and try-with-resources where applicable.
Unfortunately, there are no magical ways to achieve what you are asking, but here are a few pointers that can make it easier for you to migrate the code to JDK 1.7 (note that JDK 1.8 has been out for some time now, and 1.7 is already out of support officially by Oracle):
Use checkstyle or a similar plugin in Eclipse to find the problems
Build your project with JDK compiler level 1.7 in Eclipse; warnings given by Eclipse are much more user friendly than the warnings printed on console by command line compiler
In theory, JDK 1.7 is backwards compatible with 1.5. The only exceptions are assert and enum keywords. If you used these words as user defined type/method names, you'll get a compilation error. So for most part, you can get right down to warnings. If push comes to shove, you can choose to ignore many of these warnings (of course, only if you must)
Found what I was looking for: Netbeans offers Inspect and Transform.
This can be used to transform your complete code base (or parts of it) with a configuration of changes.
This is how it works:
select your project
click Refactor menu
click Inspect and Transform menu item
select configuration and configure it using the Manage button
choose your desired transformations (e.g. Can Use Diamond, Join catch sections using multicatch, unnecessary boxing, etc.)
click Inspect
Review proposed refactoring suggestions and click Do Refactoring
Your complete code base is refactored and uses your selected new features and new idioms.
IntelliJ IDEA has a similar feature. See Analyze > Inspect Code ...
In Eclipse this is called clean up in code style (configuration) or source (menu).
Can anybody point me to Netbeans plugins that help do better code?
I hope to find some plugins that do Java code review and search for:
bug patters
duplicate code
and other types of vulnerabilities.
Thanks!
Install EasyPMD from the plugin portal. http://plugins.netbeans.org/plugin/33246/easypmd-2-1
How about Findbugs.
Never used it with Netbeans (only with HudsonBuilder), but some Google results state that there is a plugin for NB.
Several of the PMD and Findbugs rules (suggested by others) are already part of the regular "Hints" of Netbeans. By enabling more than the standard set of hints, you can already get some good "programming advices" without having to install anything.
(But they are by no means a complete replacement for PMD or Findbugs)
There is an article about integrating plugins you could try to follow that (I haven't yet), but from my experience sadly in IDE tools never work as well as the commandline versions.
I would recommend you instead use Maven as your build tool and add the Cobertura, FindBugs, PMD, and CheckStyle plugins that will produce reports whenever you compile your code. Not as handy, but you will still get good feedback.
Also, this means that they will be equally available for people working on your code base with other IDEs. If you use a continuous integration server like Jenkins and it will create a report using any tool you'd like whenever you check-in code.
And this is speaking as someone who prefers NetBeans over Eclipse.
I've been an avid Eclipse user for my Java development for a while, but as of late I'm beginning to enjoy developing using NetBeans 6.9.1 more thanks to the faster (IMHO) code completion and the powerful templates and refactoring tools.
Anyway, the one thing that I'm missing is some tool to analyse my code's Metrics. I found a plugin for Eclipse which gives me a myriad of information, from TLOC to Cyclomatic Complexity and an overriden method counter.
Can anyone recommend a WORKING metrics tool for NetBeans 6.9.1? The one that I have found (Simple Metrics, and RefactorIT) are no longer maintained and won't even install as modules on the current NetBeans platform.
So far all I have been able to find on Google are old, unmaintained projects from 2005 or so...
Thank you!
Good question...
Did you tested the plugin "Simple Code Metrics"?:
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=9494
PMD in the Software Quality Environment plugin pack at http://kenai.com/projects/sqe/pages/Home does cyclomatic complexity at least, and probably has some other metrics you may find useful.
Over the past year, I've heard an increasing amount of hype regarding the Scala language. I know that there are several existing projects that have plans to integrate Scala support with IDEs; however, it isn't always clear how good the integration really is.
Do they currently support Intellisense as well as Eclipse and Netbeans do for the Java language? Do they support instant verification as well?
I can't personally speak to the stability of the IntelliJ or NetBeans plugins (though I have heard good things), but the Scala IDE for Eclipse just recently made a new release with Scala 2.7.4. Architecturally, this release is quite different from the previous ones in that it uses Equinox Aspects, the officially supported mechanism for extending JDT (and other cross-plugin extensions). Whereas before the Scala plugin had to literally hack into the JDT internals using private APIs and reflection to trick the system into behaving properly, now it is able to simply declare its extension points and let the system do the rest. It's hard to even describe how much more stable this makes things. I'm not saying that it's all sunshine and roses yet, but if you've tried and rejected the plugin in the past (as I had), it's time to give it another look.
As for how it stacks up feature-wise, SDT doesn't have any refactoring support (IntelliJ has some basic stuff like "Rename"), nor does the editor do some things like "Mark Occurrences". However, it has a significantly better Outline than NetBeans, better compiler support than IDEA, and very good semantic highlighting. All three plugins support content assist (or "intellisense", as Microsoft calls it), but none of them are particularly reliable in this area just yet. The Scala IDE for Eclipse is the only one to support incremental compilation (alla Eclipse's Java tooling).
My advice: shop around. Try all three and see which one works the best for you. From what I've been hearing, the Scala IDE for Eclipse has leap-frogged the competition with its latest release, but the others have shown such consistent stability and steady advancement that you can't count them out just yet.
Here's a similar question:
Which is the best IDE for Scala development?
In my very short experience with the Scala IDE for Eclipse and the Scala Plugin for Netbeans, it seemed like the Netbeans plug-in was a little more solid than the Eclipse one.
With the Scala IDE for Eclipse I was having problems with running a Hello World-type Scala object, and sometimes the syntax highlighting would start acting up. Then, I tried out the Netbeans plug-in, and it seemed to be more functional than the Eclipse one.
I haven't used either Scala IDE plug-in much in-depth, so I can't speak out of a lot of experience, but just from my initial impression, the Netbeans plug-in seemed a little bit more stable than the Eclipse one.
Currently, all three main IDEs are at roughly the same level of support.
IntelliJ - the plugin has fits of not working at all, but is otherwise quite good. The underlying platform is sluggish (at least in linux) since v8.
Eclipse - the plugin is receiving a lot of support and is under very active development.
NetBeans - IMHO, the plugin works a little better than the Eclipse one, but not being able to run arbitrary files is a major downer.
All of the above suffer from being unable to parse the AST in all contexts. It is quite easy to confuse them by mixing in traits with implicit defs, for example. No IDE can be trusted when it advises of a syntax error. Fall back to the compiler to be certain.
I'm quite happy using IntelliJ IDEA 8.1 and its Scala plugin and can recommend it. It even has a roadmap that you can influence by voting your favorite missing features :) I don't have experience with the Scala support of the other IDE's, unfortunately.
I'm using the Eclipse Scala plugin. Its pretty good but not at the same level as the Java tooling.
AS for intelliJ, no idea.
But between Eclipse and Netbeans, I must say Netbeans especially if you are not willing trade maven for sbt and you want an IDE that does not get in the way of maven.
Netbeans maven support is just way too good.
The Netbeans scala editor seems to work quite nicely as well.
I care not for the integrated scala development kit in netbeans or the compiler plugin, or any such helpers. From netbeans I expect only tthree things:
(a) Do not get in the way of maven and let maven run my build
(b) Give me a decent editor
(c) Let me drill down from my .scala files into the source code of the libraries referred by my maven dependencies.
And Netebeans is able to deliver all three quite well, I belive, even if at times it feels a bit too slow.
What I can say is that
(1) You do not run into any compilation issues since the task is up to maven.
The maven compiler plugin is a bit too slow. But compiling scala vs java is always like that, painful. Still if you've tried GWT compiling java to javascript is more painful even.
(2) Netbeans figures out the source code to you maven dependencies flawlessly and you can drill in into the most obscure sacala operators, such as the CSS mappers of lift.
As for eclipse, eclipse maven integration has always been nasty.
Netbeans maven integration can turn very sour if you have a big project with too many dependencies and modules. Then the check for external changes done by netbeans is just horribly slow. That is the downside of netbeans.
However, if you are and SBT fan ... well, maybe then answer might be something else.
But for me, since maven has become the thing it is today, I never want to go back again to those "web application project", "library project" etc... wizard like options that you have when you create a new project in the IDE.
I simply want "maven project", and please figure out what my output artefact is by reading the pom.
There are tools like Fortify available which can be integrated with IDE to scan the source codes for security vulnerabilities. But what I expect is a plugin for IDE like eclipse, which should check for vulnerabilities while typing the code. (Probably, in case of a Java program, for every semi-colon(;) it should check for the vulnerability). It would be great if the tool recommends a fix on the go. So that the developer can fix the vulnerabilities as such fixing the compilation issues in eclipse. This would really reduce the developers' time a lot, when compared to running a full scan of the code, checking vulnerabilities, fixing those and scanning the entire code base again.
Is there any such product available in the market already? If not, is it a feasible one to develop such thing?
FindBugs can be made to work in a similar manner perhaps, I have set it to run every time I compile a new file and it warns about some interesting potential bugs. The only plugin I know of that runs as you type is Checkstyle so maybe there's a similar plugin that checks for security vulnerabilities?
Cigital.com They have a plugin that works in a 'spell checker' mode. As you type it will high light the vulnerability code. For example SQL injections, XSS and so in. It works very well and does not hog your machines resources like other plugins.
You can also check out Ounce Labs and Coverity...