5 Replies Latest reply on May 13, 2015 5:02 PM by Vadim Tropashko-Oracle

    Bug in Version 4.1.0.19 - outline out of sync with package body editor

    JuliusZ

      It's probably a bug, just wanted to report it.

       

      The problem is that the selected program unit in outline does not correspond to the actual cursor position in a package body. When selecting some program unit in outline it does jump to the right position in the editor of package body, but after clicking anywhere in the editor the outline has wrong program unit selected.

       

      Is anyone else experiencing this?

        • 1. Re: Bug in Version 4.1.0.19 - outline out of sync with package body editor
          Vadim Tropashko-Oracle

          There must be something about your code. In simple cases like this

           

          create or replace PACKAGE BODY MYPACKAGE

          AS

            PROCEDURE test1(

                r NUMBER )

            AS

            BEGIN

              dbms_output.put_line( r );

            END test1;

           

            PROCEDURE test2

            AS

              x INTEGER;

            BEGIN

              dbms_output.put_line( 'Test' );

              SELECT 1

              INTO x

              FROM

              EMPLOYEES;

            END test2;

           

            FUNCTION fun_test

              RETURN VARCHAR2

            AS  

            BEGIN   

              RETURN 'Hello'; 

            END;

           

          END MYPACKAGE;

           

          clicking anywhere in the code highlights the enclosing procedure name on Quick Outline panel. Can you please post your code (you are adviced to reduce it to minimal reproducing test case).

          • 2. Re: Bug in Version 4.1.0.19 - outline out of sync with package body editor
            JuliusZ

            Hi Vadim,

             

            Thanks for getting back to me. Even with this simple test case you posted, it doesn't work for me for some reason. Here are the pics with cursor in each of the three procedures and the wrongly selected Quick Outline item.

             

            1. Cursor inside procedure test1:

            cursor_at_proc_test1.jpg

             

            2. Cursor inside procedure test2:

             

            cursor_at_proc_test2.jpg

             

            3. Cursor inside procedure fun_test:

             

            cursor_at_proc_fun_test.jpg

            The only thing that I changed from your example was the select statement in test2 (dual instead of EMPLOYEES - this shouldn't matter, right?). And I also added package spec like this (don't think it matters too):

             

            create or replace PACKAGE MYPACKAGE

            as

               procedure test2;

            end;

             

            So there must be something different in my environment. More about that:

             

            Windows 7 Enterprise 64bit

             

            SQL Developer Version 4.1.0.19

            Build MAIN-19.07

             

            >java -version

            java version "1.8.0"

            Java(TM) SE Runtime Environment (build 1.8.0-b132)

            Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

             

            Thanks,

            Julius

            • 3. Re: Bug in Version 4.1.0.19 - outline out of sync with package body editor
              Vadim Tropashko-Oracle

              Reproduced, bugged. (In my case ordering was by position in the source, in your case -- alphabetical).

              • 4. Re: Bug in Version 4.1.0.19 - outline out of sync with package body editor
                JuliusZ

                Since we are at it, I have a couple of more questions regarding the Quick Outline Yes, I noticed that the sorting seems to be alphabetical not in the order it appears in the source. That would be fine, although it would be ideal to right click in the quick outline panel and change the ordering when I need to. Or is there some kind of option/preference to set to change that (since you are saying that you have different ordering)?

                 

                But anyway, the sorting is actually not alphabetical It's been aggregated and then sorted alphabetically. See the following example (all I added to our previous MYPACKAGE package body was some global variables and one more function). Seems like the alphabetical ordering is not preserved - boolean variables first, then functions, then number/pls_integer variables, then procedures and then varchar2 type variables. All groups are sorted alphabetically though. Looking at some other packages I have, I see that date variables are after booleans but before functions. And adding type declarations removes all variables from the outline (see another example below).

                 

                create or replace PACKAGE BODY MYPACKAGE

                AS

                 

                 

                   c_schema_from      constant varchar2(10) := 'ASDLJK';

                   c_schema_to        constant varchar2(10) := 'ASDASD';

                 

                 

                   c_t                constant varchar2(1)  := 'T';

                   c_error_log_prefix constant varchar2(6)  := 'ERR$$_';

                 

                 

                   g_stat_seq         number(3) ;

                   g_metadata_init    boolean          := false;

                   g_ctas             constant boolean := false;

                 

                 

                   g_debug            constant boolean := true;

                   g_purge            constant boolean := false;

                 

                 

                   g_idx pls_integer                   := 0;

                  

                  PROCEDURE test1(

                      r NUMBER )

                  AS

                  BEGIN

                    dbms_output.put_line( r );

                  END test1;

                 

                  PROCEDURE test2

                  AS

                    x INTEGER;

                  BEGIN

                    dbms_output.put_line( 'Test' );

                    SELECT 1

                    INTO x

                    FROM

                    dual;

                  END test2;

                 

                  FUNCTION fun_test

                    RETURN VARCHAR2

                  AS 

                  BEGIN  

                    RETURN 'Hello';

                  END;

                 

                function test3 return number

                is

                begin

                   return 1;

                end;

                END MYPACKAGE;

                 

                Outline:

                 

                outline_sorting.jpg

                 

                 

                With type declarations:

                 

                create or replace PACKAGE BODY MYPACKAGE

                AS

                 

                 

                  type char_tbl is table of varchar2(2000) index by binary_integer;

                  type num_tbl is table of number index by binary_integer;

                 

                   c_schema_from      constant varchar2(10) := 'ASDLJK';

                   c_schema_to        constant varchar2(10) := 'ASDASD';

                   c_t                constant varchar2(1)  := 'T';

                   c_error_log_prefix constant varchar2(6)  := 'ERR$$_';

                   g_stat_seq         number(3) ;

                   g_metadata_init    boolean          := false;

                   g_ctas             constant boolean := false;

                   g_debug            constant boolean := true;

                   g_purge            constant boolean := false;

                 

                 

                   g_idx pls_integer                   := 0;

                  

                  PROCEDURE test1(

                      r NUMBER )

                  AS

                  BEGIN

                    dbms_output.put_line( r );

                  END test1;

                 

                  PROCEDURE test2

                  AS

                    x INTEGER;

                  BEGIN

                    dbms_output.put_line( 'Test' );

                    SELECT 1

                    INTO x

                    FROM

                    dual;

                  END test2;

                 

                  FUNCTION fun_test

                    RETURN VARCHAR2

                  AS 

                  BEGIN  

                    RETURN 'Hello';

                  END;

                 

                function test3 return number

                is

                begin

                   return 1;

                end;

                END MYPACKAGE;

                /

                 

                outline2.jpg

                Here the first type declaration appears in the very end of the quick outline, but all other variable/type declarations disappear completely, leaving only functions/procedures.

                 

                 

                Thanks,

                 

                Julius.

                • 5. Re: Bug in Version 4.1.0.19 - outline out of sync with package body editor
                  Vadim Tropashko-Oracle

                  The option to order members by either location in the source, or by name, or by type, then name is in navigator tree context menu. You seem to have it ordered by type then name, but this is the third option, not default (I wonder what have cause this).

                   

                  I accept two bugs from this exchange:

                  1. Outline panel should have the same "Order Members By" context menu as navigator PL/SQL nodes.

                  2. Parsing failure in you second example with type declarations.