ecj

Mockito: Verifying overloaded methods with type-compatible arguments

倖福魔咒の 提交于 2019-12-04 09:49:59
Consider you want to mock an interface using Mockito containing the following method signatures: public void doThis(Object o); public void doThis(Object... o) I need to verify that doThis(Object o) (and not the other method) has been invoked exactly one time. First I thought that the following line would do the trick: verify(mock, times(1)).doThis(anyObject()); However, as this seems to work on Windows, it doesn't on Linux because in this environment, a call to of the other doThis method is expected. This is caused because the anyObject() argument seems to match both method signatures and one

Strange “!*” entry in LocalVariableTypeTable when compiling with eclipse compiler

浪尽此生 提交于 2019-12-01 03:18:06
Let's compile the following code with ECJ compiler from Eclipse Mars.2 bundle: import java.util.stream.*; public class Test { String test(Stream<?> s) { return s.collect(Collector.of(() -> "", (a, t) -> {}, (a1, a2) -> a1)); } } The compilation command is the following: $ java -jar org.eclipse.jdt.core_3.11.2.v20160128-0629.jar -8 -g Test.java After the successful compilation let's check the resulting class file with javap -v -p Test.class . The most interesting is the synthetic method generated for the (a, t) -> {} lambda: private static void lambda$1(java.lang.String, java.lang.Object);

Strange “!*” entry in LocalVariableTypeTable when compiling with eclipse compiler

↘锁芯ラ 提交于 2019-11-30 22:34:51
问题 Let's compile the following code with ECJ compiler from Eclipse Mars.2 bundle: import java.util.stream.*; public class Test { String test(Stream<?> s) { return s.collect(Collector.of(() -> "", (a, t) -> {}, (a1, a2) -> a1)); } } The compilation command is the following: $ java -jar org.eclipse.jdt.core_3.11.2.v20160128-0629.jar -8 -g Test.java After the successful compilation let's check the resulting class file with javap -v -p Test.class . The most interesting is the synthetic method

Using Eclipse Java Compiler (ecj) in maven builds

不想你离开。 提交于 2019-11-26 20:44:02
Eclipse uses it's own compiler (ECJ) to compile Java code. Debugging a program compiled with Eclipse is easier, because simple code changes can be applied instantly (by the hot code replacement). Maven on the other hand uses (by default) oracle JDK, that generates different byte code preventing hot code replacement in a Eclipse debug session. So I would like to use Eclipse ECJ compiler with my maven build, if I plan to debug the program. A convenient way for me would be a "ecj" profile: Compile release $ mvn package Compile snapshot with enabled hot code replacement $ mvn -P ecj package Also

Using Eclipse Java Compiler (ecj) in maven builds

走远了吗. 提交于 2019-11-26 07:44:56
问题 Eclipse uses it\'s own compiler (ECJ) to compile Java code. Debugging a program compiled with Eclipse is easier, because simple code changes can be applied instantly (by the hot code replacement). Maven on the other hand uses (by default) oracle JDK, that generates different byte code preventing hot code replacement in a Eclipse debug session. So I would like to use Eclipse ECJ compiler with my maven build, if I plan to debug the program. A convenient way for me would be a \"ecj\" profile: