make fired by a Junit test does not compile the same way as the ordinary build ?

Here is the problem:
I changed code to adapt to java 1.8: some methods of a Class were moved to default methods of an interface.
everything compiles fine.
but when I start a Junit tests there is a make which is fired and then the compiler pretends that it does not find the methods that were moved .... curioulsy this does not happen on all codes (only on some  modules)

I tried to be sure that all modules were using the 1.8 compiler and were generating 1.8 binaries -> ok
but the snag still persist

knowing what the make does in detail will be helpful to understand the problem

any hint on what to check?

Comment actions Permalink


Compiler results are displayed in Messages tool window. The first line of report names the javac version. What is written in that line?


Comment actions Permalink

ok (i was not aware of that due to the shortcut)
will try to reproduce the error

well this first line exists when I exceute code but not for the make: I just get compiler errors without the slightest idea of what is the context of the compilation ?:|

here is a copy of the  make (only the beggining )
Information:Using javac 1.8.0-ea to compile java sources
Information:java: Errors occurred while compiling module 'org-lsst-ccs-subsystem-fcs-main'
Information:Compilation completed with 7 errors and 12 warnings in 6 sec
Information:7 errors
Information:12 warnings
Warning:java: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
    Error:Error:line (664)java: incompatible types: java.lang.String cannot be converted to long
but the code compiles perfectly when not executed through Junit

Comment actions Permalink

I've got an email notification about your comment, and that email mentions JDK 1.6.0. However, now on the web I see that your comment is different. So I'm not completely sure what's going on.

So, if JUnit runs with some "wrong" JDK, please check its run configuration, settings "Use classpath of module" and "Use alternate JRE".

If Maven is involved then please check also Settings / ... / Maven / Runner page.

If the problem is with compiler, then Settings / ... / Compiler / Java Compiler page may contain something not desirable.

Thank you,

Comment actions Permalink

I edited my comment because this morning I made a confusion between the run and the make.
all modules are configuraed to be compiled with java 1.8 (I checked and re-checked)
the compiler is also configured with java 8
I have maven modules but do not use these ( I switched maven off)
- everything just compiles fine
- but the "make" fired by JUnit just recompiles some code (why?) and fails (unable to get java8 default methods from an interface)
if I had a way to find what the "make" does that would be great.

edit: I tested the problem does lie with Junit but with "make"

Comment actions Permalink

problem solved!
(why on earth is there TWO places to configure the language level : one in compiler (and then a list with  each module) and the other in the module description: there was an unspotted conflict !

thanks anyway


Please sign in to leave a comment.