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

refactor(FactoryImpl): use ThreadLocal.initialValue #4540

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

MartinWitt
Copy link
Collaborator

@MartinWitt MartinWitt commented Jan 19, 2022

Change Log

The following bad smells are refactored:

LambdaInsteadOfExecutableReference

Lambda is used instead of executable reference

ThreadLocalWithInitialValue

ThreadLocal with initialValue override shall be replaced by ThreadLocal.withInitialValue

The following has changed in the code:

ThreadLocalWithInitialValue

  • ThreadLocal with initialValue new spoon.reflect.factory.FactoryImpl.Dedup() was replaced by ThreadLocal.withInitialValue(java.lang.ThreadLocal.withInitial(() -> new spoon.reflect.factory.FactoryImpl.Dedup()))
  • ThreadLocal with initialValue new spoon.reflect.factory.FactoryImpl.Dedup() was replaced by ThreadLocal.withInitialValue(java.lang.ThreadLocal.withInitial(() -> new spoon.reflect.factory.FactoryImpl.Dedup()))

LambdaInsteadOfExecutableReference

  • Replaced lambda () -> new spoon.reflect.factory.FactoryImpl.Dedup() with executable ref spoon.reflect.factory.FactoryImpl.Dedup::new
  • Replaced lambda () -> new spoon.reflect.factory.FactoryImpl.Dedup() with executable ref spoon.reflect.factory.FactoryImpl.Dedup::new

The changes in the import statements is simple alphabetic order. Seems strange to me that we don't enforce a real order.

The following has changed in the code:
ThreadLocal with initialValue new spoon.reflect.factory.FactoryImpl.Dedup() was replaced by ThreadLocal.withInitialValue(java.lang.ThreadLocal.withInitial(() -> new spoon.reflect.factory.FactoryImpl.Dedup()))
ThreadLocal with initialValue new spoon.reflect.factory.FactoryImpl.Dedup() was replaced by ThreadLocal.withInitialValue(java.lang.ThreadLocal.withInitial(() -> new spoon.reflect.factory.FactoryImpl.Dedup()))
Replaced lambda () -> new spoon.reflect.factory.FactoryImpl.Dedup() with executable ref spoon.reflect.factory.FactoryImpl.Dedup::new
Replaced lambda () -> new spoon.reflect.factory.FactoryImpl.Dedup() with executable ref spoon.reflect.factory.FactoryImpl.Dedup::new
@monperrus monperrus merged commit a5475e5 into INRIA:master Jan 20, 2022
@monperrus
Copy link
Collaborator

This clearly shows that there is some overlap between laughing-train and Sorald. This fix would be 100% in the scope of Sorald :) To be discussed at our coming meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants