Sunday, March 26, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home Java

Porting Million Lines of Code from Java to Kotlin at Meta

learningcode_x1mckf by learningcode_x1mckf
November 13, 2022
in Java
0
Porting Million Lines of Code from Java to Kotlin at Meta
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


You might also like

2023 Java roadmap for developers – TheServerSide.com

YS Jagan launches Ragi Java in Jagananna Gorumudda, says focused on intellectual development of students – The Hans India

Disadvantages of Java – TheServerSide.com

Meta has been at work to port their Android codebase from Java to Kotlin. Within the course of, they’ve discovered quite a lot of classes of normal curiosity and developed a couple of helpful approaches, explains Meta engineer Omer Strulovich.

Meta’s determination to undertake Kotlin for his or her Android apps was motivated by Kotlin benefits over Java, together with nullability and useful programming help, shorter code, and the opportunity of creating area particular languages. It was additionally clear to Kotlin engineers that they needed to port to Kotlin as a lot of their Java codebase as doable, principally to stop Java null pointers from creeping into the Kotlin codebase and to cut back the remaining Java code requiring upkeep. This was no straightforward activity and required fairly some investigation at begin.

A primary impediment Meta engineers needed to overcome got here from a number of inside optimization instruments in use at Meta that didn’t work correctly with Kotlin. For instance, Meta needed to replace the ReDex Android bytecode optimizer and the lexer component of syntax highlighter Pygments, and constructed a Kotlin symbol processing (KSP) API, used to create Kotlin compiler plugins.

On the entrance of code conversion correct, Meta engineers opted to make use of Kotlin official converter J2K, out there as a compiler plugin. This labored fairly nicely apart from quite a lot of particular frameworks, together with JUnit, for which the instrument lacks ample data to have the ability to produce appropriate conversions.

We’ve got discovered many situations of those small fixes. Some are straightforward to do (comparable to changing isEmpty), some require analysis to determine the primary time (as within the case of JUnit guidelines), and some are workarounds for precise J2K bugs that can lead to something from a construct error to completely different runtime conduct.

The appropriate method to deal with this instances consisted in a three-step pipeline to first put together Java code, then robotically run J2K in a headless Android Studio occasion, and at last postprocess the generated information to use all required refactoring and fixes. Meta has open sourced quite a lot of these refactorings to assist different builders to perform the identical duties.

These automations don’t resolve all the issues, however we’re in a position to prioritize the most typical ones. We run our conversion script (aptly named Kotlinator) on modules, prioritizing energetic and less complicated modules first. We then observe the ensuing commit: Does it compile? Does it cross our steady integration easily? If it does, we commit it. And if not, we take a look at the problems and devise new computerized refactors to repair them.

Because of this method, Meta has been in a position to port over 10 million strains of Kotlin code, permitting thus the vast majority of Meta Android engineers to change to Kotlin for his or her each day duties. The method additionally confirmed quite a lot of anticipated outcomes, together with shorter generated code and unchanged execution pace. On the destructive facet, although, Kotlin compiler proved considerably slower than Java’s. This opened up a brand new entrance for optimization by utilizing KSP for annotation processing and bettering Java stub era and compile occasions, which remains to be an ongoing effort.

Don’t miss the unique article about Meta’s journey to undertake Kotlin if you’re within the full element.





Source link

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

2023 Java roadmap for developers – TheServerSide.com

by learningcode_x1mckf
March 26, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

2023 Java roadmap for developers  TheServerSide.com Source link

Read more

YS Jagan launches Ragi Java in Jagananna Gorumudda, says focused on intellectual development of students – The Hans India

by learningcode_x1mckf
March 26, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

YS Jagan launches Ragi Java in Jagananna Gorumudda, says focused on intellectual development of students  The Hans India Source link

Read more

Disadvantages of Java – TheServerSide.com

by learningcode_x1mckf
March 26, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Disadvantages of Java  TheServerSide.com Source link

Read more

Advantages of Java – TheServerSide.com

by learningcode_x1mckf
March 26, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Advantages of Java  TheServerSide.com Source link

Read more

Java Developer Survey Reveals Increased Need for Java … – Benzinga

by learningcode_x1mckf
March 25, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Java Developer Survey Reveals Increased Need for Java ...  Benzinga Source link

Read more
Next Post
JavaScript Slows Progress, Should be Retired, Argues JSON Creator

NVIDIA Security Team: 'What if We Just Stopped Using C?'

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

Exploring Special Function Parameters – Real Python

Exploring Special Function Parameters – Real Python

September 6, 2022
Working With Linear Systems in Python With scipy.linalg – Real Python

Working With Linear Systems in Python With scipy.linalg – Real Python

January 18, 2023
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Java Champion Josh Long on Spring Framework 6 and Spring Boot 3 – InfoQ.com

March 12, 2023

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • 2023 Java roadmap for developers – TheServerSide.com
  • YS Jagan launches Ragi Java in Jagananna Gorumudda, says focused on intellectual development of students – The Hans India
  • Disadvantages of Java – TheServerSide.com

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?