Opened 6 years ago

Closed 4 years ago

#55587 closed defect (fixed)

junit 4.6 on 10.13 JUnitMatchers.java:87: error: incompatible types

Reported by: sandiway Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: Cc: lcvisser (Ludo Visser), kenroser, pierswalter (Piers Uso Walter), HarryPayne (Harry Payne), duncanwp (Duncan Watson-Parris), chrstphrchvz (Christopher Chavez)
Port: junit

Description (last modified by mf2k (Frank Schima))

I am compiling swi-prolog on 10.13 (yes I am running correct macports 2.4.2), which depends on junit and in turn hamcrest-core. There are Java versioning issues here, which I'm unable to resolve. A brief summary below. Note that I tried all possible cases (doing a full uninstall installed each time).

  1. Apple's legacy javaforosx.dmg doesn't work of course since ANT requires Java8.

(Cite: The Apache Ant team currently maintains two lines of development. The 1.9.x releases require Java5 at runtime and 1.10.x requires Java8 at runtime.)

  1. The latest Java9 doesn't work and results in the other error reported in Dec 2017 for junit 4.6 since 1.5 generates an error (not a mere warning, new for Java9)

(Cite: In JDK 8, -source and -target values of 1.5/5 and earlier were deprecated and caused a warning to be generated. In JDK 9, those values cause an error.)

  1. Therefore the only possible option will be to install using Java8.

Due to Apple's locking down of /usr, we set JAVA_HOME using: export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home" so we can use javac with Java8/9. (Note; hamcrest-core passes fine using Java8.)

unfortunately, junit 4.6 fails with

/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_java_junit/junit/work/junit4.6/src/main/java/org/junit/matchers/JUnitMatchers.java:87: error: incompatible types: no instance(s) of type variable(s) LHS exist so that CombinableBothMatcher<LHS> conforms to CombinableMatcher<T>
:info:build     [javac] 		return CoreMatchers.both(matcher);
:info:build     [javac] 		                        ^
:info:build     [javac]   where LHS,T are type-variables:
:info:build     [javac]     LHS extends Object declared in method <LHS>both(Matcher<? super LHS>)
:info:build     [javac]     T extends Object declared in method <T>both(Matcher<? super T>)
:info:build     [javac] /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_java_junit/junit/work/junit4.6/src/main/java/org/junit/matchers/JUnitMatchers.java:99: error: incompatible types: no instance(s) of type variable(s) LHS exist so that CombinableEitherMatcher<LHS> conforms to CombinableMatcher<T>
:info:build     [javac] 		return CoreMatchers.either(matcher);
:info:build     [javac] 		                          ^
:info:build     [javac]   where LHS,T are type-variables:
:info:build     [javac]     LHS extends Object declared in method <LHS>either(Matcher<? super LHS>)
:info:build     [javac]     T extends Object declared in method <T>either(Matcher<? super T>)
:info:build     [javac] Note: 

Change History (14)

comment:1 Changed 6 years ago by mf2k (Frank Schima)

Priority: HighNormal

The Priority field is for use by Macports team members only.

comment:2 Changed 6 years ago by mf2k (Frank Schima)

In the future, please use WikiFormatting.

comment:3 Changed 6 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:4 Changed 6 years ago by kierans (Kieran Simpson)

This is also related to #55530

comment:5 Changed 6 years ago by lcvisser (Ludo Visser)

Cc: lcvisser added

comment:6 in reply to:  5 Changed 6 years ago by lcvisser (Ludo Visser)

Replying to lcvisser:

I ran into this when trying to install subversion-javahlbindings, which I needed to reinstall after updating to Mac OS X 10.13 and Eclipse from Mars to Oxygen.

comment:7 Changed 6 years ago by kenroser

Cc: kenroser added

comment:8 Changed 6 years ago by pierswalter (Piers Uso Walter)

Cc: pierswalter added

comment:9 Changed 6 years ago by HarryPayne (Harry Payne)

Cc: HarryPayne added

comment:10 Changed 6 years ago by duncanwp (Duncan Watson-Parris)

Cc: duncanwp added

comment:11 Changed 5 years ago by pierswalter (Piers Uso Walter)

For what it's worth: I no longer see the problem on macOS 10.14.1 with Mac Ports 2.5.4.

I can now build junit (@4.12_0) and hence also subversion-javahlbindings (@1.11.0_0+no_bdb) without any problems.

Last edited 5 years ago by pierswalter (Piers Uso Walter) (previous) (diff)

comment:12 in reply to:  11 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Replying to pierswalter:

For what it's worth: I no longer see the problem on macOS 10.14.1 with Mac Ports 2.5.4.

I can now build junit (@4.12_0) and hence also subversion-javahlbindings (@1.11.0_0+no_bdb) without any problems.

I agree this was fixed as of [a25b56bd7d/macports-ports] (junit 4.12_0); the port now uses the prebuilt binary distribution instead of attempting to build from the source distribution.

Can this ticket be closed?

comment:13 Changed 4 years ago by chrstphrchvz (Christopher Chavez)

Cc: chrstphrchvz added

comment:14 Changed 4 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.