Skip to content

Commit

Permalink
GROOVY-8096
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Aug 27, 2023
1 parent 045b29e commit a51a8c0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,16 @@ private void setScriptBaseClassFromConfig(final ClassNode cn) {
}
if (baseClassName != null) {
if (!cn.getSuperClass().getName().equals(baseClassName)) {
/* GRECLIPSE edit -- GROOVY-8096
cn.setSuperClass(ClassHelper.make(baseClassName));
*/
ClassLoader cl = unit != null ? unit.getClassLoader() : context.getClassLoader();
try {
cn.setSuperClass(ClassHelper.make(cl.loadClass(baseClassName)));
} catch (ReflectiveOperationException | RuntimeException e) {
cn.setSuperClass(ClassHelper.make(baseClassName));
}
// GRECLIPSE end
AnnotationNode annotationNode = new AnnotationNode(BaseScriptASTTransformation.MY_TYPE);
cn.addAnnotation(annotationNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,16 @@ private void setScriptBaseClassFromConfig(final ClassNode cn) {
}
if (baseClassName != null) {
if (!cn.getSuperClass().getName().equals(baseClassName)) {
/* GRECLIPSE edit -- GROOVY-8096
cn.setSuperClass(ClassHelper.make(baseClassName));
*/
ClassLoader cl = unit != null ? unit.getClassLoader() : context.getClassLoader();
try {
cn.setSuperClass(ClassHelper.make(cl.loadClass(baseClassName)));
} catch (ReflectiveOperationException | RuntimeException e) {
cn.setSuperClass(ClassHelper.make(baseClassName));
}
// GRECLIPSE end
AnnotationNode annotationNode = new AnnotationNode(BaseScriptASTTransformation.MY_TYPE);
cn.addAnnotation(annotationNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,16 @@ private void setScriptBaseClassFromConfig(final ClassNode cn) {
}
if (baseClassName != null) {
if (!cn.getSuperClass().getName().equals(baseClassName)) {
/* GRECLIPSE edit -- GROOVY-8096
cn.setSuperClass(ClassHelper.make(baseClassName));
*/
ClassLoader cl = unit != null ? unit.getClassLoader() : context.getClassLoader();
try {
cn.setSuperClass(ClassHelper.make(cl.loadClass(baseClassName)));
} catch (ReflectiveOperationException | RuntimeException e) {
cn.setSuperClass(ClassHelper.make(baseClassName));
}
// GRECLIPSE end
AnnotationNode annotationNode = new AnnotationNode(BaseScriptASTTransformation.MY_TYPE);
cn.addAnnotation(annotationNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static CompilerConfiguration newCompilerConfiguration(final CompilerOptio
ic.addStarImports("org.codehaus.groovy.ast.expr");
if (GroovyUtils.getGroovyVersion().compareTo(new Version(4, 0, 6)) >= 0) ic.addStarImports("org.codehaus.groovy.ast");
ic.addStaticStars("org.codehaus.groovy.ast.ClassHelper","org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport");
config.addCompilationCustomizers(ic).setScriptBaseClass("org.codehaus.groovy.transform.stc.GroovyTypeCheckingExtensionSupport.TypeCheckingDSL");
config.addCompilationCustomizers(ic).setScriptBaseClass("org.codehaus.groovy.transform.stc.GroovyTypeCheckingExtensionSupport$TypeCheckingDSL");

return config;
}
Expand Down

0 comments on commit a51a8c0

Please sign in to comment.