Consider support for extending native generic classes and providing generic arguments
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java, typescript, webpack
- Lĩnh vực
- build-system, mobile-dev, tooling
Hướng nghiên cứu
Bắt đầu với webpack plugin và js_parser.js được mô tả trong issue. Theo dõi cách các khai báo @Native và các kiểu được mở rộng hoặc triển khai hiện đang được biểu diễn, sau đó xác định cách một transformer tùy chỉnh có thể giữ lại các đối số generic cho parser. Được xem là hoàn tất khi TypeScript như java.util.List<java.lang.Integer> tạo ra một binding có đối số generic đó thay vì Object.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Currently, there is no way to implement for example java.util.List<T> and provide information what would be the type T. When extending such class/interface from TypeScript the following way:
@Interfaces([java.util.List])
class JSList implements java.util.List {
}
the static binding generator prior 5.3.1 would generate a proxy class with a similar signature:
public class JSList implements java.util.List
The introduced changes of the SBG in 5.3.1 generate public class JSList implements java.util.List<Object> having resolved the generic parameter T using its erasure (in this case java.lang.Object) as if it's a raw class inheritance.
With the changes of the SBG in 5.3.1, there is a way to feed it information about what would be the generic parameters when extending, however this would require some changes in the syntax of extending/implementing native classes:
@Native
class JSList implements java.util.List<java.lang.Integer>{
}
The above shown syntax would be possible with some changes in the webpack plugin and the js_parser.js in the SBG.
In order to collect information about the generic arguments provided in the TS code there should be a custom transformer plugged into the webpack pipeline whose goal would be to lookup every TS node with a @Native decorator and preserve its extended class and implemented interfaces information somewhere. This could be stored by modifying the AST and creating internal decorators only for storage. Further, when the js_parser.js parses the JS code, it can look for the internal decorators and retrieve the information about the generics storing them for the SBG.
- Ngôn ngữ chính
- C++
- Star
- 563
- Fork
- 144
- Merge trung bình
- 10 giờ 46 phút
- Pull request đã merge (30 ngày)
- 14
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NativeScript/android
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
NativeScript/android#2039 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
NativeScript/android#2024 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
NativeScript/android#2020 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
NativeScript/android#2019 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
NativeScript/android#1986 ·
Tất cả issue của NativeScript/android
Issue tương tự
-
[BUG] Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
eunomia-bpf/llvmbpf#51 · 1 bình luận ·
-
status:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PX4/PX4-Autopilot#28776 ·
-
Website Doc Typo Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
autowarefoundation/autoware_universe#13413 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100