You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Ruben Q L (Jira)" <ji...@apache.org> on 2021/10/06 15:45:00 UTC
[jira] [Commented] (CALCITE-4834) JaninoRelMetadataProvider uses
hardcoded class name
[ https://issues.apache.org/jira/browse/CALCITE-4834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17425047#comment-17425047 ]
Ruben Q L commented on CALCITE-4834:
------------------------------------
FYI [~jamesstarr], [~jcamachorodriguez]
> 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
> Priority: Major
> Fix For: 1.28.0
>
>
> This seems caused by CALCITE-4546 ([fbbdf46|https://github.com/apache/calcite/commit/fbbdf465df46b4e6f9863d7d1dfdcb19a43f2032])
> {{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)