borinquenkid commented on code in PR #15568: URL: https://github.com/apache/grails-core/pull/15568#discussion_r3440427581
########## grails-data-hibernate7/core/src/main/groovy/grails/orm/CriteriaMethods.java: ########## @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package grails.orm; + +import groovy.lang.MissingMethodException; + +/** Enum representing the supported methods in HibernateCriteriaBuilder. */ +public enum CriteriaMethods { Review Comment: Follow-up: subclassing `HibernateCriteriaBuilder` is still possible — the class is not `final`. The `CriteriaMethods` enum handles dispatch for the built-in method names; a subclass can still override `invokeMethod` to intercept calls or add custom criteria. The enum approach actually makes it easier to enumerate the known method set rather than relying on a long `if/else` chain. Not a blocker. ########## grails-gsp/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPagesServlet.java: ########## @@ -117,7 +117,7 @@ protected void initFrameworkServlet() throws BeansException { context.setAttribute(SERVLET_INSTANCE, this); final WebApplicationContext webApplicationContext = getWebApplicationContext(); - grailsAttributes = GrailsFactoriesLoader.loadFactoriesWithArguments(GrailsApplicationAttributes.class, getClass().getClassLoader(), new Object[]{context}).get(0); + grailsAttributes = GrailsFactoriesLoader.loadFactoriesWithArguments(GrailsApplicationAttributes.class, Thread.currentThread().getContextClassLoader(), new Object[]{context}).get(0); Review Comment: Follow-up: no sign-off needed — `Thread.currentThread().getContextClassLoader()` is the standard Servlet container pattern for resolving webapp resources. `getClass().getClassLoader()` returns the *framework* classloader, which cannot see app classes, plugin classes, or GSP files contributed by plugins. The TCCL in a Servlet container is the webapp classloader, which is exactly right here. The change is correct and safe. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
