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

  • Home
  • SEARCH
  • 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 8153149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:55:17+00:00 2026-06-06T15:55:17+00:00

I just started using the new Eclipse 4.2 (Juno) Null Analysis. On code like

  • 0

I just started using the new Eclipse 4.2 (Juno) Null Analysis.

On code like this:

x = foo();
if (x == null)
    fail("x is null");
return x.bar();

I’m getting warnings that x may be null. But it can’t be, because fail always throws and therefore never returns. (With better inter-procedural analysis it could presumably determine this automatically, but it currently doesn’t seem to.)

Obviously, there are ways to rewrite the code to get around the warning, but what I’d like is a way to indicate (e.g. an annotation) that fail never returns.

I also tried to suppress the warning with @SuppressWarnings(“null”) but that didn’t work.

One way to get rid of the warning is to add: assert x != null; (assuming you have turned on the setting to include asserts in null analysis)

In GCC C++ I can do: void fn __attribute__ ((noreturn))

  • 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-06-06T15:55:18+00:00Added an answer on June 6, 2026 at 3:55 pm

    One semi-traditional way to do this is as follows:

    public RuntimeException fail(String message) {
      throw new RuntimeException(message);
    }
    

    so you can write throw fail("x is null"). Of course, fail will always end up doing the throwing, not the throw, but it’s enough to reassure the compiler that that line will always throw.

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

Sidebar

Related Questions

I have just started using Eclipse and Mylyn together, so I'm quite new to
I'm new to JSP, using Eclipse, and am trying to just get started with
I just started using the new POI 3.6 http://poi.apache.org XSSF which was released in
I'm pretty new to APEX ( well, just started using it ~an hour ago),
So I'm very new to JSF, I just started using it a few days
I just started developing my brand new windows 8 application last week using mvvm
I've started using Coda because I just got a new Mac, and I want
I have just started a new project, and I am using the Delphi 2009
I just started using Eclipse but already I have a small problem. At first
I just started using the new project type SQL Server 2008 Database. I can

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.