Ruben Q L created CALCITE-4834:
----------------------------------

             Summary: JaninoRelMetadataProvider uses hardcoded class name
                 Key: CALCITE-4834
                 URL: https://issues.apache.org/jira/browse/CALCITE-4834
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Ruben Q L
            Assignee: Ruben Q L
             Fix For: 1.28.0


This seems caused by CALCITE-4546.

{{JaninoRelMetadataProvider}} lines 135 & 141 is using (for the generated code) 
the hardcoded name of the class {{MetadataDef}}:
{code}
buff.append("  private final org.apache.calcite.rel.metadata.MetadataDef 
def;\n");
for (Map.Entry<MetadataHandler<?>, String> handlerAndName : 
handlerToName.entrySet()) {
  ...
  .append("      org.apache.calcite.rel.metadata.MetadataDef def");
{code}

This can lead to issues (e.g. if a downstream project shades Calcite library). 
The safer way to do this is using {{Class#getName}}, as it is already done in 
the rest of the code, e.g. in {{JaninoRelMetadataProvider:158}}:
{code}
.append(MetadataDef.class.getName())
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to