Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Issue 1391013008: Adds limited support for private classes. (Closed)

Created:
5 years, 2 months ago by eernst
Modified:
5 years, 2 months ago
Reviewers:
sigurdm
CC:
eernst+reviews_google.com, reviews_dartlang.org, floitsch
Base URL:
https://github.com/dart-lang/reflectable.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Adds limited support for private classes. Subtype/superclass quantification can include private classes, even though this may not be needed (or even intended) by the programmer who wrote the capabilities, or the programmer who use them via an import. This CL ensures that we do not any more generate type expressions that fail to compile because they attempt to access a private class in a different library. We keep the private classes in place because they are needed during traversals of superclass chains (they should not fail when superclass quantification is enabled), and they do have `declarations` and other features as expected for any class mirror. It is quite common that a given "official" class `C` is used by clients (in type annotations etc.), but they will actually be using instances of "secret" subclasses, possibly private, often because they have obtained those objects using factory constructors (a good example is `List`). This means that it is very useful to be able to obtain an instance mirror for such an instance, and also to do `.type` and get a class mirror for it. That feature can only be supported if we can recognize that a given object is an instance of a specific private class, and we do not have a maintainable way to do that. So we leave out that bit for now. Fixes the code generation problem reported in issue #43. R=sigurdm@google.com Committed: https://github.com/dart-lang/reflectable/commit/2d9b6f5584b921183faec6d2d5b8d09265175bd0

Patch Set 1 #

Total comments: 14

Patch Set 2 : Improved comments, formatting. #

Patch Set 3 : Review response; disable `reflect` on private classes. #

Patch Set 4 : Additional review response. #

Patch Set 5 : Improved on treatment of uri #

Unified diffs Side-by-side diffs Delta from patch set Stats (+285 lines, -60 lines) Patch
M reflectable/lib/src/reflectable_mirror_based.dart View 1 2 12 chunks +103 lines, -33 lines 0 comments Download
M reflectable/lib/src/reflectable_transformer_based.dart View 1 2 3 5 chunks +19 lines, -13 lines 0 comments Download
M reflectable/lib/src/transformer_implementation.dart View 1 2 3 4 11 chunks +42 lines, -13 lines 0 comments Download
M test_reflectable/pubspec.yaml View 1 chunk +1 line, -0 lines 0 comments Download
M test_reflectable/test/meta_reflectors_meta.dart View 1 chunk +3 lines, -1 line 0 comments Download
A test_reflectable/test/private_class_library.dart View 1 chunk +32 lines, -0 lines 0 comments Download
A test_reflectable/test/private_class_test.dart View 1 2 1 chunk +85 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (1 generated)
eernst
Private classes, limitedly! ;)
5 years, 2 months ago (2015-10-15 11:32:45 UTC) #2
sigurdm
Write about the other refactorings in the cl dscription, or move them to a separate ...
5 years, 2 months ago (2015-10-15 12:30:58 UTC) #3
eernst
On 2015/10/15 12:30:58, sigurdm wrote: > Write about the other refactorings in the cl dscription, ...
5 years, 2 months ago (2015-10-15 12:51:05 UTC) #4
eernst
Review response. Main thing: Support for `reflect` on instances of private classes was deleted, and ...
5 years, 2 months ago (2015-10-15 13:46:12 UTC) #5
sigurdm
LGTM
5 years, 2 months ago (2015-10-15 13:52:44 UTC) #6
eernst
5 years, 2 months ago (2015-10-15 14:14:43 UTC) #7
Message was sent while issue was closed.
Committed patchset #5 (id:80001) manually as
2d9b6f5584b921183faec6d2d5b8d09265175bd0 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698