From 9099abcd01664acc9e612585bca58a0359771ef8 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Fri, 8 Nov 2024 10:04:21 -0500 Subject: [PATCH] Updates since groovy 4.0.24 is released --- build.gradle | 6 -- .../GlobalTraitRepairTransformation.groovy | 75 ------------------- ...odehaus.groovy.transform.ASTTransformation | 1 - 3 files changed, 82 deletions(-) delete mode 100644 grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm/GlobalTraitRepairTransformation.groovy diff --git a/build.gradle b/build.gradle index 4b0803a21f4..490c4d6506b 100644 --- a/build.gradle +++ b/build.gradle @@ -46,12 +46,6 @@ allprojects { if(isSnapshot) { maven { url = 'https://repo.grails.org/grails/libs-snapshots-local' } } - if(groovyVersion && groovyVersion.endsWith('-SNAPSHOT')) { - maven { - name = 'ASF Snapshot repo' - url = 'https://repository.apache.org/content/repositories/snapshots' - } - } } configurations { diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm/GlobalTraitRepairTransformation.groovy b/grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm/GlobalTraitRepairTransformation.groovy deleted file mode 100644 index 43a477ea58c..00000000000 --- a/grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm/GlobalTraitRepairTransformation.groovy +++ /dev/null @@ -1,75 +0,0 @@ -package org.grails.compiler.gorm - -import groovy.transform.CompileStatic -import org.codehaus.groovy.ast.ASTNode -import org.codehaus.groovy.ast.ClassHelper -import org.codehaus.groovy.ast.ClassNode -import org.codehaus.groovy.ast.GenericsType -import org.codehaus.groovy.ast.MethodNode -import org.codehaus.groovy.ast.ModuleNode -import org.codehaus.groovy.control.CompilePhase -import org.codehaus.groovy.control.SourceUnit -import org.codehaus.groovy.transform.ASTTransformation -import org.codehaus.groovy.transform.GroovyASTTransformation -import org.grails.datastore.gorm.query.transform.DetachedCriteriaTransformer -import org.grails.datastore.mapping.reflect.AstUtils - -/** - * Repairs the AST due to bugs in the way {@link org.codehaus.groovy.transform.trait.TraitComposer} works. See https://issues.apache.org/jira/browse/GROOVY-7846 - * - * Once those issues are addressed this can be removed - * - * @author Graeme Rocher - * @since 6.0 - */ -@CompileStatic -@GroovyASTTransformation(phase= CompilePhase.CANONICALIZATION) -class GlobalTraitRepairTransformation implements ASTTransformation { - - private static final Object TRANSFORM_APPLIED_MARKER = new Object() - - private static final boolean ENABLED - - static { - String groovyVersion = GroovySystem.version - if(groovyVersion.startsWith("2.4.")) { - try { - ENABLED = groovyVersion.split(/\./)[2].toInteger() < 7 - } catch (Throwable e) { - ENABLED = false - } - } - else { - ENABLED = false - } - } - @Override - void visit(ASTNode[] nodes, SourceUnit source) { - if(ENABLED) { - ModuleNode ast = source.getAST(); - List classes = ast.getClasses(); - for (ClassNode aClass : classes) { - visitClass(aClass) - } - } - } - - void visitClass(ClassNode aClass) { - if (ENABLED && aClass.getNodeMetaData(TRANSFORM_APPLIED_MARKER) == null) { - - if (AstUtils.implementsInterface(aClass, "org.grails.datastore.gorm.GormEntity") || AstUtils.implementsInterface(aClass, "grails.gorm.rx.RxEntity")) { - aClass.putNodeMetaData(TRANSFORM_APPLIED_MARKER, Boolean.TRUE) - def allMethods = aClass.getMethods() - for (MethodNode mn in allMethods) { - for (GenericsType gt in mn.returnType.genericsTypes) { - if (gt.name == aClass.name) { - gt.setType(ClassHelper.make(aClass.name).getPlainNodeReference()) - } else if (gt.name == 'T') { - mn.setReturnType(ClassHelper.make(Object).getPlainNodeReference()) - } - } - } - } - } - } -} \ No newline at end of file diff --git a/grails-datastore-gorm/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation b/grails-datastore-gorm/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation index b3b04435d0b..7b1e2316fa3 100644 --- a/grails-datastore-gorm/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation +++ b/grails-datastore-gorm/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation @@ -1,3 +1,2 @@ org.grails.datastore.gorm.query.transform.GlobalDetachedCriteriaASTTransformation -org.grails.compiler.gorm.GlobalTraitRepairTransformation org.grails.compiler.gorm.GlobalJpaEntityTransform