KML support Compilation failure - incompatible types: bad type in conditional expression

Description

I'm getting a compilation failure when trying to build GeoServer master.

— maven-compiler-plugin:2.3.2:compile (default-compile) @ gs-kml —
Compiling 58 source files to E:\Users\mase\work\Projects\OGC_1G\GeoServerDev\geoserver\src\kml\target\classes
-------------------------------------------------------------
COMPILATION ERROR :
-------------------------------------------------------------
org/geoserver/kml/icons/IconService.java:[80,53] error: incompatible types: bad type in conditional expression
1 error

The line
https://github.com/geoserver/geoserver/blob/master/src/kml/src/main/java/org/geoserver/kml/icons/IconService.java#L79

has a Map<String, Object> KvpUtils.parseQueryString(String) being assigned to Map<String, String> properties.

I guess this is Java 8 getting stricter as it has compiled fine before, I'm surprised/confused why this hasn't been found by anyone else yet and am not sure exactly what I may have changed to get this problem but the code does seem to need changing anyway so I will make a pull request with fix.

Environment

None

Activity

Show:
Marcus Sen
November 12, 2015, 1:24 PM

Oracle Java JDK 1.8.0_25
Maven 3.3.3

As noted above, compilation is fine if the source and target versions for maven-compiler-plugin in src/pom.xml are left at 1.7, but I found after inadvertently changing these to 1.8 the compiler error. Is this not reproducible for you?

Brad Hards
November 13, 2015, 9:33 AM
Edited

I can reproduce the problem with the 1.8 version change.

I'm not sure that there is a (sensible) case where the icon properties would be multi-valued, but the change looks OK to me. I didn't actually test it though.

Also, this probably doesn't really qualify as a Highest priority bug, IMO.

Marcus Sen
November 13, 2015, 9:46 AM

No, it shouldn't be a highest priority bug, that was a mistake when I thought the compilation wasn't working and hadn't realised that I had inadvertently edited the pom. As per my apology above I agree it can be demoted from "highest".

I also don't think there would be multi-valued icon properties so I've picked the first one in the array but the same method is used in several different places and so I've left it as is. I might get around to looking at the other places it is used in more detail to see if there is some further re-factoring that could be done but that will be even lower priority...

Marcus Sen
November 13, 2015, 9:49 AM

I don't think I am able to edit the priority myself...

Andrea Aime
February 15, 2017, 11:48 AM

Mass closing all resolved issues not modified in the last 4 weeks

Fixed

Assignee

Unassigned

Reporter

Marcus Sen

Triage

None

Fix versions

Affects versions

None

Components

Priority

Low