diff --git a/src/objects/zcl_abapgit_object_clas.clas.abap b/src/objects/zcl_abapgit_object_clas.clas.abap index cf6971f51..e24f7525f 100644 --- a/src/objects/zcl_abapgit_object_clas.clas.abap +++ b/src/objects/zcl_abapgit_object_clas.clas.abap @@ -37,15 +37,19 @@ CLASS zcl_abapgit_object_clas DEFINITION PUBLIC INHERITING FROM zcl_abapgit_obje RAISING zcx_abapgit_exception. ENDCLASS. -CLASS zcl_abapgit_object_clas IMPLEMENTATION. + + +CLASS ZCL_ABAPGIT_OBJECT_CLAS IMPLEMENTATION. + METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). - CREATE OBJECT mi_object_oriented_object_fct TYPE zcl_abapgit_oo_class_new. + CREATE OBJECT mi_object_oriented_object_fct TYPE zcl_abapgit_oo_class. ENDMETHOD. + METHOD deserialize_abap. * same as in zcl_abapgit_object_clas, but without "mo_object_oriented_object_fct->add_to_activation_list" @@ -110,6 +114,167 @@ CLASS zcl_abapgit_object_clas IMPLEMENTATION. ENDMETHOD. + + METHOD deserialize_docu. + + DATA: lt_lines TYPE tlinetab, + lv_object TYPE dokhl-object. + + io_xml->read( EXPORTING iv_name = 'LINES' + CHANGING cg_data = lt_lines ). + + IF lines( lt_lines ) = 0. + RETURN. + ENDIF. + + lv_object = ms_item-obj_name. + + mi_object_oriented_object_fct->create_documentation( + it_lines = lt_lines + iv_object_name = lv_object + iv_language = mv_language ). + ENDMETHOD. + + + METHOD deserialize_sotr. + "OTR stands for Online Text Repository + DATA: lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt. + + io_xml->read( EXPORTING iv_name = 'SOTR' + CHANGING cg_data = lt_sotr ). + + IF lines( lt_sotr ) = 0. + RETURN. + ENDIF. + + mi_object_oriented_object_fct->create_sotr( + iv_package = iv_package + it_sotr = lt_sotr ). + ENDMETHOD. + + + METHOD deserialize_tpool. + + DATA: lv_clsname TYPE seoclsname, + lt_tpool_ext TYPE zif_abapgit_definitions=>ty_tpool_tt, + lt_tpool TYPE textpool_table. + + + io_xml->read( EXPORTING iv_name = 'TPOOL' + CHANGING cg_data = lt_tpool_ext ). + lt_tpool = read_tpool( lt_tpool_ext ). + + IF lines( lt_tpool ) = 0. + RETURN. + ENDIF. + + lv_clsname = ms_item-obj_name. + + mi_object_oriented_object_fct->insert_text_pool( + iv_class_name = lv_clsname + it_text_pool = lt_tpool + iv_language = mv_language ). + + ENDMETHOD. + + + METHOD is_class_locked. + + DATA: lv_argument TYPE seqg3-garg. + + lv_argument = ms_item-obj_name. + OVERLAY lv_argument WITH '=============================='. + lv_argument = lv_argument && '*'. + + rv_is_class_locked = exists_a_lock_entry_for( iv_lock_object = 'ESEOCLASS' + iv_argument = lv_argument ). + + ENDMETHOD. + + + METHOD serialize_xml. + + DATA: ls_vseoclass TYPE vseoclass, + lt_tpool TYPE textpool_table, + lt_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt, + ls_clskey TYPE seoclskey, + lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt, + lt_lines TYPE tlinetab, + lt_attributes TYPE zif_abapgit_definitions=>ty_obj_attribute_tt. + + ls_clskey-clsname = ms_item-obj_name. + + "If class was deserialized with a previous versions of abapGit and current language was different + "from master language at this time, this call would return SY-LANGU as master language. To fix + "these objects, set SY-LANGU to master language temporarily. + zcl_abapgit_language=>set_current_language( mv_language ). + + TRY. + ls_vseoclass = mi_object_oriented_object_fct->get_class_properties( ls_clskey ). + + CLEANUP. + zcl_abapgit_language=>restore_login_language( ). + + ENDTRY. + + zcl_abapgit_language=>restore_login_language( ). + + CLEAR: ls_vseoclass-uuid, + ls_vseoclass-author, + ls_vseoclass-createdon, + ls_vseoclass-changedby, + ls_vseoclass-changedon, + ls_vseoclass-r3release, + ls_vseoclass-chgdanyby, + ls_vseoclass-chgdanyon, + ls_vseoclass-clsfinal, + ls_vseoclass-clsabstrct, + ls_vseoclass-exposure. + + IF mv_skip_testclass = abap_true. + CLEAR ls_vseoclass-with_unit_tests. + ENDIF. + + io_xml->add( iv_name = 'VSEOCLASS' + ig_data = ls_vseoclass ). + + lt_tpool = mi_object_oriented_object_fct->read_text_pool( + iv_class_name = ls_clskey-clsname + iv_language = mv_language ). + io_xml->add( iv_name = 'TPOOL' + ig_data = add_tpool( lt_tpool ) ). + + IF ls_vseoclass-category = seoc_category_exception. + lt_sotr = mi_object_oriented_object_fct->read_sotr( ms_item-obj_name ). + IF lines( lt_sotr ) > 0. + io_xml->add( iv_name = 'SOTR' + ig_data = lt_sotr ). + ENDIF. + ENDIF. + + lt_lines = mi_object_oriented_object_fct->read_documentation( + iv_class_name = ls_clskey-clsname + iv_language = mv_language ). + IF lines( lt_lines ) > 0. + io_xml->add( iv_name = 'LINES' + ig_data = lt_lines ). + ENDIF. + + lt_descriptions = mi_object_oriented_object_fct->read_descriptions( ls_clskey-clsname ). + IF lines( lt_descriptions ) > 0. + io_xml->add( iv_name = 'DESCRIPTIONS' + ig_data = lt_descriptions ). + ENDIF. + + lt_attributes = mi_object_oriented_object_fct->read_attributes( ls_clskey-clsname ). + IF lines( lt_attributes ) > 0. + io_xml->add( iv_name = 'ATTRIBUTES' + ig_data = lt_attributes ). + ENDIF. + + ENDMETHOD. + + METHOD zif_abapgit_object~changed_by. TYPES: BEGIN OF ty_includes, @@ -205,6 +370,27 @@ CLASS zcl_abapgit_object_clas IMPLEMENTATION. ENDMETHOD. + METHOD zif_abapgit_object~is_active. + rv_active = is_active( ). + ENDMETHOD. + + + METHOD zif_abapgit_object~is_locked. + + DATA: lv_classpool TYPE program. + + lv_classpool = cl_oo_classname_service=>get_classpool_name( |{ ms_item-obj_name }| ). + + IF is_class_locked( ) = abap_true + OR is_text_locked( lv_classpool ) = abap_true. + + rv_is_locked = abap_true. + + ENDIF. + + ENDMETHOD. + + METHOD zif_abapgit_object~jump. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING @@ -276,180 +462,4 @@ CLASS zcl_abapgit_object_clas IMPLEMENTATION. serialize_xml( io_xml ). ENDMETHOD. - - METHOD zif_abapgit_object~is_locked. - - DATA: lv_classpool TYPE program. - - lv_classpool = cl_oo_classname_service=>get_classpool_name( |{ ms_item-obj_name }| ). - - IF is_class_locked( ) = abap_true - OR is_text_locked( lv_classpool ) = abap_true. - - rv_is_locked = abap_true. - - ENDIF. - - ENDMETHOD. - - METHOD deserialize_docu. - - DATA: lt_lines TYPE tlinetab, - lv_object TYPE dokhl-object. - - io_xml->read( EXPORTING iv_name = 'LINES' - CHANGING cg_data = lt_lines ). - - IF lines( lt_lines ) = 0. - RETURN. - ENDIF. - - lv_object = ms_item-obj_name. - - mi_object_oriented_object_fct->create_documentation( - it_lines = lt_lines - iv_object_name = lv_object - iv_language = mv_language ). - ENDMETHOD. - - METHOD deserialize_sotr. - "OTR stands for Online Text Repository - DATA: lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt. - - io_xml->read( EXPORTING iv_name = 'SOTR' - CHANGING cg_data = lt_sotr ). - - IF lines( lt_sotr ) = 0. - RETURN. - ENDIF. - - mi_object_oriented_object_fct->create_sotr( - iv_package = iv_package - it_sotr = lt_sotr ). - ENDMETHOD. - - METHOD deserialize_tpool. - - DATA: lv_clsname TYPE seoclsname, - lt_tpool_ext TYPE zif_abapgit_definitions=>ty_tpool_tt, - lt_tpool TYPE textpool_table. - - - io_xml->read( EXPORTING iv_name = 'TPOOL' - CHANGING cg_data = lt_tpool_ext ). - lt_tpool = read_tpool( lt_tpool_ext ). - - IF lines( lt_tpool ) = 0. - RETURN. - ENDIF. - - lv_clsname = ms_item-obj_name. - - mi_object_oriented_object_fct->insert_text_pool( - iv_class_name = lv_clsname - it_text_pool = lt_tpool - iv_language = mv_language ). - - ENDMETHOD. - - METHOD serialize_xml. - - DATA: ls_vseoclass TYPE vseoclass, - lt_tpool TYPE textpool_table, - lt_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt, - ls_clskey TYPE seoclskey, - lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt, - lt_lines TYPE tlinetab, - lt_attributes TYPE zif_abapgit_definitions=>ty_obj_attribute_tt. - - ls_clskey-clsname = ms_item-obj_name. - - "If class was deserialized with a previous versions of abapGit and current language was different - "from master language at this time, this call would return SY-LANGU as master language. To fix - "these objects, set SY-LANGU to master language temporarily. - zcl_abapgit_language=>set_current_language( mv_language ). - - TRY. - ls_vseoclass = mi_object_oriented_object_fct->get_class_properties( ls_clskey ). - - CLEANUP. - zcl_abapgit_language=>restore_login_language( ). - - ENDTRY. - - zcl_abapgit_language=>restore_login_language( ). - - CLEAR: ls_vseoclass-uuid, - ls_vseoclass-author, - ls_vseoclass-createdon, - ls_vseoclass-changedby, - ls_vseoclass-changedon, - ls_vseoclass-r3release, - ls_vseoclass-chgdanyby, - ls_vseoclass-chgdanyon, - ls_vseoclass-clsfinal, - ls_vseoclass-clsabstrct, - ls_vseoclass-exposure. - - IF mv_skip_testclass = abap_true. - CLEAR ls_vseoclass-with_unit_tests. - ENDIF. - - io_xml->add( iv_name = 'VSEOCLASS' - ig_data = ls_vseoclass ). - - lt_tpool = mi_object_oriented_object_fct->read_text_pool( - iv_class_name = ls_clskey-clsname - iv_language = mv_language ). - io_xml->add( iv_name = 'TPOOL' - ig_data = add_tpool( lt_tpool ) ). - - IF ls_vseoclass-category = seoc_category_exception. - lt_sotr = mi_object_oriented_object_fct->read_sotr( ms_item-obj_name ). - IF lines( lt_sotr ) > 0. - io_xml->add( iv_name = 'SOTR' - ig_data = lt_sotr ). - ENDIF. - ENDIF. - - lt_lines = mi_object_oriented_object_fct->read_documentation( - iv_class_name = ls_clskey-clsname - iv_language = mv_language ). - IF lines( lt_lines ) > 0. - io_xml->add( iv_name = 'LINES' - ig_data = lt_lines ). - ENDIF. - - lt_descriptions = mi_object_oriented_object_fct->read_descriptions( ls_clskey-clsname ). - IF lines( lt_descriptions ) > 0. - io_xml->add( iv_name = 'DESCRIPTIONS' - ig_data = lt_descriptions ). - ENDIF. - - lt_attributes = mi_object_oriented_object_fct->read_attributes( ls_clskey-clsname ). - IF lines( lt_attributes ) > 0. - io_xml->add( iv_name = 'ATTRIBUTES' - ig_data = lt_attributes ). - ENDIF. - - ENDMETHOD. - - METHOD is_class_locked. - - DATA: lv_argument TYPE seqg3-garg. - - lv_argument = ms_item-obj_name. - OVERLAY lv_argument WITH '=============================='. - lv_argument = lv_argument && '*'. - - rv_is_class_locked = exists_a_lock_entry_for( iv_lock_object = 'ESEOCLASS' - iv_argument = lv_argument ). - - ENDMETHOD. - - - METHOD zif_abapgit_object~is_active. - rv_active = is_active( ). - ENDMETHOD. - ENDCLASS. diff --git a/src/objects/zcl_abapgit_object_clas_new.clas.abap b/src/objects/zcl_abapgit_object_clas_new.clas.abap deleted file mode 100644 index 44dfa8329..000000000 --- a/src/objects/zcl_abapgit_object_clas_new.clas.abap +++ /dev/null @@ -1,23 +0,0 @@ -"! This class is just a different name for zcl_zabapgit_object_clas. -"! It has been created to heal repositories of the brave ones who uses abapGit -"! experimental features "! and had the luck to serialize their CLAS objects with -"! the serializer LCL_OBJECT_CLAS_NEW. -"! It can be removed on 2019-04 where we expect all CLAS object being -"! re-serialized with the serializer LCL_OBJECT_CLAS. -"! References: https://github.com/larshp/abapGit/pull/1311 -CLASS zcl_abapgit_object_clas_new DEFINITION PUBLIC INHERITING FROM zcl_abapgit_object_clas. - - PROTECTED SECTION. - METHODS: - get_metadata REDEFINITION. - -ENDCLASS. - -CLASS zcl_abapgit_object_clas_new IMPLEMENTATION. - - METHOD get_metadata. - rs_metadata = super->get_metadata( ). - rs_metadata-class = 'ZCL_ABAPGIT_OBJECT_CLAS'. - ENDMETHOD. - -ENDCLASS. diff --git a/src/objects/zcl_abapgit_object_clas_new.clas.xml b/src/objects/zcl_abapgit_object_clas_new.clas.xml deleted file mode 100644 index 7c9ac47e5..000000000 --- a/src/objects/zcl_abapgit_object_clas_new.clas.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - ZCL_ABAPGIT_OBJECT_CLAS_NEW - 1 - E - 1 - X - X - X - - - - diff --git a/src/objects/zcl_abapgit_oo_class.clas.abap b/src/objects/zcl_abapgit_oo_class.clas.abap index e24cdf829..e8027ea1f 100644 --- a/src/objects/zcl_abapgit_oo_class.clas.abap +++ b/src/objects/zcl_abapgit_oo_class.clas.abap @@ -1,24 +1,377 @@ -CLASS zcl_abapgit_oo_class DEFINITION PUBLIC INHERITING FROM zcl_abapgit_oo_base. +CLASS zcl_abapgit_oo_class DEFINITION + PUBLIC + INHERITING FROM zcl_abapgit_oo_base + CREATE PUBLIC . PUBLIC SECTION. - METHODS: - zif_abapgit_oo_object_fnc~create REDEFINITION, - zif_abapgit_oo_object_fnc~generate_locals REDEFINITION, - zif_abapgit_oo_object_fnc~insert_text_pool REDEFINITION, - zif_abapgit_oo_object_fnc~create_sotr REDEFINITION, - zif_abapgit_oo_object_fnc~get_includes REDEFINITION, - zif_abapgit_oo_object_fnc~get_class_properties REDEFINITION, - zif_abapgit_oo_object_fnc~read_text_pool REDEFINITION, - zif_abapgit_oo_object_fnc~read_sotr REDEFINITION, - zif_abapgit_oo_object_fnc~delete REDEFINITION. + METHODS zif_abapgit_oo_object_fnc~create + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~create_sotr + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~delete + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~generate_locals + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~get_class_properties + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~get_includes + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~insert_text_pool + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~read_sotr + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~read_text_pool + REDEFINITION . + METHODS zif_abapgit_oo_object_fnc~deserialize_source + REDEFINITION . + PROTECTED SECTION. + PRIVATE SECTION. + + CLASS-METHODS update_source_index + IMPORTING + !iv_clsname TYPE csequence + !io_scanner TYPE REF TO cl_oo_source_scanner_class . + CLASS-METHODS update_report + IMPORTING + !iv_program TYPE programm + !it_source TYPE string_table + RETURNING + VALUE(rv_updated) TYPE abap_bool + RAISING + zcx_abapgit_exception . + CLASS-METHODS generate_classpool + IMPORTING + !iv_name TYPE seoclsname + RAISING + zcx_abapgit_exception . + CLASS-METHODS update_meta + IMPORTING + !iv_name TYPE seoclsname + !iv_exposure TYPE seoexpose + !it_source TYPE rswsourcet + RAISING + zcx_abapgit_exception . + CLASS-METHODS determine_method_include + IMPORTING + !iv_name TYPE seoclsname + !iv_method TYPE seocpdname + RETURNING + VALUE(rv_program) TYPE programm + RAISING + zcx_abapgit_exception . + CLASS-METHODS init_scanner + IMPORTING + !it_source TYPE zif_abapgit_definitions=>ty_string_tt + !iv_name TYPE seoclsname + RETURNING + VALUE(ro_scanner) TYPE REF TO cl_oo_source_scanner_class + RAISING + zcx_abapgit_exception . + CLASS-METHODS update_full_class_include + IMPORTING + !iv_classname TYPE seoclsname + !it_source TYPE string_table + !it_methods TYPE cl_oo_source_scanner_class=>type_method_implementations . + CLASS-METHODS create_report + IMPORTING + !iv_program TYPE programm + !it_source TYPE string_table + !iv_extension TYPE sychar02 + !iv_program_type TYPE sychar01 + !iv_version TYPE r3state . + CLASS-METHODS update_cs_number_of_methods + IMPORTING + !iv_classname TYPE seoclsname + !iv_number_of_impl_methods TYPE i . ENDCLASS. -CLASS zcl_abapgit_oo_class IMPLEMENTATION. + + +CLASS ZCL_ABAPGIT_OO_CLASS IMPLEMENTATION. + + + METHOD create_report. + INSERT REPORT iv_program FROM it_source EXTENSION TYPE iv_extension STATE iv_version PROGRAM TYPE iv_program_type. + ASSERT sy-subrc = 0. + ENDMETHOD. + + + METHOD determine_method_include. + + DATA: ls_mtdkey TYPE seocpdkey. + + + ls_mtdkey-clsname = iv_name. + ls_mtdkey-cpdname = iv_method. + + cl_oo_classname_service=>get_method_include( + EXPORTING + mtdkey = ls_mtdkey + RECEIVING + result = rv_program + EXCEPTIONS + method_not_existing = 1 ). + IF sy-subrc = 0. + RETURN. + ENDIF. + + CALL FUNCTION 'SEO_METHOD_GENERATE_INCLUDE' + EXPORTING + suppress_mtdkey_check = seox_true + mtdkey = ls_mtdkey + EXCEPTIONS + not_existing = 1 + model_only = 2 + include_existing = 3 + method_imp_not_generated = 4 + method_imp_not_initialised = 5 + _internal_class_not_existing = 6 + _internal_method_overflow = 7 + cancelled = 8 + method_is_abstract_implemented = 9 + method_is_final_implemented = 10 + internal_error_insert_report = 11 + OTHERS = 12. + IF sy-subrc <> 0. + zcx_abapgit_exception=>raise( 'error from SEO_METHOD_GENERATE_INCLUDE' ). + ENDIF. + + rv_program = cl_oo_classname_service=>get_method_include( ls_mtdkey ). + + ENDMETHOD. + + + METHOD generate_classpool. + + DATA: ls_clskey TYPE seoclskey. + + ls_clskey-clsname = iv_name. + + CALL FUNCTION 'SEO_CLASS_GENERATE_CLASSPOOL' + EXPORTING + clskey = ls_clskey + suppress_corr = seox_true + EXCEPTIONS + not_existing = 1 + model_only = 2 + class_pool_not_generated = 3 + class_stment_not_generated = 4 + locals_not_generated = 5 + macros_not_generated = 6 + public_sec_not_generated = 7 + protected_sec_not_generated = 8 + private_sec_not_generated = 9 + typeref_not_generated = 10 + class_pool_not_initialised = 11 + class_stment_not_initialised = 12 + locals_not_initialised = 13 + macros_not_initialised = 14 + public_sec_not_initialised = 15 + protected_sec_not_initialised = 16 + private_sec_not_initialised = 17 + typeref_not_initialised = 18 + _internal_class_overflow = 19 + OTHERS = 20. + IF sy-subrc <> 0. + zcx_abapgit_exception=>raise( 'error from SEO_CLASS_GENERATE_CLASSPOOL' ). + ENDIF. + + ENDMETHOD. + + + METHOD init_scanner. + + TRY. + ro_scanner = cl_oo_source_scanner_class=>create_class_scanner( + clif_name = iv_name + source = it_source ). + ro_scanner->scan( ). + CATCH cx_clif_scan_error. + zcx_abapgit_exception=>raise( 'error initializing CLAS scanner' ). + ENDTRY. + + ENDMETHOD. + + + METHOD update_cs_number_of_methods. + + " Indirect access to keep downward compatibility + DATA lr_cache_entry TYPE REF TO data. + + FIELD-SYMBOLS: TYPE any, + TYPE any. + + + TRY. + CREATE DATA lr_cache_entry TYPE ('SEO_CS_CACHE'). + CATCH cx_sy_create_data_error. +* does not exist in some older systems + RETURN. + ENDTRY. + + ASSIGN lr_cache_entry->* TO . + ASSERT sy-subrc = 0. + + ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE + TO . + ASSERT sy-subrc = 0. + = iv_classname. + + ASSIGN COMPONENT 'NO_OF_METHOD_IMPLS' OF STRUCTURE + TO . + ASSERT sy-subrc = 0. + = iv_number_of_impl_methods. + + MODIFY ('SEO_CS_CACHE') FROM . + + ENDMETHOD. + + + METHOD update_full_class_include. + + CONSTANTS: lc_class_source_extension TYPE sychar02 VALUE 'CS', + lc_include_program_type TYPE sychar01 VALUE 'I', + lc_active_version TYPE r3state VALUE 'A'. + + + create_report( iv_program = cl_oo_classname_service=>get_cs_name( iv_classname ) + it_source = it_source + iv_extension = lc_class_source_extension + iv_program_type = lc_include_program_type + iv_version = lc_active_version ). + + " Assuming that all methods that were scanned are implemented + update_cs_number_of_methods( iv_classname = iv_classname + iv_number_of_impl_methods = lines( it_methods ) ). + + ENDMETHOD. + + + METHOD update_meta. + + DATA: lo_update TYPE REF TO cl_oo_class_section_source, + ls_clskey TYPE seoclskey, + lv_scan_error TYPE seox_boolean. + + + ls_clskey-clsname = iv_name. + + TRY. + CREATE OBJECT lo_update TYPE ('CL_OO_CLASS_SECTION_SOURCE') + EXPORTING + clskey = ls_clskey + exposure = iv_exposure + state = 'A' + source = it_source + suppress_constrctr_generation = seox_true + EXCEPTIONS + class_not_existing = 1 + read_source_error = 2 + OTHERS = 3. + CATCH cx_sy_dyn_call_param_not_found. +* downport to 702, see https://github.com/larshp/abapGit/issues/933 +* this will READ REPORT instead of using it_source, which should be okay + CREATE OBJECT lo_update TYPE cl_oo_class_section_source + EXPORTING + clskey = ls_clskey + exposure = iv_exposure + state = 'A' + EXCEPTIONS + class_not_existing = 1 + read_source_error = 2 + OTHERS = 3. + ENDTRY. + IF sy-subrc <> 0. + zcx_abapgit_exception=>raise( 'error instantiating CL_OO_CLASS_SECTION_SOURCE' ). + ENDIF. + + lo_update->set_dark_mode( seox_true ). + TRY. + CALL METHOD lo_update->('SET_AMDP_SUPPORT') + EXPORTING + enabled = abap_true. + CATCH cx_sy_dyn_call_illegal_method. +* AMDP not supported in this system, ignore error + ENDTRY. + lo_update->scan_section_source( + RECEIVING + scan_error = lv_scan_error + EXCEPTIONS + scan_abap_source_error = 1 + OTHERS = 2 ). + IF sy-subrc <> 0 OR lv_scan_error = abap_true. + zcx_abapgit_exception=>raise( 'CLAS, error while scanning source' ). + ENDIF. + +* this will update the SEO* database tables + lo_update->revert_scan_result( ). + + IF iv_exposure = seoc_exposure_public. + generate_classpool( iv_name ). + ENDIF. + + ENDMETHOD. + + + METHOD update_report. + + DATA: lt_old TYPE string_table. + + READ REPORT iv_program INTO lt_old. + IF sy-subrc <> 0. + zcx_abapgit_exception=>raise( |Fatal error. Include { iv_program } should have been created previously!| ). + ENDIF. + + IF lt_old <> it_source. + INSERT REPORT iv_program FROM it_source. + ASSERT sy-subrc = 0. + rv_updated = abap_true. + ELSE. + rv_updated = abap_false. + ENDIF. + + ENDMETHOD. + + + METHOD update_source_index. + + CONSTANTS: + lc_version_active TYPE r3state VALUE 'A', "#EC NOTEXT + lc_version_inactive TYPE r3state VALUE 'I'. "#EC NOTEXT + + " dynamic invocation, IF_OO_SOURCE_POS_INDEX_HELPER doesn't exist in 702. + DATA lo_index_helper TYPE REF TO object. + + TRY. + CREATE OBJECT lo_index_helper TYPE ('CL_OO_SOURCE_POS_INDEX_HELPER'). + + CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~CREATE_INDEX_WITH_SCANNER') + EXPORTING + class_name = iv_clsname + version = lc_version_active + scanner = io_scanner. + + CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~DELETE_INDEX') + EXPORTING + class_name = iv_clsname + version = lc_version_inactive. + + CATCH cx_root. + " it's probably okay to no update the index + RETURN. + ENDTRY. + + ENDMETHOD. + + METHOD zif_abapgit_oo_object_fnc~create. + DATA: lt_vseoattrib TYPE seoo_attributes_r. FIELD-SYMBOLS: TYPE seoclsname. +* same as in super class, but with "version = seoc_version_active" + ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE cg_properties TO . ASSERT sy-subrc = 0. @@ -30,6 +383,7 @@ CLASS zcl_abapgit_oo_class IMPLEMENTATION. EXPORTING devclass = iv_package overwrite = iv_overwrite + version = seoc_version_active CHANGING class = cg_properties attributes = lt_vseoattrib @@ -44,44 +398,9 @@ CLASS zcl_abapgit_oo_class IMPLEMENTATION. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ). ENDIF. + ENDMETHOD. - METHOD zif_abapgit_oo_object_fnc~generate_locals. - CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS' - EXPORTING - clskey = is_key - force = iv_force - locals_def = it_local_definitions - locals_imp = it_local_implementations - locals_mac = it_local_macros - locals_testclasses = it_local_test_classes - EXCEPTIONS - not_existing = 1 - model_only = 2 - locals_not_generated = 3 - locals_not_initialised = 4 - OTHERS = 5. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error from generate_locals' ). - ENDIF. - ENDMETHOD. - - METHOD zif_abapgit_oo_object_fnc~insert_text_pool. - DATA: lv_cp TYPE program. - - lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ). - - INSERT TEXTPOOL lv_cp - FROM it_text_pool - LANGUAGE iv_language - STATE 'I'. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ). - ENDIF. - - zcl_abapgit_objects_activation=>add( iv_type = 'REPT' - iv_name = lv_cp ). - ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~create_sotr. DATA: lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt, @@ -143,6 +462,176 @@ CLASS zcl_abapgit_oo_class IMPLEMENTATION. ENDLOOP. ENDMETHOD. + + METHOD zif_abapgit_oo_object_fnc~delete. + CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE' + EXPORTING + clskey = is_deletion_key + EXCEPTIONS + not_existing = 1 + is_interface = 2 + db_error = 3 + no_access = 4 + other = 5 + OTHERS = 6. + IF sy-subrc = 1. +* ignore deletion of objects that does not exist +* this can happen when the SXCI object is deleted before the implementing CLAS + RETURN. + ELSEIF sy-subrc <> 0. + zcx_abapgit_exception=>raise( |Error from SEO_CLASS_DELETE_COMPLETE: { sy-subrc }| ). + ENDIF. + ENDMETHOD. + + + METHOD zif_abapgit_oo_object_fnc~deserialize_source. + + DATA: lv_updated TYPE abap_bool, + lv_program TYPE program, + lo_scanner TYPE REF TO cl_oo_source_scanner_class, + lt_methods TYPE cl_oo_source_scanner_class=>type_method_implementations, + lv_method LIKE LINE OF lt_methods, + lt_source TYPE seop_source_string. + + + "Buffer needs to be refreshed, + "otherwise standard SAP CLIF_SOURCE reorder methods alphabetically + CALL FUNCTION 'SEO_BUFFER_INIT'. + CALL FUNCTION 'SEO_BUFFER_REFRESH' + EXPORTING + cifkey = is_key + version = seoc_version_inactive. + + lo_scanner = init_scanner( + it_source = it_source + iv_name = is_key-clsname ). + +* public + lt_source = lo_scanner->get_public_section_source( ). + IF lt_source IS NOT INITIAL. + lv_program = cl_oo_classname_service=>get_pubsec_name( is_key-clsname ). + lv_updated = update_report( iv_program = lv_program + it_source = lt_source ). + IF lv_updated = abap_true. + update_meta( iv_name = is_key-clsname + iv_exposure = seoc_exposure_public + it_source = lt_source ). + ENDIF. + ENDIF. + +* protected + lt_source = lo_scanner->get_protected_section_source( ). + IF lt_source IS NOT INITIAL. + lv_program = cl_oo_classname_service=>get_prosec_name( is_key-clsname ). + lv_updated = update_report( iv_program = lv_program + it_source = lt_source ). + IF lv_updated = abap_true. + update_meta( iv_name = is_key-clsname + iv_exposure = seoc_exposure_protected + it_source = lt_source ). + ENDIF. + ENDIF. + +* private + lt_source = lo_scanner->get_private_section_source( ). + IF lt_source IS NOT INITIAL. + lv_program = cl_oo_classname_service=>get_prisec_name( is_key-clsname ). + lv_updated = update_report( iv_program = lv_program + it_source = lt_source ). + IF lv_updated = abap_true. + update_meta( iv_name = is_key-clsname + iv_exposure = seoc_exposure_private + it_source = lt_source ). + ENDIF. + ENDIF. + +* methods + lt_methods = lo_scanner->get_method_implementations( ). + + LOOP AT lt_methods INTO lv_method. + TRY. + lt_source = lo_scanner->get_method_impl_source( lv_method ). + CATCH cx_oo_clif_component. + zcx_abapgit_exception=>raise( 'error from GET_METHOD_IMPL_SOURCE' ). + ENDTRY. + lv_program = determine_method_include( + iv_name = is_key-clsname + iv_method = lv_method ). + + update_report( + iv_program = lv_program + it_source = lt_source ). + ENDLOOP. + +* full class include + update_full_class_include( iv_classname = is_key-clsname + it_source = it_source + it_methods = lt_methods ). + + update_source_index( + iv_clsname = is_key-clsname + io_scanner = lo_scanner ). + +* TODO, perhaps move this call to somewhere else, to be done while cleaning up the CLAS deserialization + zcl_abapgit_objects_activation=>add( + iv_type = 'CLAS' + iv_name = is_key-clsname ). + + ENDMETHOD. + + + METHOD zif_abapgit_oo_object_fnc~generate_locals. + + DATA: lv_program TYPE programm. + + + IF lines( it_local_definitions ) > 0. + lv_program = cl_oo_classname_service=>get_ccdef_name( is_key-clsname ). + update_report( iv_program = lv_program + it_source = it_local_definitions ). + ENDIF. + + IF lines( it_local_implementations ) > 0. + lv_program = cl_oo_classname_service=>get_ccimp_name( is_key-clsname ). + update_report( iv_program = lv_program + it_source = it_local_implementations ). + ENDIF. + + IF lines( it_local_macros ) > 0. + lv_program = cl_oo_classname_service=>get_ccmac_name( is_key-clsname ). + update_report( iv_program = lv_program + it_source = it_local_macros ). + ENDIF. + + IF lines( it_local_test_classes ) > 0. + lv_program = cl_oo_classname_service=>get_ccau_name( is_key-clsname ). + update_report( iv_program = lv_program + it_source = it_local_test_classes ). + ENDIF. + + ENDMETHOD. + + + METHOD zif_abapgit_oo_object_fnc~get_class_properties. + CALL FUNCTION 'SEO_CLIF_GET' + EXPORTING + cifkey = is_class_key + version = seoc_version_active + IMPORTING + class = rs_class_properties + EXCEPTIONS + not_existing = 1 + deleted = 2 + model_only = 3 + OTHERS = 4. + IF sy-subrc = 1. + RETURN. " in case only inactive version exists + ELSEIF sy-subrc <> 0. + zcx_abapgit_exception=>raise( 'error from seo_clif_get' ). + ENDIF. + ENDMETHOD. + + METHOD zif_abapgit_oo_object_fnc~get_includes. * note: includes returned might not exist * method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702 @@ -187,33 +676,25 @@ CLASS zcl_abapgit_oo_class IMPLEMENTATION. ENDMETHOD. - METHOD zif_abapgit_oo_object_fnc~get_class_properties. - CALL FUNCTION 'SEO_CLIF_GET' - EXPORTING - cifkey = is_class_key - version = seoc_version_active - IMPORTING - class = rs_class_properties - EXCEPTIONS - not_existing = 1 - deleted = 2 - model_only = 3 - OTHERS = 4. - IF sy-subrc = 1. - RETURN. " in case only inactive version exists - ELSEIF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error from seo_clif_get' ). - ENDIF. - ENDMETHOD. - METHOD zif_abapgit_oo_object_fnc~read_text_pool. - DATA: - lv_cp TYPE program. + METHOD zif_abapgit_oo_object_fnc~insert_text_pool. + DATA: lv_cp TYPE program. lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ). - READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP + + INSERT TEXTPOOL lv_cp + FROM it_text_pool + LANGUAGE iv_language + STATE 'I'. + IF sy-subrc <> 0. + zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ). + ENDIF. + + zcl_abapgit_objects_activation=>add( iv_type = 'REPT' + iv_name = lv_cp ). ENDMETHOD. + METHOD zif_abapgit_oo_object_fnc~read_sotr. DATA: lv_concept TYPE sotr_head-concept, lt_seocompodf TYPE STANDARD TABLE OF seocompodf WITH DEFAULT KEY, @@ -273,24 +754,12 @@ CLASS zcl_abapgit_oo_class IMPLEMENTATION. ENDLOOP. ENDMETHOD. - METHOD zif_abapgit_oo_object_fnc~delete. - CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE' - EXPORTING - clskey = is_deletion_key - EXCEPTIONS - not_existing = 1 - is_interface = 2 - db_error = 3 - no_access = 4 - other = 5 - OTHERS = 6. - IF sy-subrc = 1. -* ignore deletion of objects that does not exist -* this can happen when the SXCI object is deleted before the implementing CLAS - RETURN. - ELSEIF sy-subrc <> 0. - zcx_abapgit_exception=>raise( |Error from SEO_CLASS_DELETE_COMPLETE: { sy-subrc }| ). - ENDIF. - ENDMETHOD. + METHOD zif_abapgit_oo_object_fnc~read_text_pool. + DATA: + lv_cp TYPE program. + + lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ). + READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP + ENDMETHOD. ENDCLASS. diff --git a/src/objects/zcl_abapgit_oo_class_new.clas.abap b/src/objects/zcl_abapgit_oo_class_new.clas.abap deleted file mode 100644 index 1f880b60a..000000000 --- a/src/objects/zcl_abapgit_oo_class_new.clas.abap +++ /dev/null @@ -1,510 +0,0 @@ -CLASS zcl_abapgit_oo_class_new DEFINITION PUBLIC INHERITING FROM zcl_abapgit_oo_class. - - PUBLIC SECTION. - METHODS: - zif_abapgit_oo_object_fnc~create REDEFINITION, - zif_abapgit_oo_object_fnc~generate_locals REDEFINITION, - zif_abapgit_oo_object_fnc~deserialize_source REDEFINITION. - - PRIVATE SECTION. - - CLASS-METHODS update_source_index - IMPORTING - !iv_clsname TYPE csequence - !io_scanner TYPE REF TO cl_oo_source_scanner_class . - CLASS-METHODS update_report - IMPORTING - !iv_program TYPE programm - !it_source TYPE string_table - RETURNING - VALUE(rv_updated) TYPE abap_bool - RAISING - zcx_abapgit_exception . - CLASS-METHODS generate_classpool - IMPORTING - !iv_name TYPE seoclsname - RAISING - zcx_abapgit_exception . - CLASS-METHODS update_meta - IMPORTING - !iv_name TYPE seoclsname - !iv_exposure TYPE seoexpose - !it_source TYPE rswsourcet - RAISING - zcx_abapgit_exception . - CLASS-METHODS determine_method_include - IMPORTING - !iv_name TYPE seoclsname - !iv_method TYPE seocpdname - RETURNING - VALUE(rv_program) TYPE programm - RAISING - zcx_abapgit_exception . - CLASS-METHODS init_scanner - IMPORTING - !it_source TYPE zif_abapgit_definitions=>ty_string_tt - !iv_name TYPE seoclsname - RETURNING - VALUE(ro_scanner) TYPE REF TO cl_oo_source_scanner_class - RAISING - zcx_abapgit_exception . - CLASS-METHODS update_full_class_include - IMPORTING - !iv_classname TYPE seoclsname - !it_source TYPE string_table - !it_methods TYPE cl_oo_source_scanner_class=>type_method_implementations . - CLASS-METHODS create_report - IMPORTING - !iv_program TYPE programm - !it_source TYPE string_table - !iv_extension TYPE sychar02 - !iv_program_type TYPE sychar01 - !iv_version TYPE r3state . - CLASS-METHODS update_cs_number_of_methods - IMPORTING - !iv_classname TYPE seoclsname - !iv_number_of_impl_methods TYPE i . -ENDCLASS. - - - -CLASS zcl_abapgit_oo_class_new IMPLEMENTATION. - - - METHOD create_report. - INSERT REPORT iv_program FROM it_source EXTENSION TYPE iv_extension STATE iv_version PROGRAM TYPE iv_program_type. - ASSERT sy-subrc = 0. - ENDMETHOD. - - - METHOD determine_method_include. - - DATA: ls_mtdkey TYPE seocpdkey. - - - ls_mtdkey-clsname = iv_name. - ls_mtdkey-cpdname = iv_method. - - cl_oo_classname_service=>get_method_include( - EXPORTING - mtdkey = ls_mtdkey - RECEIVING - result = rv_program - EXCEPTIONS - method_not_existing = 1 ). - IF sy-subrc = 0. - RETURN. - ENDIF. - - CALL FUNCTION 'SEO_METHOD_GENERATE_INCLUDE' - EXPORTING - suppress_mtdkey_check = seox_true - mtdkey = ls_mtdkey - EXCEPTIONS - not_existing = 1 - model_only = 2 - include_existing = 3 - method_imp_not_generated = 4 - method_imp_not_initialised = 5 - _internal_class_not_existing = 6 - _internal_method_overflow = 7 - cancelled = 8 - method_is_abstract_implemented = 9 - method_is_final_implemented = 10 - internal_error_insert_report = 11 - OTHERS = 12. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error from SEO_METHOD_GENERATE_INCLUDE' ). - ENDIF. - - rv_program = cl_oo_classname_service=>get_method_include( ls_mtdkey ). - - ENDMETHOD. - - - METHOD generate_classpool. - - DATA: ls_clskey TYPE seoclskey. - - ls_clskey-clsname = iv_name. - - CALL FUNCTION 'SEO_CLASS_GENERATE_CLASSPOOL' - EXPORTING - clskey = ls_clskey - suppress_corr = seox_true - EXCEPTIONS - not_existing = 1 - model_only = 2 - class_pool_not_generated = 3 - class_stment_not_generated = 4 - locals_not_generated = 5 - macros_not_generated = 6 - public_sec_not_generated = 7 - protected_sec_not_generated = 8 - private_sec_not_generated = 9 - typeref_not_generated = 10 - class_pool_not_initialised = 11 - class_stment_not_initialised = 12 - locals_not_initialised = 13 - macros_not_initialised = 14 - public_sec_not_initialised = 15 - protected_sec_not_initialised = 16 - private_sec_not_initialised = 17 - typeref_not_initialised = 18 - _internal_class_overflow = 19 - OTHERS = 20. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error from SEO_CLASS_GENERATE_CLASSPOOL' ). - ENDIF. - - ENDMETHOD. - - - METHOD init_scanner. - - TRY. - ro_scanner = cl_oo_source_scanner_class=>create_class_scanner( - clif_name = iv_name - source = it_source ). - ro_scanner->scan( ). - CATCH cx_clif_scan_error. - zcx_abapgit_exception=>raise( 'error initializing CLAS scanner' ). - ENDTRY. - - ENDMETHOD. - - - METHOD update_cs_number_of_methods. - - " Indirect access to keep downward compatibility - DATA lr_cache_entry TYPE REF TO data. - - FIELD-SYMBOLS: TYPE any, - TYPE any. - - - TRY. - CREATE DATA lr_cache_entry TYPE ('SEO_CS_CACHE'). - CATCH cx_sy_create_data_error. -* does not exist in some older systems - RETURN. - ENDTRY. - - ASSIGN lr_cache_entry->* TO . - ASSERT sy-subrc = 0. - - ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE - TO . - ASSERT sy-subrc = 0. - = iv_classname. - - ASSIGN COMPONENT 'NO_OF_METHOD_IMPLS' OF STRUCTURE - TO . - ASSERT sy-subrc = 0. - = iv_number_of_impl_methods. - - MODIFY ('SEO_CS_CACHE') FROM . - - ENDMETHOD. - - - METHOD update_full_class_include. - - CONSTANTS: lc_class_source_extension TYPE sychar02 VALUE 'CS', - lc_include_program_type TYPE sychar01 VALUE 'I', - lc_active_version TYPE r3state VALUE 'A'. - - - create_report( iv_program = cl_oo_classname_service=>get_cs_name( iv_classname ) - it_source = it_source - iv_extension = lc_class_source_extension - iv_program_type = lc_include_program_type - iv_version = lc_active_version ). - - " Assuming that all methods that were scanned are implemented - update_cs_number_of_methods( iv_classname = iv_classname - iv_number_of_impl_methods = lines( it_methods ) ). - - ENDMETHOD. - - - METHOD update_meta. - - DATA: lo_update TYPE REF TO cl_oo_class_section_source, - ls_clskey TYPE seoclskey, - lv_scan_error TYPE seox_boolean. - - - ls_clskey-clsname = iv_name. - - TRY. - CREATE OBJECT lo_update TYPE ('CL_OO_CLASS_SECTION_SOURCE') - EXPORTING - clskey = ls_clskey - exposure = iv_exposure - state = 'A' - source = it_source - suppress_constrctr_generation = seox_true - EXCEPTIONS - class_not_existing = 1 - read_source_error = 2 - OTHERS = 3. - CATCH cx_sy_dyn_call_param_not_found. -* downport to 702, see https://github.com/larshp/abapGit/issues/933 -* this will READ REPORT instead of using it_source, which should be okay - CREATE OBJECT lo_update TYPE cl_oo_class_section_source - EXPORTING - clskey = ls_clskey - exposure = iv_exposure - state = 'A' - EXCEPTIONS - class_not_existing = 1 - read_source_error = 2 - OTHERS = 3. - ENDTRY. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error instantiating CL_OO_CLASS_SECTION_SOURCE' ). - ENDIF. - - lo_update->set_dark_mode( seox_true ). - TRY. - CALL METHOD lo_update->('SET_AMDP_SUPPORT') - EXPORTING - enabled = abap_true. - CATCH cx_sy_dyn_call_illegal_method. -* AMDP not supported in this system, ignore error - ENDTRY. - lo_update->scan_section_source( - RECEIVING - scan_error = lv_scan_error - EXCEPTIONS - scan_abap_source_error = 1 - OTHERS = 2 ). - IF sy-subrc <> 0 OR lv_scan_error = abap_true. - zcx_abapgit_exception=>raise( 'CLAS, error while scanning source' ). - ENDIF. - -* this will update the SEO* database tables - lo_update->revert_scan_result( ). - - IF iv_exposure = seoc_exposure_public. - generate_classpool( iv_name ). - ENDIF. - - ENDMETHOD. - - - METHOD update_report. - - DATA: lt_old TYPE string_table. - - READ REPORT iv_program INTO lt_old. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( |Fatal error. Include { iv_program } should have been created previously!| ). - ENDIF. - - IF lt_old <> it_source. - INSERT REPORT iv_program FROM it_source. - ASSERT sy-subrc = 0. - rv_updated = abap_true. - ELSE. - rv_updated = abap_false. - ENDIF. - - ENDMETHOD. - - - METHOD update_source_index. - - CONSTANTS: - lc_version_active TYPE r3state VALUE 'A', "#EC NOTEXT - lc_version_inactive TYPE r3state VALUE 'I'. "#EC NOTEXT - - " dynamic invocation, IF_OO_SOURCE_POS_INDEX_HELPER doesn't exist in 702. - DATA lo_index_helper TYPE REF TO object. - - TRY. - CREATE OBJECT lo_index_helper TYPE ('CL_OO_SOURCE_POS_INDEX_HELPER'). - - CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~CREATE_INDEX_WITH_SCANNER') - EXPORTING - class_name = iv_clsname - version = lc_version_active - scanner = io_scanner. - - CALL METHOD lo_index_helper->('IF_OO_SOURCE_POS_INDEX_HELPER~DELETE_INDEX') - EXPORTING - class_name = iv_clsname - version = lc_version_inactive. - - CATCH cx_root. - " it's probably okay to no update the index - RETURN. - ENDTRY. - - ENDMETHOD. - - - METHOD zif_abapgit_oo_object_fnc~create. - DATA: lt_vseoattrib TYPE seoo_attributes_r. - FIELD-SYMBOLS: TYPE seoclsname. - -* same as in super class, but with "version = seoc_version_active" - - ASSIGN COMPONENT 'CLSNAME' OF STRUCTURE cg_properties TO . - ASSERT sy-subrc = 0. - - lt_vseoattrib = convert_attrib_to_vseoattrib( - iv_clsname = - it_attributes = it_attributes ). - - CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE' - EXPORTING - devclass = iv_package - overwrite = iv_overwrite - version = seoc_version_active - CHANGING - class = cg_properties - attributes = lt_vseoattrib - EXCEPTIONS - existing = 1 - is_interface = 2 - db_error = 3 - component_error = 4 - no_access = 5 - other = 6 - OTHERS = 7. - IF sy-subrc <> 0. - zcx_abapgit_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ). - ENDIF. - - ENDMETHOD. - - - METHOD zif_abapgit_oo_object_fnc~deserialize_source. - - DATA: lv_updated TYPE abap_bool, - lv_program TYPE program, - lo_scanner TYPE REF TO cl_oo_source_scanner_class, - lt_methods TYPE cl_oo_source_scanner_class=>type_method_implementations, - lv_method LIKE LINE OF lt_methods, - lt_source TYPE seop_source_string. - - - "Buffer needs to be refreshed, - "otherwise standard SAP CLIF_SOURCE reorder methods alphabetically - CALL FUNCTION 'SEO_BUFFER_INIT'. - CALL FUNCTION 'SEO_BUFFER_REFRESH' - EXPORTING - cifkey = is_key - version = seoc_version_inactive. - - lo_scanner = init_scanner( - it_source = it_source - iv_name = is_key-clsname ). - -* public - lt_source = lo_scanner->get_public_section_source( ). - IF lt_source IS NOT INITIAL. - lv_program = cl_oo_classname_service=>get_pubsec_name( is_key-clsname ). - lv_updated = update_report( iv_program = lv_program - it_source = lt_source ). - IF lv_updated = abap_true. - update_meta( iv_name = is_key-clsname - iv_exposure = seoc_exposure_public - it_source = lt_source ). - ENDIF. - ENDIF. - -* protected - lt_source = lo_scanner->get_protected_section_source( ). - IF lt_source IS NOT INITIAL. - lv_program = cl_oo_classname_service=>get_prosec_name( is_key-clsname ). - lv_updated = update_report( iv_program = lv_program - it_source = lt_source ). - IF lv_updated = abap_true. - update_meta( iv_name = is_key-clsname - iv_exposure = seoc_exposure_protected - it_source = lt_source ). - ENDIF. - ENDIF. - -* private - lt_source = lo_scanner->get_private_section_source( ). - IF lt_source IS NOT INITIAL. - lv_program = cl_oo_classname_service=>get_prisec_name( is_key-clsname ). - lv_updated = update_report( iv_program = lv_program - it_source = lt_source ). - IF lv_updated = abap_true. - update_meta( iv_name = is_key-clsname - iv_exposure = seoc_exposure_private - it_source = lt_source ). - ENDIF. - ENDIF. - -* methods - lt_methods = lo_scanner->get_method_implementations( ). - - LOOP AT lt_methods INTO lv_method. - TRY. - lt_source = lo_scanner->get_method_impl_source( lv_method ). - CATCH cx_oo_clif_component. - zcx_abapgit_exception=>raise( 'error from GET_METHOD_IMPL_SOURCE' ). - ENDTRY. - lv_program = determine_method_include( - iv_name = is_key-clsname - iv_method = lv_method ). - - update_report( - iv_program = lv_program - it_source = lt_source ). - ENDLOOP. - -* full class include - update_full_class_include( iv_classname = is_key-clsname - it_source = it_source - it_methods = lt_methods ). - - update_source_index( - iv_clsname = is_key-clsname - io_scanner = lo_scanner ). - -* TODO, perhaps move this call to somewhere else, to be done while cleaning up the CLAS deserialization - zcl_abapgit_objects_activation=>add( - iv_type = 'CLAS' - iv_name = is_key-clsname ). - - ENDMETHOD. - - - METHOD zif_abapgit_oo_object_fnc~generate_locals. - - DATA: lv_program TYPE programm. - - - IF lines( it_local_definitions ) > 0. - lv_program = cl_oo_classname_service=>get_ccdef_name( is_key-clsname ). - update_report( iv_program = lv_program - it_source = it_local_definitions ). - ENDIF. - - IF lines( it_local_implementations ) > 0. - lv_program = cl_oo_classname_service=>get_ccimp_name( is_key-clsname ). - update_report( iv_program = lv_program - it_source = it_local_implementations ). - ENDIF. - - IF lines( it_local_macros ) > 0. - lv_program = cl_oo_classname_service=>get_ccmac_name( is_key-clsname ). - update_report( iv_program = lv_program - it_source = it_local_macros ). - ENDIF. - - IF lines( it_local_test_classes ) > 0. - lv_program = cl_oo_classname_service=>get_ccau_name( is_key-clsname ). - update_report( iv_program = lv_program - it_source = it_local_test_classes ). - ENDIF. - - ENDMETHOD. -ENDCLASS. diff --git a/src/objects/zcl_abapgit_oo_class_new.clas.xml b/src/objects/zcl_abapgit_oo_class_new.clas.xml deleted file mode 100644 index bce6cf6da..000000000 --- a/src/objects/zcl_abapgit_oo_class_new.clas.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - ZCL_ABAPGIT_OO_CLASS_NEW - 1 - E - 1 - X - X - X - - - - diff --git a/src/zcl_abapgit_objects.clas.abap b/src/zcl_abapgit_objects.clas.abap index 84f3fef6e..abe967bf3 100644 --- a/src/zcl_abapgit_objects.clas.abap +++ b/src/zcl_abapgit_objects.clas.abap @@ -385,11 +385,6 @@ CLASS ZCL_ABAPGIT_OBJECTS IMPLEMENTATION. lv_class_name = class_name( is_item ). ENDIF. -* IF zcl_abapgit_persist_settings=>get_instance( )->read( )->get_experimental_features( ) = abap_true -* AND is_item-obj_type = 'CLAS'. -* lv_class_name = 'LCL_OBJECT_CLAS_NEW'. -* ENDIF. - REPLACE FIRST OCCURRENCE OF 'LCL' IN lv_class_name WITH 'ZCL_ABAPGIT'. TRY.