groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tatai Márton <>
Subject Purpose of MetaClass.getClassNode
Date Sun, 16 Apr 2017 14:41:48 GMT

I was going through the source code of the GROOVY_2_5_X branch, just
studying the inner workings of the runtime. (So if I'm saying something
foolish please excuse my inexperience)
I came across groovy.lang.MetaClass.getClassNode, which strikes me as an
inappropriate method as a part of the runtime. This method seems
potentially useful, but unnecessarily couples compile time to the runtime
As far as static analysis goes, I've found getClassNode used in some tests
for AstBuilder, and as part of some clever tricks in groovy.sql.DataSet.
As I've already established, I'm not an expert at the matter, but I think
the MetaClass interface would be cleaner without this method. I realise
that it's part of a public(?) interface, so deletion might not be an
option, but do you think a deprecation and a stern warning would be
appropriate? The MetaClassImpl implementation of this method only works as
long as the source is available and can be located on the classpath. Even
if this is the case, the compiler is pretty convoluted, and I'm not even
sure that the same AST can be generated at runtime as compile time.
I've tried to look into the history of this method, and a pretty ancient
commit mentions this as a residual feature, which should be removed:

Best regards

View raw message