Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 306623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:29:02+00:00 2026-05-12T07:29:02+00:00

I use a class for detecting email addresses which uses static final booleans to

  • 0

I use a class for detecting email addresses which uses static final booleans to configure the matching behavior. Since I upgraded to Eclipse 3.5 I get warnings about dead code, since Eclipse notices that one branch in this can not be reached:

private static final boolean ALLOW_DOMAIN_LITERALS = false;
private static final String domain = ALLOW_DOMAIN_LITERALS ? rfc2822Domain : rfc1035DomainName;

Oddly enough it is happy with this:

private static final String domain;
static {
    if(ALLOW_DOMAIN_LITERALS) {
        domain = rfc2822Domain;
    } else {
        domain= rfc1035DomainName;
    }
}

since it seems to recognize the common if(DEBUG) pattern, but the ternary operator doesn’t seem to count.

Since I’d rather not fork the class too much just to keep Eclipse happy, I’d prefer putting an @SuppressWarnings at the top instead of changing the code. Unfortunately I can’t find a matching one apart from the brute-force "all". Is there a value just for the dead code detection?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T07:29:03+00:00Added an answer on May 12, 2026 at 7:29 am

    UPDATE: from Adam’s comment:

    In Eclipse 3.6 and newer Eclipse versions @SuppressWarnings("unused") can now be used to suppress ‘dead code’ warnings. See Christopher Stock’s answer.

    See also Eclipse 4.4(Luna) help for @SuppressWarnings.

    Original answer:

    All SuppressWarnings values Eclipse 3.5 “knows” are listed in this page. It seems that there is no value for suppressing only the new dead-code detection. But you can use the @SuppressWarnings("all") just before the domain declaration so it will suppress warnings for only that line not for the whole class:

    private static final boolean ALLOW_DOMAIN_LITERALS = false;
    @SuppressWarnings("all") 
    private static final String domain = ALLOW_DOMAIN_LITERALS ? rfc2822Domain : rfc1035DomainName;
    

    Because dead code check is a new one you can also suggest an enchancement in the Eclipse bug database for supporting the ternary operation as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java, I use a class in which some fields can be null .
I'm trying to use class names to change the color of a link after
Can anyone recommend a ready-to-use class/library compatible with C/C++/MFC/ATL that would parse iCal/vCal/Google calendar
Is it better practice to use class variables, or the session cache in ASP.NET?
Does anybody use the Class Designer much in Visual Studio? I have downloaded the
I have to use a class/assembly made in C# .NET from native C++ application.
I'm trying to use a class within a T4 template in VS2008. Here is
I am trying to use a class from a C# assembly in vb.net. The
I am trying to declare and use a class B inside of a class
When using divs when is it best to use a class vs id ?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.