aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-08-24 11:18:01 +0200
committerHarald Musum <musum@yahooinc.com>2023-08-24 11:18:01 +0200
commit72ffe30cfd5aeac44f3ac67b65d8af84b286379e (patch)
tree7581e1887f20771fb8c1b2af02d614a8891c8d01
parent159e6e2dabc5e24583bd5e173ff2856046c968e4 (diff)
Generate warning about 'file' config type in another place
Seeing warnings in config server logs (used when reading application package and creating config) so move to a place that will only be logged when generating config classes
-rw-r--r--configgen/src/main/java/com/yahoo/config/codegen/DefLine.java4
-rw-r--r--configgen/src/main/java/com/yahoo/config/codegen/LeafCNode.java32
2 files changed, 18 insertions, 18 deletions
diff --git a/configgen/src/main/java/com/yahoo/config/codegen/DefLine.java b/configgen/src/main/java/com/yahoo/config/codegen/DefLine.java
index 48e1b58816e..fc54f03ad8b 100644
--- a/configgen/src/main/java/com/yahoo/config/codegen/DefLine.java
+++ b/configgen/src/main/java/com/yahoo/config/codegen/DefLine.java
@@ -34,6 +34,10 @@ public class DefLine {
StringBuilder sb = new StringBuilder(line);
int parsed = parseNameType(sb);
sb.delete(0, parsed);
+ if (type.name.equals("file")) {
+ // Note: 'file' is used internally and also there is no support for 'path' in C++, so cannot be removed yet
+ System.out.println("Warning: config type 'file' is deprecated, use 'path' instead");
+ }
if (type.name.equals("enum")) {
parsed = parseEnum(sb);
sb.delete(0, parsed);
diff --git a/configgen/src/main/java/com/yahoo/config/codegen/LeafCNode.java b/configgen/src/main/java/com/yahoo/config/codegen/LeafCNode.java
index 59b1c781c76..afd6acfbabf 100644
--- a/configgen/src/main/java/com/yahoo/config/codegen/LeafCNode.java
+++ b/configgen/src/main/java/com/yahoo/config/codegen/LeafCNode.java
@@ -17,24 +17,20 @@ public abstract class LeafCNode extends CNode {
public static LeafCNode newInstance(DefLine.Type type, InnerCNode parent, String name) {
try {
- switch (type.name) {
- case "int": return new IntegerLeaf(parent, name);
- case "long": return new LongLeaf(parent, name);
- case "double": return new DoubleLeaf(parent, name);
- case "bool": return new BooleanLeaf(parent, name);
- case "string": return new StringLeaf(parent, name);
- case "reference": return new ReferenceLeaf(parent, name);
- case "file": {
- // Note: Used internally and also no support for path in C++, so cannot be removed in Vespa 9
- System.out.println("Warning: config type 'file' is deprecated, use 'path' instead");
- return new FileLeaf(parent, name);
- }
- case "path": return new PathLeaf(parent, name);
- case "enum": return new EnumLeaf(parent, name, type.enumArray);
- case "url" : return new UrlLeaf(parent, name);
- case "model" : return new ModelLeaf(parent, name);
- default: return null;
- }
+ return switch (type.name) {
+ case "int" -> new IntegerLeaf(parent, name);
+ case "long" -> new LongLeaf(parent, name);
+ case "double" -> new DoubleLeaf(parent, name);
+ case "bool" -> new BooleanLeaf(parent, name);
+ case "string" -> new StringLeaf(parent, name);
+ case "reference" -> new ReferenceLeaf(parent, name);
+ case "file" -> new FileLeaf(parent, name);
+ case "path" -> new PathLeaf(parent, name);
+ case "enum" -> new EnumLeaf(parent, name, type.enumArray);
+ case "url" -> new UrlLeaf(parent, name);
+ case "model" -> new ModelLeaf(parent, name);
+ default -> null;
+ };
} catch (NumberFormatException e) {
return null;
}