[ 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-02-29 20:41
Message generated for change (Comment added) made by jthomas
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: Jason Thomas (jthomas)
Date: 2004-03-01 19: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 05: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