Skip to content

Upgrade to Scala 3.8.0 and refactor for improved null safety#79

Open
halotukozak wants to merge 21 commits intomasterfrom
scala-3
Open

Upgrade to Scala 3.8.0 and refactor for improved null safety#79
halotukozak wants to merge 21 commits intomasterfrom
scala-3

Conversation

@halotukozak
Copy link
Copy Markdown
Member

Summary of Changes

  • Upgrade Support: Upgraded the project to Scala 3.8.0-RC5, updated related build configurations, and enhanced scalac options.
  • Null-Safety Improvements: Replaced null handling patterns such as Iterator.takeWhile(_ != null) with safer Scala 3 enhancements, e.g., Iterator.iterateNonNull.
  • Refactoring: Migrated sealed classes and case classes to more modern Scala 3 enums and types, incorporated union types, nullability annotations, and adopted chaining syntax.
  • Syntax Modernization:
    • Replaced old patterns like implicit with given and extension for uniformity.
    • Adopted Scala 3.8.0 patterns, e.g., replacing _ with ? in type usages.
    • Introduced inline extensions and T | Null for robust null-safety.
  • Code Cleanup: Removed unused annotations (e.g., @nowarn) and unnecessary imports, tidied up .scalafmt.conf, and reduced clutter in package.scala.
  • Enhanced Testing: Updated IntelliJ-specific build files and revised test-related logic to conform to the syntax improvements.

…union types, and updating nullability annotations
…xtension`, removing `implicitConversions`, and adopting modern patterns
…otations, add `@tailrec` annotations where applicable
…ean up completion and documentation generation logic
# Conflicts:
#	.github/workflows/ci.yml
#	build.sbt
#	test/org/jetbrains/plugins/hocon/usages/HoconFindUsagesTest.scala
# Conflicts:
#	.github/workflows/ci.yml
#	build.sbt
#	src/org/jetbrains/plugins/hocon/package.scala
…3 enums and types, adopt chaining syntax, and clean up imports
…iterateNonNull` extension method for improved null safety
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request upgrades the project from Scala 2.13.18 to Scala 3.8.0-RC5, introducing significant modernization and null-safety improvements. The changes include converting sealed traits/classes to enums, replacing case classes with type aliases, adopting union types for null-safety, modernizing implicit syntax to given/extensions, and replacing deprecated patterns with Scala 3 alternatives.

Key changes:

  • Upgrade to Scala 3.8.0-RC5 with enhanced compiler options for null-safety and strict checking
  • Introduction of Iterator.iterateNonNull to replace the Iterator.iterate(...).takeWhile(_ != null) pattern
  • Conversion of several sealed traits and case classes to Scala 3 enums and type aliases for improved type safety

Reviewed changes

Copilot reviewed 41 out of 43 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
build.sbt Updated Scala version to 3.8.0-RC5 and added extensive compiler options for null-safety
.scalafmt.conf Changed dialect from scala213source3 to scala3 and removed infix operator exclusions
.github/workflows/ci.yml Updated CI workflow to use Scala 3.8.0-RC5
test files Updated type bounds, removed unused annotations, added explicit return types
src/.../HoconTestUtils.scala Removed @nowarn annotation and added explicit return type
src/.../HoconSingleModuleTest.scala Added explicit return types and imports
src/.../HoconMultiModuleTest.scala Introduced `T
src/.../HoconActionTest.scala Added @unused annotation for unused parameter
src/.../HoconProjectSettingsConfigurable.scala Applied `T
src/.../ResolutionCtx.scala Converted case classes to type aliases, sealed traits to enums, and Option to `T
src/.../IncludedFileReferenceSet.scala Converted case class to type alias and changed wildcard types
src/.../HoconQualifiedNameProvider.scala Added union types for null return values
src/.../HoconPropertiesReferenceProvider.scala Updated return types with union types
src/.../HoconIncludeResolutionInspection.scala Converted abstract class hierarchy to enum with cases
src/.../HKeyReference.scala Updated return types with union types
src/.../HoconPsiElementFactory.scala Updated return types with union types and replaced Iterator patterns
src/.../HoconPsiElement.scala Extensive changes: updated type bounds, replaced Iterator.iterate patterns, updated return types
src/.../HoconErrorHighlightingAnnotator.scala Added union type for parameter
src/.../HoconElementType.scala Converted object with vals to enum with cases
src/.../package.scala Added Iterator.iterateNonNull extension, updated extensions to use Scala 3 syntax, removed imports
src/.../navigation files Converted classes to enums and updated type parameters
src/.../misc files Added explicit return types and updated method signatures
src/.../manipulators Added null checks and updated return types
src/.../lexer files Converted token types to enums and updated State to opaque type
src/.../formatting files Updated type annotations with union types
src/.../editor files Added union types for null returns
resources/META-INF/plugin.xml Updated class paths for enum-based inspection classes
Files not reviewed (1)
  • .idea/codeStyles/codeStyleConfig.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

halotukozak and others added 6 commits January 7, 2026 16:04
@ddworak ddworak changed the base branch from idea25 to master March 6, 2026 10:44
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