OpenJDK7: What essential ADTs are not Implemented in OpenJDK7? - java

What Abstract Datatypes should be added to OpenJDK7 ?

If you look at these two links you will see what some people feel is missing:
http://commons.apache.org/collections/
http://code.google.com/p/google-collections/
My favourite missing one is Bag... it is easy to implement, but annoying to have to implement it.
Mulimaps would also nice to have in the standard packages.

I think they should stop adding new libraries to the JDK. You can easily get what you need from third-party, open-source libraries. Hopefully, with version 7 the JVM and its standard libraries will become more modular.

Related

Can I just drop osgi.enterprise.jar in my equinox plugins folder?

I'm interested in the OSGi Enterprise specification. At the moment I'm only interested in the JDBC connectivity, but that may change.
At http://www.osgi.org/Download/Release4V42 I can find the osgi.enterprise.jar (the companion code link). Can I just install it in my equinox container and use it?
I had the impression that some of the classes are overlapping (for instance org.osgi.service.component), doesn't this lead to problems? Or should I then just uninstall the org.eclipse.osgi.services bundle and use the osgi.enterprise instead?
No. You can't do that.
The file from OSGI.org is mostly interfaces, it is not complete implementation.
The answer by "J-16 SDiZ" is correct, in that the osgi.enterprise.jar is pure interfaces rather than implementations.
You also asked about the overlap with the org.eclipse.osgi.services bundle… in fact the OSGi enterprise JAR should be a strict superset of it. There is not much problem with having both these bundles installed but it is also not really necessary, so to minimise confusion I would probably remove org.eclipse.osgi.services.

Java code generation

I am looking for nice (java) code generation engine.
I have found cglib but it is very poorly documented and I am not quite sure that it can generate actual java classes (files) and only dynamic classes. If I am wrong maybe someone knows has a link with an example.
Roman
Have a look at codemodel, used with success for my projects.
Didn't really try, but you may want to take a look at another code generation Java framework called Javassist, which also has pretty thorough tutorial. Also Hibernate changed code generation framework from cglib to javassist. Quote, explaining why:
The simple fact of the matter is that development on CGLIB has largely stopped. It happens. Developers for whatever reason (the reasons are their own) move on to new priorities.
Source
I just released cgV19 here: https://github.com/carstenSpraener/cgV19 it's based on a code generator i wrote in 2002 to 2006 and which is still in production use. cgV19 is a re implementation with lessons learned. It has:
Support for gradle
Uses Groovy as a template language
a modular "cartridge" system to add several generator for different aspects
small footprint
Just try it out and give me feedback would be very nice.

How to refactor thousands of lines of Java code? Is there any tool available?

In our application we have two or three classes which contains the entire Java Swing application logic. These two or three classes contain around 7k lines of code.
Now I have been assigned the task to refactor this Java code.
How do I start? Is there any tool available that will do the refactoring or at least guide us?
I'd recommend Eclipse - the brilliant Java IDE for the editing and refactoring. It has several tools for refactoring. An excellent tutorial on how to do it with Eclipse is located at:
http://www.cs.umanitoba.ca/~eclipse/13-Refactoring.pdf
There's a brililant article on the power of refactoring with Eclipse, if you're not yet convinced, at:
http://www.eclipse.org/articles/article.php?file=Article-Unleashing-the-Power-of-Refactoring/index.html
And finally another article on how to refactor in Eclipse, including techniques and tools, is available at:
http://www.ibm.com/developerworks/opensource/library/os-ecref/
There's also another stackoverflow question on strategies for refactoring Java code that you may be interested in:
https://stackoverflow.com/questions/128498/what-are-the-best-code-refactoring-strategies
Hope that helps, good luck!
I assume that you are trying to break up these large classes into smaller ones. The most common way to do this is with the Extract Class refactoring. It just happens that this is a major topic in my PhD thesis work.
One of the hard parts is deciding what goes into the new classes. There are two publicly available tools that I know of that help - ExtC (my tool) and JDeodorant. Both are Eclipse plug-ins, and I would classify both as being prototypes. If you want to try to use my tool, I'll be glad to help.
Once you decide what should go into the new class, you have to do the actual work of separating the class into others. Eclipse's Extract Class refactoring is misnamed and isn't really helpful. IntelliJ's IDEA is much better, but still has some bugs. JDeodorant can also perform the split, but it also has some bugs.
IntelliJ has all the smarts for understanding Java code and provides excellent refactorings. And now there is a free and open source version.
Eclipse has some built-in refactoring tools. You could refactor method's signatures, extract interfaces and classes, pull methods up and down in the hierarchy tree, move packages ... and all that just by two clicks.
Also, you could start with a Martin Fowler book "Refactoring: Improving the Design of Existing Code".
As refactoring code relies primarily on the developer (assisted by tooling), your IDE is a very important tool when it comes to refactoring.
Both Eclipse and IntelliJ IDEA have plenty of refactoring support.
For an overview, checkout:
http://www.jetbrains.com/idea/features/refactoring.html
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/concepts/concept-refactoring.htm
I have created my own refactoring tool that tries and group together methods that use the same set of variables. It is very much an early prototype. It is only available as a Windows Eclipse plugin.
Variable Usage Eclipse Plugin

Single documentation for mixed (Scala/Java) project?

For a project with modules in Scala and Java (side by side), how to combine scaladoc with javadoc to provide a single view of the documentation for the project?
(this could be using maven, or ant, or sbt, more a general question).
Any thoughts and experiences appreciated.
With Scala 2.8's new scaladoc that will replace the one used with Scala 2.7, the differences will be even more striking. However, there was a request that a function be provided that translated scaladoc into javadoc format, for use by IDEs when displaying help.
If this function becomes available, then something that generates javadocs from scaladocs would be theoretically feasible.
But for any of that to become true, the people who have interest in such a thing would have to speak up at the appropriate fora. And, of course, if they are too small a group, it is likely nothing happens unless they do it for themselves.
What's de advantage of having Scaladoc <> Javadoc? There is a huge number of tools for Javadoc and almost anything for Scaladoc. The mainstream IDEs (Eclipse, Netbeans, Idea - real world enterprise development - not academic research) knows nothing about Scaladoc. Seems like being in Siberia: isolated.
Scaladocs and javadoc are very different, with different formats. They are just two different animals and I don't think it makes sense to combine them. So, AFAIK, Maven doesn't offer any support for that (which is not surprising), just generate both of them separately.

Alternative to servicewrapper for java?

I've used ServiceWrapper a few times in the past, however, the dual license is somewhat complex for commercial products (generally you have to pay them). Are there are fully FOSS alternatives with similar functionality?
YAJSW seems to be the best alternative, though I have not yet completed my evaluation.
Try Apache Procrun. It's what Tomcat uses on Windows. There is also Apache jsvc for Unix; they are both part of a parent project called Apache Commons Daemon.
Which functionality do you need exactly?
In their table I didn't see anything non-trivial. But it would help if you narrow down your requirements.
We use the open source JavaService package.
Edit: We use an older version of this package (when it was being maintained by the original developer, Alexandria Software Consulting). I have not had a chance to look at the improvements made since then.

Categories