reflectable 3.0.4 reflectable: ^3.0.4 copied to clipboard
Reflection support based on code generation, using 'capabilities' to specify which operations to support, on which objects.
- Fix the bug reported as #255.
- Update dependencies: analyzer: ^2.0.0
- Fix issue #253.
- Migrate the code generator. The reflectable package is hereby fully migrated to null safety.
- Update the following dependencies:
- Support null safety in a stable version of reflectable.
- Change minimum SDK constraint to 2.12.0.
- Bug fix: Handle types of the form
T*in some extra cases.
- Enable analyzer version 0.41.2.
- Change code generation to use new
Resolver.astNodeFormethod, eliminating the
InconsistentAnalysisExceptionworkaround in most cases.
- Prevent unnecessary code generation for inputs named
*.browser_test.*, to reduce code generation time.
- Migrate the generated code and its dependencies to null safety.
hasBestEffortReflectedType, deprecated since version 0.5.0.
- Change the return type of
Object?, for consistency with several methods named
build.yamlto ensure that 'lib/main.dart' will again be considered an entry point for code generation.
- Update dependencies to include analyzer 0.40.5, 0.40.6, 0.41.0, 0.41.1.
- Re-fixing issue #198, cf.
- Update dependencies to include analyzer 0.40.4, with 0.40.3 as lower bound because of a breaking change.
- Update dependencies to support analyzers up to version 0.40.3.
- Resolve #198 (InconsistentAnalysisException), based on workaround from dart-lang/build#2634. Also widen the analyzer version constraint to include all 0.39 versions published at this point.
- Update dependencies. In particular, analyzer can now be 0.39.10.
Handle issue with
sync*functions, cf. issue #210.
- Eliminate dependency on package
package_resolver(which is deprecated).
- Introduce support for the type
voidas a reified type.
- Generate code which will not cause
- Update reflectable to work with analyzer 0.39.4.
- Restricting analyzer version to <= 0.39.3, because 0.39.3 contains a breaking change in the parameter list of a constructor.
- Fix a bug concerned with the ordering of named parameters in a constructor declaration.
- Update reflectable to use package analyzer version
- Ensure that generated code is lint free with package pedantic 1.9.0.
- Make reflectable itself lint free with package pedantic 1.9.0.
- Adjust implementation to satisfy 'pedantic' lints. The generated code
does this as well, except that some
constmodifiers are generated even though they could be omitted (an
// ignore_for_filecomment is generated such that the linter does not complain about this). Upgrade dependencies to allow using analyzer 0.38.5, and current versions of many other packages.
- Code generator rewritten in order to work with changes in the analyzer
APIs, enabling the use of analyzer version 0.37.0 (and newer versions of
many other packages), which addresses issue #173. See issue #180 about
missing support for two features: This affects code in platform libraries
(that is, libraries imported with 'dart:...' except 'dart:ui'). If a
declaration in a platform library has metadata, a query for this metadata
DeclarationMirror.metadatawill return null. Also, if a constructor in a platform library has a parameter with a default value, and that parameter is omitted in a reflective invocation, the value passed will be
nullrather than the declared value. This is a bug, but it is blocked on getting access to AST nodes in platform libraries from the resolver provided by build.
- Follow-up bug fix related to #170: Corrected
ParameterMirror.defaultValuefor initializing formals.
- Bug fix #170: Default values for initializing formals are now included
when generating function literals for
- Lint fixes (e.g.,
T x;rather than
T x = null;).
- Updated dependency to allow using source_span 1.5.3.
- Updated dependency to allow using analyzer 0.34.
- Corrected the email address listed in
pubspec.yamlfor Dart Team.
- Fix version conflict #153: Updated version constraints on analyzer, build, build_runner, and test. Ported reflectable_builder.dart to work with new build API.
- Bug fix #132: We used to generate terms like
prefix2.di.injectin order to denote a top level declaration named
inject, but that's an error because
diis an import prefix from client code. We now strip off such prefixes (yielding
prefix2.inject) in the cases reported in issue #132.
- Adjusts an implementation class (
MixinApplication) such that a compile-time error occurring with analyzer 0.32.5 is avoided.
Enhancement of the support for reflection on type arguments, covering cases where a type annotation is a parameterized type where all type arguments are resolved statically (e.g.,
List<int> f();). We (still) do not support cases where one or more type arguments are or contain type variables from an enclosing function or class (like the type of the formal parameter to
List<E>), and with such type arguments a dynamic error is raised if an attempt is made to access it. Similarly, we (still) do not support extracting the value of the actual type arguments for an instance of a generic class (e.g., for a given list, we cannot obtain the precise value of the actual type argument; we can test things like
myList is List<num>and
myList is List<String>without reflection at all, but that only reveals an upper bound, not the precise value of the type argument, and we cannot get that precise value without support for some additional primitives).
build.yamlfile in reflectable was adjusted such that a much larger set of files are included for code generation. This means that we will err on the side of generating code for too many files rather than too few, but this choice seems to be more user-friendly. Developers who get irritated about seeing warnings like "This reflector does not match anything" (which is a likely outcome for code generation applied to some arbitrary library which is not an entry point) can then add a
build.yamlfile specifying more precisely which libraries to generate code for.
- Null error bug fix.
A stable version of Dart 2 has been released at this point. This version of reflectable contains a rather substantial number of changes needed in order to make it possible to use this package with the current Dart 2 tools, and under the associated version constraints.
Eliminates the use of package barback (which is now deprecated). This change requires many changes in the implementation, but it should not give rise to incompatibilities for clients of reflectable.
Updates many version dependencies: analyzer, build_resolvers, build_config, build_runner, and test, in order to enable the use of Dart 2 tools.
Changes a handful of implementation details such that every downcast is concretely justified. Removed
newfrom the implementation (but not from generated code), because code generation must anyway use Dart 2, but generated code may still need to run as Dart 1.
Improves code generation ERROR, WARNING, and INFO messages such that it includes a precise source code location.
lib/main.dartamong possible build targets, because Flutter uses that as the standard entry point.
- Update the SDK version constraint to 3.0.0 to satisfy Dart 2 requirements.
- This version is a tiny update: It solves a version problem by changing some package dependencies.
This version is updated for Dart 2, to the extent that this is possible
at this point (a stable version of Dart 2 has not yet been released).
Minor updates will be used to track the language updates as needed,
so a dependency on reflectable version
^2.0.0 should work for Dart 2.
- Update version number, prepare package for being published.
- Now supports client packages using commands like
pub run build_runner testto generate code and run tests.
- Added support for generating code to obtain the
Typevalue of function types (including the new inline function types like
- Fixed bugs associated with error handling: In several situations where the build process would get stuck indefinitely, it will now terminate with the intended error message.
- Added note to README.md that generated code should not be published (it should be regenerated, such that it matches the current version of all dependencies).
- Added 'dart:ui' to the set of platform libraries that reflectable will recognize (and potentially import). This will only work on Flutter, but there would not be any references to 'dart:ui' for any non-Flutter program, unless it is already broken in other ways.
- Removed bin/reflectable_transformer.dart, which is obsolete.
TestTransformto require its 3rd constructor argument, because there is no default way to obtain the path to '.packages'.
- Generated files are now placed in 'test' rather than 'build/test';
adjusted 'test_transform.dart' to work with that setup, and enable
pub run test.
This version is a pre-release of the version 2.0.0 which makes all the
changes described below. Henceforth, reflectable will be based on code
build rather than a pub transformer, because
transformers will not be supported in the future.
- Switched to a new technology stack: Reflectable no longer provides a pub
transformer, it uses package
buildto generate code as a separate step. This is a breaking change for every program using reflectable because it requires a different workflow, it requires the generated code to be imported explicitly by the root library (the one that contains the
mainfunction), and it requires invocation of
initializeReflectable()at the beginning of
main. To see the commands in this new workflow, please consult README.md.
- Updated version constraint on
analyzerto include versions
^0.30.0. Note that this forces a lower bound of
0.30.0because of a breaking change in the analyzer.
- Updated version constraint on
- Bug fix, handling the case where
prefixis null on a library mirror, and the case where
targetLibraryis null on a library dependency mirror.
- As a consequence of these version updates, changes a method signature and deletes a method (overriding a previously deprecated, now deleted method). These changes should not affect clients of this package.
- Updates documentation about capabilities required for each method.
- Potentially breaking bug fix: Several mirror methods perform more strict
checks on capabilities, to make them match the documented requirements. In
- Updates tests to work with
classifyCapability; these capabilities are now always enabled.
- Uses more strict typing in generated code:
Mapliterals will now consistently include type arguments. This is rarely detectable in client code, but could for instance be detected in some situations with complex metadata.
- Uses more strict typing in the implementation, in order to pass strong mode checks.
- Potentially breaking bug fix: Several additional mirror methods
documented to require a
typeRelationsCapabilitywill now actually require it. Concretely, this affects the methods
originalDeclaration. Programs relying on the previous (incorrect) behavior may need to have the relevant reflectors extended with a
typeRelationsCapability. This change also enables throwing an error which blames the missing capability rather than incorrectly blaming lack of coverage for a specific class. This fixes issue 77.
- Adds constant resolution requests for metadata such that some spurious 'This reflector does not match anything' events are avoided; fixes issue 82.
- Corrects treatment of metadata with enum values, fixing issue 80.
- Adds two missing package dependencies, fixing issue 81.
- Eliminates the binding to
analyzer0.27.1, using ^0.27.2 instead; also uses
- Introduces support for entry point globbing; for more information please consult commit 8936f98.
- Potentially breaking bug fix: In transformed code,
superinterfacesused to be callable even without a
typeRelationsCapability. That capability is now required (as it should be according to the documentation) and this will break programs that rely on the old, incorrect behavior.
- Adds support for recognizing a
constfield as a reflector (e.g., class
Ccan be covered by having
@SomeClass.aConstFieldas metadata on
- Fixes bug: misleading error messages from
- Fixes bug: now named constructors can be used in metadata (e.g.,
@F.foo(42) var x;can be used to get reflective support for
- Fixes bug: certain external function type mirrors seem to be unequal to themselves, which caused an infinite loop; now that case is handled.
- Adds a stand-alone version of the transformer; for more information please consult the main comment on commit 8f90cb9.
- Fixes bug: some private names could occur in generated code; this situation is now detected more consistently and transformation fails.
- The documentation now clearly states that it is not supported to use
reflectable in untransformed mode with
- Adds a small corner of support for function types: A
typedefcan be used to give a function type a name, and such a type can be used as a type annotation (say, for a method parameter) for which it is possible to obtain a mirror, and that type
- Fixes bug: in the case where a reflector does not match anything at all there used to be a null error; now that is handled, and a warning is emitted.
- Switches from using an
AggregateTransformto using a plain
Transformfor all transformations; this reduces the number of redundant transformations performed in the context of
- Adds extra tests such that line coverage in the transformer is again complete.
- Fixes bug:
hasReflectedTypeused to incorrectly return
truein some cases where a type variable was used in a nested generic type instantiation.
- Fixes bugs associated with anonymous mixin applications involving type arguments.
- Fixes bug: several error messages claimed 'no such method' where they should claim 'no such constructor' etc.
- Fixes bug: it is now possible to invoke a constructor in an abstract class
reflectively, as long as it is a
Listreceives some constructor arguments with default values which are different on different platforms, and the analyzer reports that there are no default values; this release introduces a special case for that.
- Fixes bug: some constructors of native classes were omitted, are now available like other members.
- Changes the version constraint on analyzer to 0.27.1, to avoid an issue with version 0.27.1+1 which breaks all reflectable transformations. Note that this is a tight constraint (just one version allowed), but currently all other versions above 0.27.0 will fail so there is no point in trying them.
- Bug fix: The transformer now treats the entry points as a set such that duplicates are eliminated; duplicates of entry points are not useful, and they can trigger an infinite loop if present.
- Breaking: The methods
bestEffortReflectedTypeare now deprecated. They will be removed in the next published version.
- Breaking: Implements a new semantics for no-such-method situations: When
a reflectable invocation (
delegate) fails due to an unknown selector or an argument list with the wrong shape, a
ReflectableNoSuchMethodErroris thrown. (In particular,
noSuchMethodis not invoked, and no
NoSuchMethodErroris thrown). For more details, please consult the capability design document near occurrences of 'no-such-method'.
- Fixes issue 51, which is concerned with coverage of getters/setters for variables inherited from non-covered classes.
- Breaking: Changes coverage such that it requires a
SuperclassQuantifyCapabilityin order to include support for an anonymous mixin application (like
A with Min
class B extends A with M..). Such mixin applications used to be included even without the
SuperclassQuantifyCapability, but that was an anomaly.
- Breaking: Changes the semantics of
superclassto strictly follow the documentation: It is now required to have a
TypeRelationsCapabilityin order to perform
superclass, even in the cases where this yields a mixin application.
- Breaking: Changes the semantics of
staticMembersto strictly follow the documentation: It is now required to have a
DeclarationsCapabilityin order to perform these methods.
- Breaking: Eliminates the non-trivial upper bound on the version of the
analyzerpackage (because the constant evaluation issue has been resolved). The analyzer dependency is now '^0.27.0'. Switches to
- Updates the capability design document to document the new treatment of no-such-method situations.
isAssignableTofor type mirrors.
- Fixes issue 48, which is about wrong code generation involving mixin applications.
delegateon instance mirrors, and adds a
delegateCapabilityto enable it. The reason why this requires a separate capability is that the cost of storing maps between strings and symbols needed by
- Changes code generation to avoid generating code for some unused mirrors.
- Fixes bug which prevented recognition of some forms of metadata during metadata based capability checking.
- Changes the representation of reflected types such that duplication of
Typeexpressions is avoided (by using indices into a shared list).
- Adds methods
hasDynamicReflectedTypeto several mirror classes, yielding the erased version of the reflected type (for
List<int>it would return
List). This method is capable of returning a result in some cases where
- Corrects the behavior of methods
hasReflectedType, such that
reflectedTypereturns an instantiated generic class when that is appropriate, and
hasReflectedTypereturns false in some cases where it used to return true, because the correct instantiated generic class cannot be obtained.
- Adds method
bestEffortReflectedTypewhich will use
dynamicReflectedTypeto obtain a reflected type if at all possible (though with a less precise specification, because it may be one or the other). Adds method
hasBestEffortReflectedTypeto go with it. This pair of methods resembles the 0.3.3 and earlier semantics of
The version number is stepped up to 0.4.0 because
differently now than it did in 0.3.3 and earlier, which turned out to break
some programs. In some cases the best reaction may be to replace invocations
hasReflectedType by the corresponding "best effort"
methods, but it may also be better to use both the
reflectedType and the
dynamicReflectedType method pairs, taking the precise semantics into
account when using the returned result.
Note that version 0.3.4 also deals with
reflectedType in a stricter way
than 0.3.3 and earlier versions, but at that point the changes were
considered to be bug fixes or implementations of missing features.
- NB Adds a non-trivial upper version constraint on analyzer in order to require version 0.26.1+14 or older. This is necessary because newer versions of analyzer have changed in ways that are incompatible with reflectable in several ways. We expect to be able to allow using the newest version of analyzer again soon.
- Implements support for moving additional kinds of expressions (for
argument default values and metadata), esp. when they use a library
prefix (such as
- Adds test cases for previously untested capabilities
- Fixes bug where pre-transform check would attempt to use
nullbut should instead throw
- Adds missing checks in pre-transform code (e.g., checking that a
LibraryCapabilityis available when performing a top-level invocation).
- Corrects inconsistency among the type hierarchies for pre/post-transform capabilities (which caused the post-transform code to act incorrectly).
- Corrects treatment of
TypingCapability, adjusted it to include
UnreachableErrorand adjusted error handling to throw this in all cases where a location should never be reached.
- Several 'README.md' files updated to match the current status.
- A couple of smaller unimplemented methods implemented.
- Eliminates many of the 'Missing entry point' messages: If it is specified
that an entry point 'web/foo.dart' must be transformed, but no such asset
is provided to the transformer, then the warning is only emitted if the
file does not exist (with
pub build test, 'web/foo.dart' is not provided to the transformer, but that is not a problem).
- Corrects the bug that
typeRelationsCapabilitywas sometimes not required with certain operations (including
superclass), even though the documentation states that it is required. Similarly, a
TypeCapabilityis now required in a few extra cases where it should be required.
- Correct the cyclic-dependency bug which previously made 'expanding_generics_test.dart' fail.
- Adds support for enum classes.
- Implement support for all the trivial parts of genericity: empty lists of
type arguments are now delivered rather than throwing
UnimplementedError, and static information like type variables (that is, formals) is supported.
- Implement several missing class members, including
- Correct several bugs in the implementation of
- Correct several bugs with
- Implement several features for top-level entities, especially variables.
- Correct several incorrect type annotations (e.g.,
Listrequired, but only
- Implement simple code coverage support.
- Update many DartDoc comments in 'capability.dart'.
- Update the document The Design of Reflectable Capabilities to match the current selection of quantifiers and their semantics.
- Add very limited support for private classes: They are preserved such that
iteration over all superclasses will work even if some of them are private,
and private class mirrors are included in
declarationsof library mirrors. However, it is not possible to
reflecton an instance of a private class, to create new instances with
newInstance, nor to call its static methods.
- Fix bug where some private names were used in generated code (which makes subsequent compilation fail).
- Add option to format the generated code (off by default).
correspondingSetterQuantifyCapability, which will add the corresponding setter for each already included explicitly declared getter.
- Change generated code: Eliminate many invocations of
new UnmodifiableListView.., replace many plain list literals by
constlist literals, for better startup time and more redundancy elimination.
- Fix bug where an
InvokingMetaCapabilitywas treated as a
- Fix bugs in the publication support script.
reflectedTypeCapabilitywhich enables methods
reflectedTypeon variable and parameter mirrors, and
reflectedReturnTypeon method mirrors. This enables limited access to type annotations while avoiding the generation of many class mirrors.
Reflectable.getInstancewhich delivers the canonical instance of any given reflector class which is being used in the current program. An example shows how this enables "meta-reflection".
- Fixed bugs in methods
isSynthetic; fixed bug in selection of supported members of library mirrors; and implemented methods
declarationsfor library mirrors; and fixed several other library related bugs.
- Fix bug where metadata was searched the same way for invocation and for
InstanceInvokeMetaCapability(invocation must traverse superclasses).
- Fix bug where some libraries were imported into generated code, even though they cannot be imported (private to core).
- Fix bugs in publication support script.
- Breaking: Add support for type annotation quantification. This is a breaking change: we used to do that implicitly, but that is expensive, and now it is only available on request.
- Change the way the set of supported classes are computed.
- Fix crash when transforming certain dart:html classes.
- Fix memory leak from the transformer.
- Recognize private identifier constants as metadata in certain cases.
- Bump required SDK version in
- Correct generation of imports of the original entry point.
- Fix issues with the computation of static members.
- Allows the metadata capabilities to recognize any subtype of the given type.
- Breaking: Enforces the use of a
TypeCapabilityas specified in the design document, and makes it a supertype of several other capabilities such that it is automatically included with, e.g.,
- Fixed homepage link in pubspec
- Fix several bug with mixins in the transformer.
- Use a static initializer in the generated code which helps avoiding a stack overflow.
- Support for return types of getters and setters.
- Support for superTypeQuantifyCapability.
- Fix bug in the mirror-based implementation's collection of classes that could lead to infinite loops.
- Fix bug related to generating code for
operator~in the transformer.
- Avoid crashing the transformer when an entry-point has no member named
- Support for subtype quantification in transformed code.
- Code generation bugs fixed; metadata/library related bugs fixed.
- Faster version of test procedure.
- Non-transformed code supports
- Transformer implements
- Transformer implements
- Transformer implements reflection on libraries.
- Better support for default values in transformed code.
- Our tests started failing because of a version conflict introduced by an
pubspec.yamlto avoid the conflict.
- Made changes to avoid deprecated features in the new version of
- Implemented support for implicit accessors (setters, getters).
- Implemented support for
- Transformer implements
.typeof fields and parameters.
- Transformer has support for
mainfunction that is not in the entry-point file.
- Transformer supports async
- Other bug fixes...
- First published release.
- Initial project creation