Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possibly thread unsafe constants #15743

Closed
wants to merge 23 commits into from

Conversation

kgyrtkirk
Copy link
Member

this is an alternate version to retain some positive changes #15552 ; but fix the thread safety issue

  • removes cached ExprEval -s from ConstantExpr classes
  • adds @Immutable markers

abstract class ConstantExpr<T> implements Expr
{
final ExpressionType outputType;

@SuppressWarnings("Immutable")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does @Immutable do and why are these various @SuppressWarnings("Immutable") necessary (here, in BaseTypeSignature, in ColumnCapabilitiesImpl)?

I am not familiar with this annotation so was just wondering what the extra lines are for.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the @Immutable enables a compile time check that the class satisfies some immutable rules
    • such a check could have warned me before doing the original PR
  • the suppression is added for this field as we don't know what it is...but since this class will handle it as a blackbox I think its okay to ignore it
  • I had to also add SuppressWarnings("Immutable") to ColumnCapabiliiesImpl because its kinda immutable; but fixing that turned into a massacre - I've asked @clintropolis about the value of such a change and based on that conversion I opted to not touch a lot of files without much benefits

should I remove these @Immutable related changes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's an errorprone thing? Cool. I was just wondering. I don't think we should necessarily aggressively use it everywhere (we have a lot of immutable classes, seems like it would be a lot of annotation noise) but it seems useful here.

@kgyrtkirk
Copy link
Member Author

closing as #15694 was merged

@kgyrtkirk kgyrtkirk closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants