[ https://issues.apache.org/jira/browse/GROOVY-6236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-6236. ----------------------------- Resolution: Invalid Assignee: Paul King Some instanceof issues were fixed in 2.4.13. The example here doesn't seem like a new example or even valid (shouldn't be an instanceof but rather isAssignableFrom). Please reopen or create a new issue if there still remains a case that isn't handled. > CompileStatic with negated instanceof check causes compilation to fail > ---------------------------------------------------------------------- > > Key: GROOVY-6236 > URL: https://issues.apache.org/jira/browse/GROOVY-6236 > Project: Groovy > Issue Type: Bug > Components: Static compilation > Affects Versions: 2.1.5 > Reporter: Graeme Rocher > Assignee: Paul King > Priority: Major > > The following class: > {code} > class JsonHttpMessageConverter extends > AbstractHttpMessageConverter<JSONElement>{ > ... > @Override > boolean canWrite(Class<?> clazz, MediaType mediaType) { > return !(clazz instanceof JSON) && super.canWrite(clazz, mediaType) > ... > {code} > Fails to compile with > {code} > Groovyc: [Static type checking] - Cannot find matching method > org.springframework.http.converter.AbstractHttpMessageConverter#canWrite(<UnionTypejava.lang.Class+grails.converters.JSON>, > org.springframework.http.MediaType). Please check if the declared type is > right and if the method exists. > {code} > Reversing the conditions (ie making the negated instanceof first) makes it > pass compilation -- This message was sent by Atlassian JIRA (v7.6.3#76005)