الانعكاس وopens
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
explain why frameworks need opens.
الموضوعات المخطط لها
exportsallows compile-time and runtime access to public types; it does not allow deep reflection on private members.opensallows reflective access at runtime (includingsetAccessible) to a package.open moduleopens everything;opens ... totargets specific modules.- Frameworks such as Spring, Hibernate, and Jackson reflect on your classes and need them opened.
- Symptom:
InaccessibleObjectExceptionat startup.
تفاصيل المخطط المبدئي
عرض عملي
module com.shop.core {
exports com.shop.core.api;
opens com.shop.core.model to com.fasterxml.jackson.databind;
}اختبر فهمك
Which keyword fixes an InaccessibleObjectException caused by reflection?
أظهر الإجابة
opens.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.