Upgrading analyzer 9 to 10
Breaking9.0.0 → 10.2.0Breaking7Deprecated18New2Changed5Other1
BreakingUpgrade verdict
7 breaking changes.
In plain terms
- Two deprecated listener APIs are gone, so code using them must switch to alternatives.
- Two deprecated onError methods are gone from diagnostic listeners.
- Five plugin-related classes are no longer part of the public API.
- The deprecated pluginConfigurations property on analysis options is gone.
Must act Top 5 of 23 that need code or config changes
What you must change
Breaking7
Removes deprecated DiagnosticOrErrorListener and DiagnosticOrErrorListenerExtension.
DiagnosticOrErrorListenerDiagnosticOrErrorListenerExtensionRemoves deprecated RecordingDiagnosticListener.onError and BooleanDiagnosticListener.onError methods.
RecordingDiagnosticListener.onErrorBooleanDiagnosticListener.onErrorRemoves GitPluginSource, PathPluginSource, PluginConfiguration, PluginSource and VersionedPluginSource from the public API.
GitPluginSourcePathPluginSourcePluginConfigurationPluginSourceVersionedPluginSourceRemoves deprecated AnalysisOptions.pluginConfigurations.
AnalysisOptions.pluginConfigurationsRemoves experimental
ConstructorElement.isDeclaring.ConstructorElement.isDeclaringIdentifiers resolving to a type in a value expression slot are now
TypeLiteral nodes instead of SimpleIdentifier or PrefixedIdentifier.TypeLiteralSimpleIdentifierPrefixedIdentifierDeprecated AST members still exist but their parent nodes changed, which may break code relying on parent-child relationships.
Deprecations to plan for
Deprecated16
Deprecates RuleVisitorRegistry.addRepresentationConstructorName.
RuleVisitorRegistry.addRepresentationConstructorNameDeprecates RuleVisitorRegistry.addRepresentationDeclaration.
RuleVisitorRegistry.addRepresentationDeclarationDeprecates
LibraryFragment.isSynthetic in favor of isOriginNotExistingFile.LibraryFragment.isSyntheticLibraryFragment.isOriginNotExistingFileDeprecates ClassDeclaration leftBracket, members, rightBracket in favor of body.
ClassDeclaration.leftBracketClassDeclaration.membersClassDeclaration.rightBracketClassDeclaration.bodyExtensionDeclaration.leftBracketExtensionDeclaration.membersExtensionDeclaration.rightBracketExtensionDeclaration.bodyDeprecates ClassDeclaration name and typeParameters in favor of namePart.
ClassDeclaration.nameClassDeclaration.typeParametersClassDeclaration.namePartDeprecates EnumDeclaration leftBracket, constants, members, rightBracket in favor of body.
EnumDeclaration.leftBracketEnumDeclaration.constantsEnumDeclaration.membersEnumDeclaration.rightBracketEnumDeclaration.bodyExtensionTypeDeclaration.leftBracketExtensionTypeDeclaration.constantsExtensionTypeDeclaration.membersExtensionTypeDeclaration.rightBracketExtensionTypeDeclaration.bodyDeprecates EnumDeclaration name and typeParameters in favor of namePart.
EnumDeclaration.nameEnumDeclaration.typeParametersEnumDeclaration.namePartDeprecates ExtensionTypeDeclaration constKeyword, name, representation, typeParameters in favor of primaryConstructor.
ExtensionTypeDeclaration.constKeywordExtensionTypeDeclaration.nameExtensionTypeDeclaration.representationExtensionTypeDeclaration.typeParametersExtensionTypeDeclaration.primaryConstructorDeprecates the hasPublishedDocs parameter of LintCode.new.
LintCode.newhasPublishedDocsDeprecates ConstructorElement.isSynthetic in favor of isOriginDeclaration, isOriginImplicitDefault and isOriginMixinApplication.
ConstructorElement.isSyntheticisOriginDeclarationisOriginImplicitDefaultisOriginMixinApplicationDeprecates TopLevelVariableElement.isSynthetic in favor of isOriginDeclaration and isOriginGetterSetter.
TopLevelVariableElement.isSyntheticisOriginDeclarationisOriginGetterSetterDeprecates FieldElement.isSynthetic in favor of isOriginDeclaration, isOriginGetterSetter, isOriginDeclaringFormalParameter and isOriginEnumValues.
FieldElement.isSyntheticisOriginDeclarationisOriginGetterSetterisOriginDeclaringFormalParameterisOriginEnumValuesDeprecates PropertyAccessorElement.isSynthetic in favor of isOriginDeclaration, isOriginInterface and isOriginVariable.
PropertyAccessorElement.isSyntheticisOriginDeclarationisOriginInterfaceisOriginVariableDeprecates Element.isSynthetic in favor of the isOriginXyz properties.
Element.isSyntheticisOriginXyzDeprecates LibraryElement.isSynthetic in favor of isOriginNotExistingFile.
LibraryElement.isSyntheticisOriginNotExistingFileDeprecates DiagnosticCode.name and DiagnosticCode.uniqueName in favor of lowerCaseName and lowerCaseUniqueName.
DiagnosticCode.nameDiagnosticCode.uniqueNameDiagnosticCode.lowerCaseNameDiagnosticCode.lowerCaseUniqueNameAPI changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- changed:
method AnalysisRule.reportAtNode( AstNode? node, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): void → method AnalysisRule.reportAtNode( AstNode? node, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic? - changed:
method AnalysisRule.reportAtOffset( int offset, int length, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): void → method AnalysisRule.reportAtOffset( int offset, int length, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic - changed:
method AnalysisRule.reportAtPubNode( PubspecNode node, { List<Object> arguments = …, List<DiagnosticMessage> contextMessages = …, }): void → method AnalysisRule.reportAtPubNode( PubspecNode node, { List<Object> arguments = …, List<DiagnosticMessage> contextMessages = …, }): Diagnostic - changed:
method AnalysisRule.reportAtToken( Token token, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): void → method AnalysisRule.reportAtToken( Token token, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic? - changed:
method MultiAnalysisRule.reportAtNode( AstNode? node, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, required DiagnosticCode diagnosticCode, }): void → method MultiAnalysisRule.reportAtNode( AstNode? node, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, required DiagnosticCode diagnosticCode, }): Diagnostic? - changed:
method MultiAnalysisRule.reportAtOffset( int offset, int length, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): void → method MultiAnalysisRule.reportAtOffset( int offset, int length, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic - changed:
method MultiAnalysisRule.reportAtPubNode( PubspecNode node, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage> contextMessages = …, }): void → method MultiAnalysisRule.reportAtPubNode( PubspecNode node, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage> contextMessages = …, }): Diagnostic - changed:
method MultiAnalysisRule.reportAtToken( Token token, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): void → method MultiAnalysisRule.reportAtToken( Token token, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic? - added:
class RemovedAnalysisRule: final extends MultiAnalysisRule - added:
ctor RemovedAnalysisRule({ required super.name, required super.description, Version? since, String? replacedBy, }) - added:
get RemovedAnalysisRule.diagnosticCodes: List<DiagnosticCode> - added:
method AnalysisRule.reportAtSourceRange( SourceRange sourceRange, { List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic - added:
method MultiAnalysisRule.reportAtSourceRange( SourceRange sourceRange, { required DiagnosticCode diagnosticCode, List<Object> arguments = …, List<DiagnosticMessage>? contextMessages, }): Diagnostic
- added:
method RuleVisitorRegistry.addAnonymousBlockBody(AbstractAnalysisRule rule, AstVisitor visitor): void - added:
method RuleVisitorRegistry.addAnonymousExpressionBody( AbstractAnalysisRule rule, AstVisitor visitor, ): void - added:
method RuleVisitorRegistry.addAnonymousMethodInvocation( AbstractAnalysisRule rule, AstVisitor visitor, ): void - added:
method RuleVisitorRegistry.addPrimaryConstructorBody(AbstractAnalysisRule rule, AstVisitor visitor): void
- removed:
class GitPluginSource: final implements PluginSource - removed:
class PathPluginSource: final implements PluginSource - removed:
class PluginConfiguration: final - removed:
class PluginSource: sealed - removed:
class VersionedPluginSource: final implements PluginSource - removed:
ctor GitPluginSource({required String url, String? path, String? ref}) - removed:
ctor PathPluginSource({required String path}) - removed:
ctor PluginConfiguration({ required this.name, required this.source, this.diagnosticConfigs = …, this.isEnabled = …, }) - removed:
ctor VersionedPluginSource({required String constraint}) - removed:
field PluginConfiguration.diagnosticConfigs: final Map<String, DiagnosticConfig> - removed:
field PluginConfiguration.isEnabled: final bool - removed:
field PluginConfiguration.name: final String - removed:
field PluginConfiguration.source: final PluginSource - removed:
get AnalysisOptions.pluginConfigurations: List<PluginConfiguration> - removed:
method GitPluginSource.toYaml({required String name}): String - removed:
method PathPluginSource.toYaml({required String name}): String - removed:
method PluginConfiguration.sourceYaml(): String - removed:
method PluginSource.toYaml({required String name}): String - removed:
method VersionedPluginSource.toYaml({required String name}): String
- removed:
static field Feature.declaring_constructors: final - added:
static field Feature.anonymous_methods: final - added:
static field Feature.primary_constructors: final
- removed:
get ExtensionTypeDeclaration.namePart: ClassNamePart - removed:
variable useDeclaringConstructorsAst: bool - changed:
class EnumBody: sealed implements ClassBody → class EnumBody: sealed implements AstNode - changed:
get ExtensionDeclaration.body: BlockClassBody? → get ExtensionDeclaration.body: BlockClassBody - changed:
get MixinDeclaration.body: ClassBody → get MixinDeclaration.body: BlockClassBody - added:
class AnonymousBlockBody: abstract final implements AnonymousMethodBody - added:
class AnonymousExpressionBody: abstract final implements AnonymousMethodBody - added:
class AnonymousMethodBody: abstract final implements AstNode - added:
class AnonymousMethodInvocation: abstract final implements Expression - added:
class PrimaryConstructorBody: abstract final implements ClassMember - added:
get AnonymousBlockBody.block: Block - added:
get AnonymousExpressionBody.expression: Expression - added:
get AnonymousExpressionBody.functionDefinition: Token - added:
get AnonymousMethodInvocation.body: AnonymousMethodBody - added:
get AnonymousMethodInvocation.isCascaded: bool - added:
get AnonymousMethodInvocation.isNullAware: bool - added:
get AnonymousMethodInvocation.operator: Token - added:
get AnonymousMethodInvocation.parameters: FormalParameterList? - added:
get AnonymousMethodInvocation.realTarget: Expression - added:
get AnonymousMethodInvocation.target: Expression? - added:
get ConstructorDeclaration.newKeyword: Token? - added:
get ConstructorDeclaration.typeName: SimpleIdentifier? - added:
get ExtensionTypeDeclaration.primaryConstructor: PrimaryConstructorDeclaration - added:
get FunctionDeclaration.name: Token - added:
get FunctionTypedFormalParameter.keyword: Token? - added:
get MixinDeclaration.name: Token - added:
get PrimaryConstructorBody.body: FunctionBody - added:
get PrimaryConstructorBody.colon: Token? - added:
get PrimaryConstructorBody.declaration: PrimaryConstructorDeclaration? - added:
get PrimaryConstructorBody.initializers: NodeList<ConstructorInitializer> - added:
get PrimaryConstructorBody.thisKeyword: Token - added:
get PrimaryConstructorDeclaration.body: PrimaryConstructorBody? - added:
get PrimaryConstructorDeclaration.declaredFragment: ConstructorFragment? - added:
get TypeAlias.name: Token - added:
method AstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): R? - added:
method AstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): R? - added:
method AstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): R? - added:
method AstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): R?
- added:
method GeneralizingAstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): R? - added:
method GeneralizingAstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): R? - added:
method GeneralizingAstVisitor.visitAnonymousMethodBody(AnonymousMethodBody node): R? - added:
method GeneralizingAstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): R? - added:
method GeneralizingAstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): R? - added:
method RecursiveAstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): R? - added:
method RecursiveAstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): R? - added:
method RecursiveAstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): R? - added:
method RecursiveAstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): R? - added:
method SimpleAstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): R? - added:
method SimpleAstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): R? - added:
method SimpleAstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): R? - added:
method SimpleAstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): R? - added:
method ThrowingAstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): R? - added:
method ThrowingAstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): R? - added:
method ThrowingAstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): R? - added:
method ThrowingAstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): R? - added:
method TimedAstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): T? - added:
method TimedAstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): T? - added:
method TimedAstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): T? - added:
method TimedAstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): T? - added:
method UnifyingAstVisitor.visitAnonymousBlockBody(AnonymousBlockBody node): R? - added:
method UnifyingAstVisitor.visitAnonymousExpressionBody(AnonymousExpressionBody node): R? - added:
method UnifyingAstVisitor.visitAnonymousMethodInvocation(AnonymousMethodInvocation node): R? - added:
method UnifyingAstVisitor.visitPrimaryConstructorBody(PrimaryConstructorBody node): R?
- added:
get ConstructorElement.isOriginDeclaration: bool - added:
get ConstructorElement.isOriginImplicitDefault: bool - added:
get ConstructorElement.isOriginMixinApplication: bool - added:
get ConstructorElement.isPrimary: bool - added:
get ConstructorElement.isSynthetic: bool - added:
get ConstructorFragment.factoryKeywordOffset: int? - added:
get ConstructorFragment.isSynthetic: bool - added:
get ConstructorFragment.newKeywordOffset: int? - added:
get ConstructorFragment.thisKeywordOffset: int? - added:
get FieldElement.declaringFormalParameter: FieldFormalParameterElement? - added:
get FieldElement.isOriginDeclaringFormalParameter: bool - added:
get FieldElement.isOriginEnumValues: bool - added:
get FieldElement.isOriginExtensionTypeRecoveryRepresentation: bool - added:
get FieldFormalParameterElement.isDeclaring: bool - added:
get FieldFormalParameterElement.privateName: String? - added:
get FieldFormalParameterFragment.privateName: String? - added:
get InterfaceElement.primaryConstructor: ConstructorElement? - added:
get LibraryElement.isOriginNotExistingFile: bool - added:
get LibraryFragment.isOriginNotExistingFile: bool - added:
get MethodElement.isOriginDeclaration: bool - added:
get MethodElement.isOriginInterface: bool - added:
get Name.isSetter: bool - added:
get PropertyAccessorElement.isOriginDeclaration: bool - added:
get PropertyAccessorElement.isOriginInterface: bool - added:
get PropertyAccessorElement.isOriginVariable: bool - added:
get PropertyAccessorElement.isSynthetic: bool - added:
get PropertyInducingElement.isOriginDeclaration: bool - added:
get PropertyInducingElement.isOriginGetterSetter: bool - added:
get PropertyInducingElement.isSynthetic: bool - added:
get TopLevelFunctionElement.isOriginDeclaration: bool - added:
get TopLevelFunctionElement.isOriginLoadLibrary: bool
- added:
method TypeSystem.futureValueType(DartType type): DartType
- changed:
ctor LintCode( String name, String problemMessage, { super.correctionMessage, super.hasPublishedDocs, String? uniqueName, this.severity = …, }) → ctor LintCode( String name, String problemMessage, { super.correctionMessage, @Deprecated('To be removed without replacement') super.hasPublishedDocs, String? uniqueName, this.severity = …, })
- removed:
class DiagnosticOrErrorListener: sealed - removed:
extension DiagnosticOrErrorListenerExtension on DiagnosticOrErrorListener - removed:
method BooleanDiagnosticListener.onError(Diagnostic diagnostic): void - removed:
method DiagnosticOrErrorListenerExtension.onDiagnostic(Diagnostic diagnostic): void - removed:
method RecordingDiagnosticListener.onError(Diagnostic diagnostic): void - changed:
class DiagnosticListener: abstract implements DiagnosticOrErrorListener → class DiagnosticListener: abstract - added:
method DiagnosticReporter.atSourceRange( SourceRange range, DiagnosticCode diagnosticCode, { List<Object>? arguments, List<DiagnosticMessage>? contextMessages, }): Diagnostic
- changed:
ctor ErrorProcessor(this.code, [this.severity]) → ctor ErrorProcessor(String code, [this.severity])
- added:
method LineInfo.lineNumberDifference(int offset1, int offset2): int - added:
method LineInfo.onSameLine(int offset1, int offset2): bool - added:
static method LineInfo.getOffsetForLine(int line, String content): int?
- removed:
class SourceRange - removed:
ctor SourceRange(this.offset, this.length) - removed:
field SourceRange.length: final int - removed:
field SourceRange.offset: final int - removed:
get SourceRange.end: int - removed:
get SourceRange.hashCode: int - removed:
method SourceRange.contains(int x): bool - removed:
method SourceRange.containsExclusive(int x): bool - removed:
method SourceRange.coveredBy(SourceRange otherRange): bool - removed:
method SourceRange.covers(SourceRange otherRange): bool - removed:
method SourceRange.endsIn(SourceRange otherRange): bool - removed:
method SourceRange.getExpanded(int delta): SourceRange - removed:
method SourceRange.getMoveEnd(int delta): SourceRange - removed:
method SourceRange.getTranslated(int delta): SourceRange - removed:
method SourceRange.getUnion(SourceRange otherRange): SourceRange - removed:
method SourceRange.intersects(SourceRange? otherRange): bool - removed:
method SourceRange.operator ==(Object other): bool - removed:
method SourceRange.startsIn(SourceRange otherRange): bool - removed:
method SourceRange.toString(): String - removed:
static field SourceRange.EMPTY: const SourceRange