All of a sudden, intellij-idea 2017.1.5 does not allow me to iterate over a Collection<String>
with a forach
and a String
variable.
The simple piece of code:
for (String methodPath : methodsService.getMethodPaths()) {
// ....
}
where
private Map<String, MethodMeta> methods = new HashMap<>();
public Collection<String> getMethodPaths() {
return this.methods.keySet();
}
is marked as error with the suggestion to change the variable methodPath
from String
to Object
.
At the beginning, I thought the IDE was just indexing and the error for some later-edited code was still appearing, which wouldn't bother me as much, but it actually does not compile the project:
Compile error during compilation with javac.
C:\workspace...\MyFileName.java:23
error: incompatible types: Object cannot be converted to String
I'm using java-8 version 131.
Restarting the PC, does not make the error disappear.