[ nice-Bugs-907234 ] importing superfluous package cause compile error

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #907234, was opened at 2004-03-01 02:41
Message generated for change (Comment added) made by bonniot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=907234&group_id=12788

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jason Thomas (jthomas)
Assigned to: Nobody/Anonymous (nobody)
Summary: importing superfluous package cause compile error

Initial Comment:
This program compiles fine, but if you uncomment out 
the superfluous import you get the error "Pattern null is 
incompatible with type 
org.eclipse.swt.widgets.Composite"

package test;
//import org.eclipse.jface.dialogs.*(!);
import org.eclipse.jface.wizard.*(!);
import org.eclipse.swt.widgets.*(!);

public class TestWizard extends WizardPage {
    createControl(null) {
    }

    createControl(Composite parent) {
    }
}    


Note: swt.jar and jface.jar needed to compile.


----------------------------------------------------------------------

>Comment By: Daniel Bonniot (bonniot)
Date: 2004-03-02 12:07

Message:
Logged In: YES 
user_id=88952

I see what's surprising. On the other hand, it does not make
sense to say that a method does not accept null, if it
overrides a method that does.

Normally you know where a method is declared, because
javadoc has those 'overrides' links to the original method.
So knowing where a method is declared should not be an issue.

Is this a major issue for you? Can you suggest a different
behaviour?


----------------------------------------------------------------------

Comment By: Jason Thomas (jthomas)
Date: 2004-03-02 01:14

Message:
Logged In: YES 
user_id=143037

You shouldn't need to be concious of what package an 
overridden method is declared.  You may not even know 
where it's declared if it's a 3rd party library.  

----------------------------------------------------------------------

Comment By: Daniel Bonniot (bonniot)
Date: 2004-03-01 11:27

Message:
Logged In: YES 
user_id=88952

This seems normal behaviour to me. The method
'createControl' is declared in package
'org.eclipse.jface.dialogs'. If you don't specify '(!)' for
that package, it is interpreted as having a parameter of
type ?Composite, in which case you can (and must) handle the
case where the parameter is null. On the other hand, if you
remove the commented line, then you assert in particular
that the argument of this method cannot be null. In this
case, the compiler rightfully complains that "Pattern null
is incompatible with type org.eclipse.swt.widgets.Composite".

Is there a problem with this behaviour?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=907234&group_id=12788


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.