Skip to content

add support for analyzer 9.0.0#1065

Merged
amondnet merged 4 commits intomobxjs:mainfrom
jlandon:analyzer-9.0.0
Jan 8, 2026
Merged

add support for analyzer 9.0.0#1065
amondnet merged 4 commits intomobxjs:mainfrom
jlandon:analyzer-9.0.0

Conversation

@jlandon
Copy link
Contributor

@jlandon jlandon commented Jan 2, 2026

Description

This PR adds support for analyzer 9.0.0 in mobx_codegen by migrating from the deprecated Element2 API to the new Element API.

Changes

  • Migrated all code generation logic from deprecated Element2 API to Element API
  • Updated analyzer version constraint to ^9.0.0
  • Updated mobx_codegen version to 2.7.5
  • Updated CHANGELOG with migration details

Pull Request Checklist

  • If the changes are being made to code, ensure the version in pubspec.yaml is updated.
  • Increment the major/minor/patch/patch-count, depending on the complexity of change
  • Add the necessary unit tests to ensure the coverage does not drop
  • Update the Changelog to include all changes made in this PR, organized by version
  • Run the melos run set_version command from the root directory
  • Include the necessary reviewers for the PR
  • Update the docs if there are any API changes or additions to functionality

@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.48%. Comparing base (7c34f5a) to head (ef89959).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1065      +/-   ##
==========================================
- Coverage   99.50%   99.48%   -0.03%     
==========================================
  Files          57       51       -6     
  Lines        2033     1934      -99     
==========================================
- Hits         2023     1924      -99     
  Misses         10       10              
Flag Coverage Δ
flutter_mobx ?
mobx 99.28% <ø> (ø)
mobx_codegen 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
mobx_codegen/lib/src/mobx_codegen_base.dart 100.00% <100.00%> (ø)
mobx_codegen/lib/src/store_class_visitor.dart 100.00% <100.00%> (ø)
mobx_codegen/lib/src/template/method_override.dart 100.00% <100.00%> (ø)
mobx_codegen/lib/src/template/observable.dart 100.00% <100.00%> (ø)
mobx_codegen/lib/src/template/util.dart 100.00% <100.00%> (ø)
mobx_codegen/lib/src/type_names.dart 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c34f5a...ef89959. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Knupper
Copy link

Knupper commented Jan 5, 2026

@jlandon thanks for this pr, that solves a lot of problems.

Copy link

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 PR migrates mobx_codegen from the deprecated Element2 API to the new Element API to add support for analyzer 9.0.0. The migration updates the analyzer version constraint from < 9.0.0 to < 10.0.0 while maintaining backward compatibility with analyzer 7.4.0+.

Key Changes:

  • Migrated all code from deprecated Element2 API to the new Element API
  • Updated analyzer version constraint to support versions 9.x
  • Updated package version from 2.7.4 to 2.7.5

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mobx_codegen/pubspec.yaml Updated analyzer version constraint to < 10.0.0 and bumped package version to 2.7.5
mobx_codegen/lib/version.dart Updated version constant to match pubspec.yaml
mobx_codegen/CHANGELOG.md Added version 2.7.5 entry documenting the analyzer 9.0.0 support
mobx_codegen/lib/src/type_names.dart Migrated from Element2 to Element API including property names (name3→name, children2→children, etc.)
mobx_codegen/lib/src/template/util.dart Updated method signatures and property access from Element2 to Element API
mobx_codegen/lib/src/template/observable.dart Updated ExecutableElement2 to ExecutableElement and name3 to name
mobx_codegen/lib/src/template/method_override.dart Migrated method parameter types and property names to Element API
mobx_codegen/lib/src/store_class_visitor.dart Comprehensive migration of all Element2 types, property names (name3→name, metadata2→metadata), and method calls (accept2→accept, visitChildren2→visitChildren)
mobx_codegen/lib/src/mobx_codegen_base.dart Updated ClassElement2 to ClassElement and visitor method calls
mobx_codegen/test/util_test.dart Updated mock classes from MethodElement2 to MethodElement
mobx_codegen/test/store_class_visitor_test.dart Updated mock implementations to use Element API with nullable name property

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

# Conflicts:
#	mobx_codegen/CHANGELOG.md
@jlandon
Copy link
Contributor Author

jlandon commented Jan 7, 2026

@amondnet I went ahead and added Copilot's recommendation (and also included ExtensionTypeElement) ✅

Let me know if the update looks good to you (24da0c8)

@amondnet amondnet linked an issue Jan 8, 2026 that may be closed by this pull request
@amondnet amondnet linked an issue Jan 8, 2026 that may be closed by this pull request
Drop support for analyzer versions prior to 9.0.0.
Range-based constraints no longer viable due to breaking
API changes between major versions.
@amondnet amondnet merged commit b34ebe3 into mobxjs:main Jan 8, 2026
7 checks passed
@amondnet
Copy link
Collaborator

amondnet commented Jan 8, 2026

@jlandon thanks

@amondnet
Copy link
Collaborator

amondnet commented Jan 8, 2026

@all-contributors please add @jlandon for code

@allcontributors
Copy link
Contributor

@amondnet

I've put up a pull request to add @jlandon! 🎉

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.

update analyzer to v9 mobs_codegen and json_serializable compatibility

3 participants

Comments