<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Don&#8217;t import wildcards from non-standard Java packages</title>
	<atom:link href="http://thunderguy.com/semicolon/2004/07/22/dont-import-wildcards-from-non-standard-java-packages/feed/" rel="self" type="application/rss+xml" />
	<link>http://thunderguy.com/semicolon/2004/07/22/dont-import-wildcards-from-non-standard-java-packages/</link>
	<description>Software, the Internet and you.</description>
	<lastBuildDate>Sat, 19 May 2012 09:06:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Amanda</title>
		<link>http://thunderguy.com/semicolon/2004/07/22/dont-import-wildcards-from-non-standard-java-packages/comment-page-1/#comment-109440</link>
		<dc:creator>Amanda</dc:creator>
		<pubDate>Fri, 09 Jul 2010 15:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050421/21/#comment-109440</guid>
		<description>Thank you. I looked EVRYWHERE to find out why my wildcard wasn&#039;t working.</description>
		<content:encoded><![CDATA[<p>Thank you. I looked EVRYWHERE to find out why my wildcard wasn&#8217;t working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary Nair</title>
		<link>http://thunderguy.com/semicolon/2004/07/22/dont-import-wildcards-from-non-standard-java-packages/comment-page-1/#comment-74677</link>
		<dc:creator>Gary Nair</dc:creator>
		<pubDate>Thu, 24 Jul 2008 17:43:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.thunderguy.com/plusplus/20050421/21/#comment-74677</guid>
		<description>It appears as if, an explicit import without the wildcard is now REQUIRED for user defined classes(not using JAR files here). Why ? who knows ? Maybe SUN changed stuff in jdk 6.X

So here:
Even if there is no ambiguity and you reference WidgetId, as a wildcard

import com.zikzak.db.*;
   ...code...
//javac: won&#039;t find the package //com.zikzak.db even if correctly written in //the javac -classpath methodology
WidgetId = new WidgetId();//FAILS

this will not compile(used javac -classpath properly). 
I am able to use 2 workarounds(still not using JAR methodology):

1) You must restate the import as 
import com.zikzak.db.WidgetId;
WidgetId = new WidgetId();//works

OR explicitly in the instantiation declaration, as:

2. //doesn&#039;t make a difference now, if you //import it or not
com.zikzak.db.WidgetId = 
 new com.zikzak.db.WidgetId();

I am compiling using the java compiler javac -classpath switch and it rejects any wildcard references to properly packaged up user defined class files, unless I did one of the above workarounds. The fact that these code workarounds actually work, is sufficient to let you know, there&#039;s nothing wrong with my syntax of using the javac -classpath switch as they work, the moment I explicitly put the imports in the source code. Unfortunately, that also means you can&#039;t use wild cards, on several classes belonging to your user defined package.</description>
		<content:encoded><![CDATA[<p>It appears as if, an explicit import without the wildcard is now REQUIRED for user defined classes(not using JAR files here). Why ? who knows ? Maybe SUN changed stuff in jdk 6.X</p>
<p>So here:<br />
Even if there is no ambiguity and you reference WidgetId, as a wildcard</p>
<p>import com.zikzak.db.*;<br />
   &#8230;code&#8230;<br />
//javac: won&#8217;t find the package //com.zikzak.db even if correctly written in //the javac -classpath methodology<br />
WidgetId = new WidgetId();//FAILS</p>
<p>this will not compile(used javac -classpath properly).<br />
I am able to use 2 workarounds(still not using JAR methodology):</p>
<p>1) You must restate the import as<br />
import com.zikzak.db.WidgetId;<br />
WidgetId = new WidgetId();//works</p>
<p>OR explicitly in the instantiation declaration, as:</p>
<p>2. //doesn&#8217;t make a difference now, if you //import it or not<br />
com.zikzak.db.WidgetId =<br />
 new com.zikzak.db.WidgetId();</p>
<p>I am compiling using the java compiler javac -classpath switch and it rejects any wildcard references to properly packaged up user defined class files, unless I did one of the above workarounds. The fact that these code workarounds actually work, is sufficient to let you know, there&#8217;s nothing wrong with my syntax of using the javac -classpath switch as they work, the moment I explicitly put the imports in the source code. Unfortunately, that also means you can&#8217;t use wild cards, on several classes belonging to your user defined package.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

