[ 
https://issues.apache.org/jira/browse/CALCITE-4079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17151432#comment-17151432
 ] 

Julian Hyde commented on CALCITE-4079:
--------------------------------------

bq. In general using a subclass during the initialization of the superclass is 
a bad idea. I think we should prohibit this pattern.

Certainly discourage the practice. IntelliJ warns about it.

[~zabetak] and [~winipanda], In CALCITE-3923, I plan to move many rule 
instances into 'holder' classes such as EnumerableRules and BindableRules. Note 
that these holder classes are not super-classes of the rules, in fact do not 
extend or inherit anything besides Object. Do you think that this pattern is 
likely to increase class-loading problems?

We would remove a few of the old instance variables (usually called INSTANCE 
and belonging to a rule class) in 1.24, but most would still exist, deprecated, 
until 2.0. If people are getting deadlocks when using these instances then they 
should stop.

> Dialect constants in SqlDialect can cause class initialization deadlock
> -----------------------------------------------------------------------
>
>                 Key: CALCITE-4079
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4079
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.23.0
>            Reporter: TANG Wen-hui
>            Priority: Major
>         Attachments: CALCITE-4079.01.patch, 
> image-2020-07-01-19-27-25-354.png, image-2020-07-01-19-51-32-397.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {code:java}
> /** @deprecated Use {@link AnsiSqlDialect#DEFAULT} instead. */
> @Deprecated // to be removed before 2.0
> public static final SqlDialect DUMMY =
>     AnsiSqlDialect.DEFAULT;
> /** @deprecated Use {@link CalciteSqlDialect#DEFAULT} instead. */
> @Deprecated // to be removed before 2.0
> public static final SqlDialect CALCITE =
>     CalciteSqlDialect.DEFAULT;{code}
> SqlDialect#DUMMY and SqlDialect#CALCITE are marked deprecated and have not be 
> used in any places.
> It would be better to remove them to avoid class initialization deadlock.



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

Reply via email to