How to check Java 6 code in Java 5? - testing

Does anybody know of a good approach for testing Java 6 code in Java 5? I just finished writing some programs for an internship application in Java 6, only to realize that they wanted me to submit code written in Java 5. I use eclipse, so I tried setting a duplicate project to run in a J2SE-1.5 environment and it worked. Was that a proper test, or was I mistaking something else for a Java 5? I also tried finding an online Java 5 compiler to test my code, but I couldn't find any websites with versions earlier than Java 6. I don't have a whole lot of experience with the more technical aspects of this sort of thing, so any simple approach would be immensely appreciated.

Yes, I think testing in a J2SE-1.5 environment should do it. Did you also change your compiler settings in the "Properties" window to 1.5? Please check that and try running your code. As far as I know I only do this to test between different versions of Java.

Related

Functional testing coverage Tool on apache and jboss

I'm looking for some tool which will provide me the code coverage of my functional tests (Not the unit testing code coverage ). To elaborate more, assume QA team executes their tests suites using selenium. At the end of the tests, I would like to know the amount of code (target code , not the test code base) got invoked / tested .
I found a similar post for .Net , but in my case the webserver is Apache and application server is jBoss
Coverage analysis for Functional Tests
Also, we have never done this type of analysis before, is this worth the effort, anyone who tried it ?
I used to do code coverage testing on assembly code and Java code. It is definitely worth it. You will find as you get the coverage close to 100% that it gets more and more difficult to construct tests for the remaining code.
You may even find code that you can prove can never be executed. You will find code on the fringes that has never been tested and you will be forced to run multi user tests to force race conditions to occur, assuming that the code had taken these into account.
On the assembly code, I had a 3000 line assembly program that took several months to test, but ran for 9 years without any bugs. Coverage testing proved its worth in that case as this code was deep inside a language interpreter.
As far as Java goes I used Clover: http://www.atlassian.com/software/clover/overview
This post: Open source code coverage libraries for JDK7? recommends Jacoco, but I've never tried it.
Thanks for the pointers #Peter Wooster. I did a lot of digging into the clover documentation but unfortunately there is not even a good indication that functional / integration is supported by clover, leave alone a good documentation.
Lucky I got to a link within the clover documentation itself which talks about this and looks promising (Thanks to Google search). I was using the ant so didn't even search in this Maven2 area. This talks about ant as well though :)
https://confluence.atlassian.com/display/CLOVER/Using+Clover+in+various+environment+configurations
I will be trying this , will update more on this soon !

Is there a Maven plugin to generate AS3 classes from Java for BlazeDS?

I'm looking for a maven plugin that would generate ActionScript3 classes from Java classes in order to access them by object remoting.
I've seen FlexMojo but it uses the GraniteDS generator which create some problems when it comes to map Enum objects (which can be fix through a workaround that is describe here : http://dev.c-ware.de/confluence/display/PUBLIC/Flexmojos+generated+AS3+model+with+Enum+support+using+BlazeDS?focusedCommentId=7634946&#comment-7634946 if you've googled your way here this might be useful) when working with BlazeDS.
Everything that I found so far are people who explain how to generate VO classes on flex side using Flash Builder 4, but this solution can not be used in an industrial development environment.
Take a look also on http://flex-annotations.aixcept.net/examples/actionscript.html
I also found this one, and while it is not a maven plug-in it could possibly be turned into one:
https://sourceforge.net/projects/cleartoolkit/
It was created by the guys who authored the book "Enterprise Development with Flex". Look for the utility DTO2Fx.

Which IDE for Scala 2.8? [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 1 year ago.
Improve this question
This is the same question for older version of Scala, but they say that Eclipse plugin has been improved vastly. Is it the best IDE now? How do different Scala IDE compare today?
I've been pretty successful with IDEA 9. I've briefly tried both Netbeans and Eclipse and wasn't able to get what I wanted. Eclipse's code-complete didn't behave as well as I'd have liked, and I couldn't find a way to make Netbeans handle Scala scripts; It'd just complain that the file wasn't a class.
To be clear, I've been using IDEA for a few years for Java, so keep that in mind:)
For the moment, Scala Plugin in IntelliJ IDEA is the best. It handles Scala 2.8 well. IntelliJ IDEA Community Edition is now free and open source (and works with Scala), so I can't see any reason for not using it.
The plugin is still somewhat buggy (many "false negatives", i.e. the code without red underscores may not compile successfully; but almost no "false positives"), but perfectly usable. The best thing is that you can use IDEA's excellent debugger with Scala (not without some issues, but it actually works!).
FSC (Fast Scala Compiler) is also supported in latest builds. A huge time-saver.
The plugin development team is quite responsive. Some of the guys work directly in JetBrains and possess intimate knowledge about IDEA platform, so the development progresses fast.
JetBrains IDEA's Scala plug-in handles 2.7 and 2.8 equally well.
I cannot make any comparisons because I have used only IDEA.
Using Eclipse Helios with the dev-version of the new Scala(2.8) plugin, as there isn't an official release yet. That is beta, definitively -- but I can't confirm the frequently expressed opinion that this plugin is outright horrible ;-)
I'd say, the experience is already OK-ish, and indeed better than the current state of affairs with the Groovy plugin. OTOH, the experience with plain Java is way more smooth (feels like flying at times), and the current CDT I'd rate somewhat in between.
Incremental compile and error highlighting work quite well for me; tweaking a DSL implementation into form just by continuously rewriting your code until the error markers are gone -- without ever having to test-run your program -- is outright fun and just again shows that FP / static typing rocks!
Problems encountered from time to time:
- implicits and nested types in other compilation units (esp. nested / super packages) aren't picked up at times when there are still other errors around; they will be picked up after an full build
- there seems to be a memory leak in the version I'm using right now (from end august 2010), necessitating to restart the workbench after some hours of work
- beware when you're using AspectJ, to make sure you get a version of the Scala plugin which relies on a JDT weaving bundle version which also works with AJDT
PS: I'm using maven builds in all my projects and generated the eclipse projects with the eclipse-maven-plugin, and then imported them as plain-flat eclipse projects. I can just strongly recommend everyone to keep away from the M2-eclipse plugin (for maven) in its current (2010) state, it makes your workbench painfully slow, is buggy and has lots of almost unpredictable behaviour, because it constantly tries to do magic things behind the scenes (and besides that, the aspectj support is broken since this spring)
i use both eclipse and IDEA
eclipse supports type detection is
better than IDEA (it is very
neccessery thing if you want program
in functional style that you can be
aware from type of expressions and
variables.)
Edit1: IDEA supports type detection like eclipse but you have
to define a value in your functions
for example: def
testTs[A](a:List[String],b:List[A])
= for{
ai <- a
bi <- b
} yield (ai,bi) } should be converted to def
testTs[A](a:List[String],b:List[A]):List[(String,A)]={
val result = for{
ai <- a
bi <- b
} yield (ai,bi) } also instead of hover your mouse over variables you must press ctrl+q when your mouse is hover on that variable
eclipse have some problems in code
completion (when you use a variable
in next line and you want get a
property of this variable eclipse
show wrong code suggestions)
in IDEA ruining a scala application
is 5 sec slower than eclipse (there is some solution for bust IDEA run time but these have side effect have some problems)
in idea there is a well known problem with double click speed that show itself in many cases like opening a file or selecting an string in source... you can increase double click time out by creating (or editing) /home/.Xresources and add this line: *.multiClickTime: 400
Edit1: in summery i prefer to use IDEA rather than eclipse
My experiences clearly point to IntelliJ IDEA:
About six months ago, when I started a serious Scala (multi module) project, I had to abandon Eclipse as my favorite Java IDE and switched to IntelliJ (9.0.x). Eclipse Scala IDE was way to buggy and often stopped responding at some point, even for the most simple projects. For CI (Hudson) and command line build, I depend on Maven (with Scala plugin). The Maven dependencies (incl. Scala libs) are picked up nicely by IntelliJ.
A few days back I updated to IDEA X (CE) with the current plugin (nightly build) and work became even smoother. Although fsc still terminates after a while when inactive.
From what I see, I'd like to add, that there seems to be way more activity on the IntelliJ side to respond to bugs and improve the plugin continuously. Correct me when I'm wrong, but Eclipse Scala IDE development seems almost stalled. Still no 'official' Helios release!
NB: Just to provide some context (not bragging, really): The aforementioned project consists of about 25 Scala modules (POMs), 5 Java modules, 325 Scala files with a total of about 360 Scala classes, case classes and traits (> 19 kLOC, including comments). My platform is OS X 10.6, Scala 2.8.1, Java 1.6.
UPDATE: After having the need for pretty extensive refactorings (mainly move class, rename package), I discovered that the recent IDEA 10.0.1 plugin 0.4.413 (and probably older versions, too) has quite some problems getting stuff right. I don't want to explain the specifics, but I (almost ever) ended up manually fixing unresolved references or otherwise messed-up code. You can have a look at http://youtrack.jetbrains.net to get an idea.
For everyone who is really considering doing some serious development with Scala, I strongly recommend to evaluate the IDEs in question beyond the basics. When you are into an agile approach, which in my option requires a painless refactoring support without surprises (especially in multi-module projects), things are pretty tight at the moment.
It would be pretty neat, if someone came up with a IDE independent specification-like list of refactorings (and desired outcomes), which could be used to verify an IDE's refactoring support.
A non-answer: None.
Based on what a perceived majority says, IDEA is probably the best Scala IDE today. And it (read: the Scala plugin) sucks. It does not handle fsc well, type inference is a mess, many errors are not shown, a number of non-errors are marked as errors, it is slow (when inspections are turned on), the test runner silently swallows aborting (!= failing) tests, ...
So I switched to a simple text editor with syntax highlighting on one and a maximized shell with SBT (simple build tool) on the other screen. Awesome! SBT is responsive (you can let file changes trigger recompilation of affected code and even reruns of tests), manages dependencies very smoothly and has helpful output (esp for tests; using ScalaTest). SBT increased my productivity compared to IDEA a lot.
You lose code completion, of course, altough geany offers me identified symbols. But as long as IDEs don't get type inference to work properly code completion does not help, anyway.
Some people care a lot about code refactoring. Well, the IDEs apparently don't make a good job there either. Even if they would, I'd rather only open them for this particular task than use them all the time.
I think that the best option so far is the ScalaIDE for Eclipse. You can go to the ScalaIDE Web Site and look around to see by yourself.
http://scala-ide.org/
Strong points I see about it are:
documentation,
tutorials,
constant releases,
support from Typesafe.
Here below a summary of the main features:
Scala IDE provides support for development of Scala applications in the Eclipse platform. Its main target is the support for the Scala language and the integration with the Eclipse Java tools. It provides many of the features Eclipse users have come to expect including:
Support for mixed Scala/Java projects and any combination of Scala/Java project dependencies. Type driven operations are transparent across Scala and Java files and projects, allowing straightforward references from Scala to Java and vice versa.
A Scala editor with syntax highlighting, inferred type, hyperlinking to definitions, code completion, error and warning markers, indentation, brace matching.
Project and source navigation including Scala support in the Package explorer view with embedded outline, outline view, quick outline, open type, open type hierarchy.
Incremental compilation, application launching with integrated debugger, hyperlinking from stack traces to Scala source, interactive console.
Support for Eclipse plug-in and OSGi development including hyperlinking to Scala source from plugin.xml and manifest files.
UPDATE: the features and advantages are mentioned on this answer are for version 2.9 and 2.10 of Scala, because it has been already discontinued. see here:
"The 2.0.1 release is only available for Scala 2.9, if you would like to use the Scala IDE with Scala 2.8, please install the 2.0.0 release (support for Scala 2.8 has been discontinued after the 2.0.0 version)"
The officially endorsed and supported (by Typesafe) for Scala 2.9 is Eclipse. The current version is far superior to prior versions and includes a context-aware REPL, full-featured debugger, and even the ability to debug REPL statements. I think this question needs to be updated and the answers revisited.
I don't recommend the Scala IDE/Eclipse. It doesn't have a lot of the features that are even available for Eclipse with Java. And there are bugs.
I am using the latest NetBeans and haven't tried anything else. I've met at least 2 notable bugs in NetBeans while coding in Scala:
One: NB occasionally come unable to run a program, hanging on classpath scanning.
Solution: Create a new project, copy your code there and go on.
Comment: This bug is more than 10 years old.
Two: Sometimes NB can't see members of particular namespaces or classes and complains when you use them.
Solution: Just ignore and go on - compiler founds no errors and the program works.
I'd recommend IDEA's plugin for now.
The Scala plugin for NetBeans is quite nice too. It doesn't yet support NetBeans 6.9, the newest release, though, and you still need to download it manually instead of installing it directly from the plugin manager inside NetBeans.
However, it integrates better with Maven projects than IDEA's plugin does (this is true for NB and IDEA in general, in my opinion).
It partly depends on your style of working, as all the options have strengths and weaknesses.
If you need refactoring across mixed java/scala projects, then IntelliJ is your only option.
If you want to do any work on the compiler or a compiler plugin, then Eclipse has the advantage of being able to launch a runtime workspace with a custom compiler build, including breakpoints. It also improved massively for the 2.8 Scala release.
Netbeans is a fine choice to go with if you're already very familiar with that platform, the costs of learning a new environment may well outweigh any benefits, and all three solutions are improving rapidly.
I haven't tried netbeans scala plugin yet, but I find that Intellij IDEA plugin is at any way much better a scala ide than the Scala eclipse plugin, which is sooooo slow that drives me crazy.
Though swing applications don't work well with my tiling window manager.
try IDEAX the latest community edition of Intellij IDEA (version 10), it has improved scala plugin which has faster code compilation and exceution in addition to that it has
Maven3 and SBT support with which we can develop Lift applications.
IntelliJ IDEA community edition + Scala Plugin + SBT plugin
For recent versions (2021) the question which ide takes a big portion of the home page https://scala-lang.org/

What are the good Scala IDEs at the start of 2010?

I know this is an exact duplicate, but a year has gone by and Scala seems to be a fast moving thing, so I figure it might be acceptable to ask again:
What is the best IDE for Scala development right now?
I know the Eclipse plugin is a work in progress and undergoing a complete re-write for Scala 2.8 but I saw a colleague use a nightly-build recently and it was extremely poor.
I use IntelliJ IDEA (the Community Edition 9 is free) and the scala plugin for it is really good. Excellent syntax highlighting, code navigation etc. It's not as good as the Java support but then I wouldn't necessarily expect that. It's good enough that I feel I'm more productive than I would have been in Java!
It has Specs integration and console integration as well.
I tried both Eclipse, NetBeans and IntelliJ IDEA,
Eclipse is the worst in my opinion. It is slow, sometimes messes up the syntax highlighting, almost always messes up the autocompletion and the whole IDE gets unresponsive from time to time. I would not recommend it for any kind of use except for self torturing.
NetBeans works better than the Eclipse plugin. Better highlighting, much better autocompletion but it has been reporting errors on a fairly complex syntax all over the source. But when i hit run, the code compiles just well. Could not understand why. Another issue is that autocomplete can not suggest private members of classes when you are writing inside the body of that class. Poor!
IntelliJ IDEA works just fine. I recommend that if you are seriously leaning against Scala development.
I hope that the Eclipse plugin will be more mature in time but given that it had plenty of time to become mature, I'm not a big fan of the idea. Scala has a great potential, being a well thought, programmer friendly language and running on JVM (which means great performance and high availability) but the poor IDE support is the worst thing for such language. Writing PHP on a simple text editor is acceptable but Scala, with such complex syntax and requirement to use the bloated Java libraries, there is a need of assistance. Maybe the current Scala community with functinal and Java background can not understand this but you can not expect newcomers to easily adopt to such a language instantly.
Anyway, go for IntelliJ IDEA...
Your main options are a fully fledged IDE like IntelliJ IDEA, NetBeans or Eclipse, or a text editor with some Scala awareness like TextMate or Emacs.
Personally, I like IntelliJ the best. I've been using it for Java development for many years, especially due to its refactoring and code navigation power. The Scala plugin was quite rough to start with, but is improving constantly. It's open source, I've been contributing bug reports and a few bug fixes.
The IDE plugins have all been working hard to be ready for Scala 2.8. It's been a moving target during the last 6 months, especially given that binary compatibility was broken as new features were added. So you might update to a new build of the compiler and then wait for supporting libraries (e.g. specs, scalatest) to be updated and recompiled.
Now that the Scala 2.8 Beta is imminent these problems are less frequent.
IntelliJ implements its own parser and type inference, as it does for Java. This lets it be more tolerant of errors and to immediately understand your code as you are editing. The type inference is not complete yet. Eclipse delegates most of this work to scalac, which means it they should always agree, but the information is only regenerated when you save files and the compiler is re-run. I don't know how NetBeans works in this regard.
Right now, IntelliJ's IDEA. And one big difference from now to a year ago is that a free, open source version of IDEA is available.
Personally, I use IDEA CE 9.0.1, but leave compilation&testing to SBT, which I keep running on another window, with cc or ~test.
In the context of 2.8, I have used Eclipse 3.5.x with the nightly plug-in and IDEA Community Edition 9.0. IDEA has been clearly better for me, except for compilation times. But I use sbt in parallel and it takes care of that.
My main issues with the Eclipse plug-in are:
Inability to change my tab settings in Eclipse (though that seems to work for others)
Code compiles but some errors are still highlighted and I need to close and reopen the file
Auto-completion just returns a lot of choices
I did not have those issues in IDEA 9.0 build #IC-93.13 with the recent plug-in 0.3.385. Additionally IDEA shows me unused import statements.
All plug-ins seem to be evolving quite quickly and are actively developed and I suspect that what is true today may not be in one month. I hope that in a few months from now, we will just be able to use our favorite IDE and have good Scala support.
(note this is a repost of my recent answer to the original question)

Worth Upgrading from Intellij Idea7 to Idea8?

I use Intellij Idea 7 for Java dev. My dev is 'limited' to all J2SE features plus light JSP, Servlets, and super light usage of JPA. No J2EE, no massive use of random frameworks, etc.
Is it worth upgrading to ver 8? "Worth it" to me means better "core functionality" in terms of speed (ESPECIALLY startup speed), memory utilization (seems like it starts having serious problems with four or more projects open), and auto bug-finding.
More frameworks supported and more languages supported (other than perhaps Haskell and C++), and more refactorings don't interest me at this time.
A while back, I installed a preview version of 8 and it seemed -exactly- the same as 7, as far as my needs were concerned.
Anyone loving the upgrade to 8, and if so, why?
Thanks
It also seems to be easier to configure a new project over top of a complex collection of existing code.
For example, something that you would naturally configure into 5 or more modules.
There is a really beautiful go to/create test wizard that is bound to ctrl-shift-T. Worth the upgrade by itself
The best way to tell is to check out the list of new features and decide for yourself. I haven't discovered any single feature so far that by itself is worth upgrading - the simplified UML view is quite nice, as is the improved Maven integration. The UI feels a bit more streamlined and faster. It seems like most of the attention has gone into non-Java features like better Flex support (which I am really thankful for as I don't like FlexBuilder but I haven't had a chance to use yet).
IntelliJ 8 has a configure plugins feature that allows you to disable plugins with dependencies. Nothing trial and error couldn't replicate, but it is nice.
Startup is only marginally slower. But indexing once opened is a lot faster than before, even unnoticeable for most projects, except after a commit to Subversion. It seems a commit to subversion triggers the indexing twice.
I am working on the Diana-EAP build - but 8 has git integration built in. The EAP has better git integration than the 8.0.1 release - it looks like that is something they are really focusing on.
Definitely not! Seems that the variables defined in our custom taglibs are no longer able to be used in the jsp (worked in 7.0.4). All red. No auto complete.
Oh, and the new settings menu is horrendous!
Some benefits of IntelliJ IDEA 8:
IDEA 8 supports Subversion 1.5 new functionality - e.g. merge tracking, which may be useful especially if your team (like ours) uses a lot of development branches and thus merging is frequent.
One detail I appreciated about IDEA 8: As you probably know, IDEA has had changelists for pretty long now, built on top of any underlying version control system - this is a really useful feature. So, now that Subversion itself supports changeslists, IDEA's changelist implementation has been changed so that it is perfectly compatible with Subversion's native changeslists. (For example, you'll be able to work with any changelists created in IDEA also when using svn command line tools directly.)
Edit: in your case, perhaps it is not worthwhile to upgrade. For me, at least, startup and file indexing seems to be somewhat slower in 8 than 7. [But for me personally the upgrade was definitely worth it, because it solved a long-standing VCS problem with IDEA 7 - it could hang "waiting for VCS sync to finish" for an hour or whatever after hitting Ctrl-K.]