How to ignore unreachable statement (javac)?

for debugging/testing purposes, i would like the javac compiler to ignore unreachable statement or just print a warning and not an error. is this possible?
reason: it's much easer to type "return result;" somewhere within code than do enclose several (cascaded) parts with if ().

Good day,
Even though I'm pretty new to Java, I don't think this is possible.
I would presume that you're doing this mainly to debug your code.
I personnaly define a boolean variable, which can be accessed all throughout the class file : "boolean leavenow=true;"
When I want to insert a "temporary breakpoint" to check things out, I simply type something like "if (leavenow) return result;".
I understand that this is tad longer to type, but it doesn't affect the indentation of your code if you want to keep the things "aligned".
Might not be the ideal approach, but this is a way to look at it.
Regards.

Similar Messages

  • How to ignore programmatically some items during a query ?

    Hi all,
    The process of my application is like this : first of all the end-user enters some criteria , then he/she presses a button to search for the possible results matching the criteria entered (execute_query). The possible results are displayed through a multirecord based datablock.
    The criteria screen has two parts , say part_a and part_b. When the end-user does not enter any criteria in part_b then the datasource of the results block should be a table , say data_source_1 ; and if some criteria are entered in part_b then the datasource of the results block should be a view , say data_source_2.
    The datasource data_source_1 has less number of columns than the datasource data_source_2 , but all of data_source_1's columns are included into data_source_2.
    So my problem is when the datasource of the results block is set to data_source_1 then there are unknown columns when executing the query (alert error). All of the columns of data_source_2 are included in the results block , and all of the columns of data_source_1 are automatically there because mathematically speaking data_source_1 is included into data_source_2.
    I have tried to use in the pre-query trigger of the results block this statement : set_item_property('results_possibles.column_a',queryable,property_false); but the same error still occurs.
    So how to ignore these items ?
    Thank you very much indeed.

    After looking at what you did to try to solve the problem, I'm not sure what the actual problem is.
    You can make both datasources have the same number of columns by selecting nulls:
    data_source_1: select a, b, c, null as d, null as e from <table>
    data_source_2: select a, b, c, d, e from <view>
    If you have a field which is used to query a column which is included in data_source_2 but not in data_source_1, and that field is populated when you run the query, then just set the block's default_where to ignore that field.
    eg
    data_source_1: where...and c like nvl(:control.c,'%')
    data_source_2: where...and c like nvl(:control.c,'%') and d like nvl(:control.d,'%')...

  • Expected "unreachable statement" error but it compiled successfully

    Bellow following code, i expected compile time error something like "unreachable statement i++" on line no. 4 as it is obvious that the line returns 'i' and increments 'i' value due to virtue of post increment operator ++. But i didn't get any type of errors - compile time or runtime error - which i thought would get one and ran successfully printing 0.
    Can anybody explain the reason behind this?
    1. class Target {
    2.     private int i = 0;
    3.     public int addOne() {
    4.          return i++;
    5.     }
    6. }
    7. public class Client {
    8.      public static void main(String[] args) {
    9.          System.out.println(new Target().addOne());
    10.     }
    11.}

    karthikbhuvana wrote:
    Ok fine. That's a good example. But my question is, once the control returns from the method addOne(), how it is possible that variable 'i' gets incremented?
    return i++; is equivalent to the following:
    int tmp = i;
    i = i + 1;
    return tmp;The expression i++ is evaluated completely, and then the value of the i++ expression is returned. Evaluating i++ completely means "remembering" the current value of i as the value of the expression, and then incrementing i.
    That's also why
    int i = 0;
    i = i++; // never do this for real
    System.out.println(i);prints out 0, not 1. The RHS is evaluated before assigning to the LHS. The "post" in "post-increment" doesn't mean "after the rest of the statement is done." I means "increment happens after getting the value of the expression."

  • Unreachable statement error

    Could you please help me figure out what the problem with my code is? I get: C:\Documents and Settings\Sandy\My Documents\Payroll2.java:31: unreachable statement
    System.out.println( "Enter Hourly Rate: "); // prompt
    ^
    1 error
    when I compile this:
    // Payroll2.java
    // A Payroll program with a while loop
    // that continues until "stop" is used as the name
    import java.util.Scanner; // program uses class Scanner
    public class Payroll2
    // main method begins execution of java application
    public static void main(String args[])
    // create a scanner to obtain input in command window
    Scanner input = new Scanner( System.in );
    String employeeName; // Name of employee
    double hourlyRate; // Amount made in one hour
    double hoursWorked; // Number of hours worked in one week
    double weeklyPay; // The multiple of hourly rate and hours worked in one week
    // while method employed to enter emplyee's name
    while ( "employeeName" != "stop")
    System.out.println("Enter an employee name(Input 'stop' when finished)\n\n"); //prompt
    employeeName = input.nextLine(); // read employee name or stop
    } // end while
    // if...else method used to input hourly rate as a positive double
    System.out.println( "Enter Hourly Rate: "); // prompt
    hourlyRate = input.nextDouble(); // read hourly rate
    if ( hourlyRate <= 0)
    System.out.println( "Hourly Rate incorrect, please try again\n"); // error message
    }// end if
    else
    System.out.println( "Correct Hourly Rate input, thank you\n\n"); // confirmation message
    } // end else
    // if...else method used to input hours worked
    System.out.print( "Enter Hours Worked: "); // prompt
    hoursWorked = input.nextDouble(); // read hours worked
    if ( hoursWorked <= 0)
    System.out.println( "Weekly hours worked is incorrect, please try again\n"); // error message
    }// end if
    else
    System.out.println( "Correct weekly hours input, thank you\n\n"); // confirmation message
    } // end else
    // calculate weekly pay
    weeklyPay = hourlyRate * hoursWorked; // multiply numbers
    // display employee name and weekly pay
    System.out.printf( "Weekly Pay for %s,is $%.2f\n", employeeName, weeklyPay);
    System.out.println( "Thank you for using Payroll2\n"); // good bye message
    } // end method main
    } // end class Payroll2

    Tip: You will find the appropriate method in the Java API. (If you are not familiar whit that try http://java.sun.com/javase/6/docs/api/)
    If you do not find the answer just ask again... Everybody loves to help here it seems. But you should know that the sooner you learn how to find the (simple or not simple) answers in the API the sooner you will be a real good java programmer. good luck!

  • Unreachable statement

    Hi experts,
    After running the Extended check (SLIN) I got the following message:
    Unreachable Statement After Jump Statement EXIT:
      DESCRIBE TABLE i_table LINES itab_lines.
    (You can hide the message using "#EC *)
    My question: How can I eliminate this error?

    Hi...
    If u have any statements that terminates the Current processing Block / Program such as
    Leave to Screen...
    Exit..
    Stop..
    Then any statements after them will not be reachable.
    So you need to avoid them.
    Paste ur code if u are not able to trace it.
    <b>Reward if Helpful.</b>

  • SBS 2011 reports firewall disabled as "critical", how to ignore?

    Sick of this "error".  I turned the Windows Firewall off. Don't need it. How do i get the console to ignore this state and stop reporting it as a problem.
    Please don't spew the partly line at me, all the pros know windows firewall is a major PITA to be avoided at all costs. The network has a WAN hardware firewall, and AV inside the LAN. 

     Feel free to think you know better about firewalls, but knowing
    EXACTLY what application is going out of WHAT port ensures that when
    there's unwanted processes that I have a better handle on my internal
    security.  An external firewall is NOT the same thing as an internal
    firewall.  And the sooner all of you guys think you know better
    especially as we're doing more cloud stuff the better off we'll all be.
    Now to your ask.  I'm forgetting off the top of my head if it's
    responding to the service not running (in which case go into the network
    tab, and configure the alerts for running services and untick the
    windows firewall service monitoring that it's doing) or if it's reacting
    to an eventid  -- if it's that you can used
    http://blogs.technet.com/b/sbs/archive/2012/01/16/managing-event-alerts-in-your-reports-an-sbs-monitoring-feature-enhancement.aspx
    to edit your reports to get it to ignore the alert.
    If either one doesn't help holler back, but understand that posting in a
    forum and insulting everyone in the process isn't exactly the greatest
    way to expect help around here.
    You are new to this forum and I'd like to urge you to be a bit kinder to
    those here that just come to help people.  Mohammed was not a troll.
    P.S. I drink Mountain dew not Koolaid.

  • In SQL Trace how to see which statement getting more time .

    Hi Expart,
    In SQL Trace (T-code ST05) . I am running the standard transaction . how to see which statement
    running more time and less time . suppose one statement running more time so how resolve the
    performance .
    Plz. reply me
    Regards
    Razz

    > The ones in 'RED' color are the statement which are taking a lot of time and you need to
    > optimise the same.
    No, that is incorrect, the red ones show only the ones which need several hundret milliseconds in one execution. This can even be correct for hard tasks. And there are lots of problem, which you will not see
    I have said everything here:
    SQL trace:
    /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
    Go to 'Tracelist' -> Summarize by SQL statements', this is the view which you want to see!
    I summarizes all executions of the same statement.
    There are even the checks explained, the slow ones are the one which need a lot of time per record!
    See MinTime/Rec > 10.000 microseconds.
    Check all number of records, executions, buffer, identicals.
    The SE30 Tipps and Tricks will not help much.
    Siegfried

  • How to ignore blank/null key figure value in BI Queries

    Reports on Multiprovider - we see some cells of a Key figure as blanks. These blanks are interpreted as zeros by the system and calculated accordingly resulting in incorrect values. As per our requirement, we need a count of all hard/real zeros only, not the blanks. For example, if there are 10 rows of which 6 are real zeros and 4 are blanks - our count should be 6 and not 10.
    How to ignore the blanks in BEx queries please?
    Thanks for your help.
    Upender

    Rakesh,
    It is not possible to find a pattern because the report is on a MultiProvider with 2 InfoProviders- Purchasing documents DSO and Material Movements InfoCube.
    Every Purchasing Document has several materials associated with it. These materials are compared with materials in Materials Movement. Not all materials in Purchasing Document are found in Materials Movement. For those Materials found in Materials Movement, the Quantity is obtained. For these found rows, the correct value is showing up - if the quantity is zero, it is showing in reports as zero. If the material is not found in Material Movements then Quantity shows up as blank values.
    My requirement is ignore such blank quantities and not count them. Only Quantities with 0 values should be counted. Currently both blanks and zero values are counted showing inflated count.
    Thanks,
    Upender

  • How do I add State/Province and Country to my drop down list?

    How do I add State/Province and Country to my drop down list?

    Hi Gen,
    My problem is that I'm working with the free version of Form Central - I'm willing to purchase a version.  Earlier in my form I have States as a drop down menu (see below) but can't copy it to make it appear later in the same document. I was trying to avoid recreating the entire form. Any tips on copying or duplicating a field inside a document.
    Best Regards,
    Gina Grant
    ink + thread
    312.970.1106 (p)
    773.435.6474 (f)
    www.inknthread.com
    CPS Vendor #: 98626
    The information contained in this email is confidential, proprietary and may be legally privileged. This email is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, dissemination, or reproduction is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact ink + thread by e-mail ([email protected]) and destroy all copies of this email.

  • How to use perform statements in sap scripts

    how to use perform statements in sap scripts . and pls send me one progam for this
    thnaks
    raja

    Hi Raja,
    <b>PERFORM</b> key work is used to include subroutine in sapscript form...
    But the processing is lttle bit different form the one we use in ABAP.
    Here the paramters passed to form is stored in internal table of name-value table. there are two table one for inbound parameter and other for outbound parameters.
    Check out the example below to see how this is used..
    <b>Definition in the SAPscript form:</b>
    /: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
    /: USING &PAGE&
    /: USING &NEXTPAGE&
    /: CHANGING &BARCODE&
    /: ENDPERFORM
    / &BARCODE&
    <b>Coding of the calling ABAP program:</b>
    REPORT QCJPERFO.
    FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
    OUT_PAR STRUCTURE ITCSY.
    DATA: PAGNUM LIKE SY-TABIX, "page number
    NEXTPAGE LIKE SY-TABIX. "number of next page
    READ TABLE IN_PAR WITH KEY ‘PAGE’.
    CHECK SY-SUBRC = 0.
    PAGNUM = IN_PAR-VALUE.
    READ TABLE IN_PAR WITH KEY ‘NEXTPAGE’.
    CHECK SY-SUBRC = 0.
    NEXTPAGE = IN_PAR-VALUE.
    READ TABLE OUT_PAR WITH KEY ‘BARCODE’.
    CHECK SY-SUBRC = 0.
    IF PAGNUM = 1.
    OUT_PAR-VALUE = ‘|’. "First page
    ELSE.
    OUT_PAR-VALUE = ‘||’. "Next page
    ENDIF.
    IF NEXTPAGE = 0.
    OUT_PAR-VALUE+2 = ‘L’. "Flag: last page
    ENDIF.
    MODIFY OUT_PAR INDEX SY-TABIX.
    ENDFORM.
    Hope this is clear to understand...
    Enjoy SAP.
    Pankaj Singh.

  • How to debugg particular statement in sap script

    hi friends,
    i want to know How to debugg particular statement in sap script.
    plz reply.
    thanks in advance,
    regards
    bhaskar

    hi
      execute rstxdbug to activate script debugger...once the driver program reaches open_form, a popup box will come where u can mention the name of a command, call functinon, text element, etc to place a break point...once it gets into the debugging mode, double click on any line to set a break point, after that pressing f8 will get you to that line
    if helpful, reward
    Sathish. R

  • How to ignore zero in select query

    select * from EINA where  EINAMATNR = <b>yyyy</b> and EINALIFNR = <b>zzzz</b>
    In select query, how to ignore zero? for example, EINAMATNR = 0000000yyyy, EINALIFNR=000zzz
    Maybe I can use LIKE keyword in sql query. Any other way?
    Thanks.

    Use the following conversion routines to convert yyyy & zzzz  to remove the leading zeros and then pass it to your select query.
    For Matnr -> CONVERSION_EXIT_MATN1_INPUT
    For LIFNR ->CONVERSION_EXIT_alpha_input.
       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
            EXPORTING
              input  = yyyy
            IMPORTING
              output = t_lifnr.
          CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
            EXPORTING
              input  = zzzz
            IMPORTING
              output = t_matnr.
    select * from EINA where EINA~MATNR = t_matnr  and EINA~LIFNR = t_lifnr .

  • How to maintain a state in webdynpro?

    HI Experts,
    I have one  node and some value attributes(dynamic attributes) in this node.
    I am using these dynamic attributes in wdDoModifyView() to customize my table.I am setting the customisation properties in the Customization view and when I click "OK",the table is getting changed in the Table view.Everything is working fine.But when I again try to customize the table ,I open the Customization view ,the previously modified changes are not there in the Customization view  .Customization view is not holding the state.Its getting reset.
    Please suggest me how to retain the state.
    Regards
    -Sandip

    HI Ayyaparaj,
    I did it in the same way.I created the node in the component controller and maped it with the the two views (Table View and Customization View).The first time when I customize,its working.But next time when I open the Customize view,Customize view not holding the previous state.
    Do i need to do any setting in the Node property?
    Please suggest me.
    Regards
    -Sandip

  • How to ignore the material with error in costing run ck40n

    Hi
    Pls, advice how to ignore parent material form costing run if the components of that material have errors. I need to run the costing run excluding erroneous parent item. Is any configuration on this..
    Pls help..
    K

    Hi Kesharika Goona... 
    If you want to exclude any material from Costing Run, there are two ways...
    1. Go to Material Master, Costing1 view, take the check box "Do Not Cost". If you opt for this check box, the system will not consider this material for costing.
    2. Where you run the standard cost estimate in CK40N, once you save you costing run with the parameters like Costing Variant etc, When you select the "Parameters" agains the Flow step of "Selection", you will be asked to give the inputs like Material Number, Plant etc.
    There, against the Material Number, on the extrem right side, you will see a arrow, press that arrow, and there you can see a tab "Exclude Single Values". There you have to give the material number which you want to exclude from the costing run press "Execute" icon on the botoom-left corner of that pop-up window..
    If you still face problem, pls revert back
    Srikanth Munnaluri

  • How to use union statement with declare & set function?

    Hi Experts,
            i  have small query about how to use union statement with declare & set function?
    Example as below :
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]

    You have to create stored procedure in SQL only .
    Like u must have create for Crystal .
    You can execute procedure in query manager but you have to enter parameter manually..
    example
    Exec @Test '20140101' '20140501'
    Every time user has to enter it manually in yyyymmdd format in case of date parameters.
    Example
    Create Proc [@Test]
    as begin
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between
    between @Name and @Name2
    end

Maybe you are looking for

  • Backing up to external hard drive connected to the Time Capsule?

    I have connected an external hard-drive to the 1TB TC. Using the Time Machine settings, I cannot select this disk to backup too, even though this disk is accessible via the finder > timecapsule > external drive. My general issue is: I have a 2TB hard

  • Acct Assignment mandatory

    Hi I have created 1 Raw Material and now creating PO.But I am getting the following error There is no provision for value-based inventory management for this material type in this plant. Account assignment is thus necessary I have never made any such

  • Resolution Limitations with Second Display

    What´s the maximum video resolution macbook MB403 can drive? I´m using a second display (Samsung wide screen syncMaster 226BW, and after configuring it at 1680x1050 - which is the usual resolution for this type of display, I realized that the actual

  • Superdrive: CD works/DVD does not

    I have a situation that I have not been able to find articles on. When I place a CD (audio for instance) into the superdrive of my iBook the appropriate program (iTunes in this case) works. If I place a DVD in the disc will not be able to be read. I

  • Itunes 10.5.1.42 (latest) keeps crashing when i add song folder

    hi, iam using windows 7 nd has an ipod touch. when i add songs to itunes, the progress bar stoppes in the middle nd says that "itunes has stopped working". i cant do ny thing but to close itunes. i have the latest version of itunes on my computer nd