Port all Scala code to Java
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
Research direction
Start with the roadmap and inspect the listed Scala files, including Rich.scala, LabelInfoFromModule.scala, Location.scala, POSet.scala, and Att.scala. First determine which files are not involved in matching and can be scoped independently. The overall work is done when the Scala code is ported to Java, remaining Scala is made Java-esque, and Java 21 is adopted.
Written by the indexing model from the issue text.
Description
While Scala is a nice language, the consensus of the frontend team is that maintaining a mixture of Scala and Java causes more friction than it is worth:
- IntelliJ struggles to reason about the Scala code and reports false errors (#3867)
- We have to frequently convert between Java and Scala types (see the usages of
collections.scala) and write boilerplate code to offer two versions of the same methods (e.g.getOptionandgetOptionalinAtt.scala). - As a company, my impression is that more of us are familiar with the intricacies of Java than of Scala.
As a result, we have decided that
- All new code should be written in Java
- In the longterm, all existing Scala code should be ported to Java as well
The largest blocker will be the matching library in the LLVM backend, which makes heavy usage of pattern matching and likely can't be ported until we update to Java 21 (#3499).
However, searching the frontend, there are only 47 Scala files, and many of them can be straightforwardly ported even without pattern matching support in Java.
A high level roadmap:
- Port Scala case classes not involved in pattern matching to Java record classes inheriting from a sealed interface
Rich.scala,LabelInfoFromModule.scala,Location.scala, etc.- The main KORE data structures likely can't be ported due to their use in
matching
- Port Scala classes/algorithms not making use of pattern matching
POSet.scala,Att.scala, etc.
- Make remaining Scala classes as Java-esque as possible
- Port any
traitto aninterface - Use Java types for all members that are not pattern matched on
- We already have
pcollectionsas a dependency, which provides immutable functional data structures
- We already have
- Port any
- Update to Java 21
- Port remaining Scala code
- Dominant language
- Python
- Stars
- 591
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from runtimeverification/k
-
runtimeverification/k#4939 · 1 assignee ·
-
Concolic Explorer Open
Difficulty 5/5 Over a week Newbie friendliness 32/100
runtimeverification/k#4937 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
runtimeverification/k#4936 ·
-
type:epic
runtimeverification/k#4934 · 4 comments · 1 assignee ·
-
runtimeverification/k#4924 · 1 assignee ·
All issues in runtimeverification/k
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100