Adding method to explicitly check for non-nullness with JDK 1.3, 1.4

View: New views
3 Messages — Rating Filter:   Alert me  

Adding method to explicitly check for non-nullness with JDK 1.3, 1.4

by gboysko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello:

Is there a way to use Find Bugs with a code base compiled for 1.3/1.4 (that is,
no annotations) to specify a set of methods whose return values must be checked
for non-nullness?

I see that you can specify @NonNull annotations for these methods, but is there
any way to specify a set of methods through any other means?

Thanks,
Glenn

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Findbugs-discuss mailing list
Findbugs-discuss@...
http://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss

Re: Adding method to explicitly check for non-nullness with JDK 1.3, 1.4

by Brian Cole-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jan 24, 2006, at 6:20 PM, Glenn Boysko wrote:

>
> Is there a way to use Find Bugs with a code base compiled for  
> 1.3/1.4 (that is,
> no annotations) to specify a set of methods whose return values  
> must be checked
> for non-nullness?
>
> I see that you can specify @NonNull annotations for these methods,  
> but is there
> any way to specify a set of methods through any other means?

short answer: No.

longer answer: FindBugs itself uses annotations but is "compiled for"  
1.4 via
     javac -source 1.5 -target jsr14
This approach may or may not meet your needs. It certainly won't if  
you need
your source to be compatible with 1.3/1.4.

longest answer: Well, what method do you propose for doing this? If  
it's reasonable
we will at least consider supporting it, though I would think it  
wouldn't be likely if 1.5
maintains a decent adoption rate.
One thing you can do is write your own detector that checks the  
methods you want
it to check for. Or one thing the FindBugs project could possibly  
consider is making
an extensible detector that could easily be configured to search for  
additional methods
but, again, I can't say such a thing would be likely any time soon.

-brian

_______________________________________________
Findbugs-discuss mailing list
Findbugs-discuss@...
http://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss

Re: Adding method to explicitly check for non-nullness with JDK 1.3, 1.4

by gboysko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Brian:

Thanks for your response.

> longer answer: FindBugs itself uses annotations but is "compiled for"  
> 1.4 via
>      javac -source 1.5 -target jsr14
> This approach may or may not meet your needs. It certainly won't if  
> you need
> your source to be compatible with 1.3/1.4.

We are debating this now--whether we can drop support for 1.3.  
 
> longest answer: Well, what method do you propose for doing this?

These would be a select number of methods in our code base (perhaps 5-10) that
we want to ensure are checked for non-nullness.

I was hoping that we could specify a properties file or command line argument
that contained the method name, signature, return type and use that define what
methods we want analyzed.

Thanks for verifying that this is not currently possible in a 1.3 code base
using Find Bugs.  We can consider dropping 1.3 and compiling our code to jsr14.
 Alternatively, we can subclass one of your detectors to load the list of
target methods through a means other than annotation.

Thanks,
Glenn

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Findbugs-discuss mailing list
Findbugs-discuss@...
http://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss
LightInTheBox - Buy quality products at wholesale price!