Mmuzaf commented on code in PR #2334:
URL: https://github.com/apache/cassandra/pull/2334#discussion_r1196863682


##########
src/java/org/apache/cassandra/config/WithReplacementLoader.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
+ *     http://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 org.apache.cassandra.config;
+
+import java.util.Map;
+
+import org.yaml.snakeyaml.introspector.Property;
+
+public class WithReplacementLoader extends DefaultLoader
+{
+    @Override
+    public Map<String, Property> getProperties(Class<?> root)
+    {
+        Map<String, Property> properties = super.getProperties(root);
+        // only handling top-level replacements for now, previous logic was 
only top level so not a regression
+        Map<String, Replacement> replacements = 
Replacements.getNameReplacements(Config.class).get(root);

Review Comment:
   I think you're right and we can avoid using it here. I have reused 
`getReplacements` and it seems to work perfectly. We need to use the same 
`Loader` for the `YamlConfigurationLoader.PropertiesChecker` to have a 
guarantee that the class will do checks on the same set of properties.
   
   So I think I have fixed your comment, but there are still some code 
improvements to be made: we can get rid of `Replacements` and move 
`YamlConfigurationLoader#verifyReplacements` right to the `PropertiesChecker`, 
but I think it is part of another improvement.



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to