Earlier this year, I worked on a new project until about May. At that point, I had an STS 2.8.1 installation that worked, and the project had been successfully upgraded to Grails 2.0.0. So far so good.
The project only has tests in it, as it contains functional tests written using Spock to be run against a RESTful web service.
Last week, I picked the project up again, and by this time, my STS had been upgraded to 2.9.1. Importing the project into the workspace I saw strange error markers in two of the test specs, with text starting with "Found unexpected MOP methods in the class node".
I tried GGTS 3.0.0 - same problem.
By removing all the code, and re-adding it bit by bit, I've narrowed the problem down to an anonymous inner class.
The offending code looks like this:
The fix is to replace the inner class with this:Code:import javax.servlet.http.HttpServletResponse import groovyx.net.http.* import static groovyx.net.http.Method.HEAD import static groovyx.net.http.ContentType.* import java.security.KeyStore import org.apache.http.conn.scheme.Scheme import org.apache.http.conn.ssl.* import spock.lang.* import java.security.cert.X509Certificate import java.security.cert.CertificateException class BaseSpecification extends Specification { protected RESTClient makeRESTCLient(String url) { def rest = new RESTClient(url) SSLSocketFactory sf = new SSLSocketFactory(new TrustStrategy { @Override public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { return true } }, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER) rest.client.connectionManager.schemeRegistry.register( new Scheme("https", sf, 8443)) return rest } }
and define NewTrustStrategy as a normal class.Code:SSLSocketFactory sf = new SSLSocketFactory(new NewTrustStrategy(), SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)
This seems to be a regression in the Groovy-Eclipse joint compiler - there are no such problems with the Groovy compiler used by Grails 2.0.0.
Has anyone come across this before? Is there a known limitation in the latest Groovy-Eclipse compiler?
I'm happy to raise an issue if it is a regression.
Ian


Reply With Quote