Closed GZGavinZhao closed 1 year ago
Replace element with element2. Note that the return type changes from ClassElement to InterfaceElement, so it requires a bit more work. Most times we should be able to just cast it to ClassElement since ClassElement implements InterfaceElement.
FYI in case you want to migrate to the current version of analyzer and plan to have no lints about deprecated members: with analyzer 5.2 element2
is deprecated and element
is the new one (The old element
is removed in 5.0).
Yeah, so my process will be:
As I might've said previously, unfortunately the analyzer is probably one of the most tiresome packages to keep up-to-date with.
Any progress? I'm now doing the same, fixing all static analysis warnings and upgrading to the new analyzer
. PS: ngast
and ngcompiler
.
Sorry, not really. It's the busiest time of the year for me and I've been having a bad cold/flu. I am blocked on the resolveToBound issue, particularly with the case when dartType is FunctionType (see where resolveToBound is defined).
@ykmnkmi Also, I'm absolutely okay if you want to use the existing changes from my PR in yours. You don't need to let me know.
Fixed by #37.
Previously we just add
deprecated_member_use: ignore
to theanalysis_options.yaml
file in the monorepo root. Nowanalyzer
has gone to v5 so the usage of deprecated APIs must be dealt with now.The hardest parts are the last three, since they change the class returned or require another variable, so likely we'll have to work around them.
getType
withgetClass
forLibraryCompilationUnitElement
andLibraryElement
.name
withgetDisplayString
forDartType
. Note: need to think about whether nullabilityelement
withelement2
. Note that the return type changes fromClassElement
toInterfaceElement
, so it requires a bit more work. Most times we should be able to just cast it toClassElement
sinceClassElement
implementsInterfaceElement
.enclosingElement
withenclosingElement3
.resolveToBound
fromDartType
withTypeSystem
's instance methodresolveToBound
.parts
(CompilationUnitElement
) withparts2
(PartsElement
) fromLibraryElement
.import
(ImportElement
) withimports2
(LibraryInputElement
) fromLibraryElement
.