Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 11 Apr 2012 11:35:05 -0500 Date: Wed, 11 Apr 2012 09:34:58 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] References: <8d7bedc4-30a8-4dc4-97b6-9ddaafc2e16a@l4g2000vbt.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <77CdnRMKBtckLxjSnZ2dnUVZ_tGdnZ2d@earthlink.com> Lines: 31 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.201.141 X-Trace: sv3-3IPEt7ib1OJEP2hu24P/8+vS98q5GIfeBmvPSlpdhfcb+fJmBYEj/PQyhuH4Xz734uPoAUrzCBRU0CD!BaL0k9x5SGu0qKjHZXnUQud+E1CDkHpbpn2iRjJFWeANOsxfyppumd1/AE3oq4ItWACtoAgQI7re!UkQcK+n5l44PFBgc0sftmdolIznrKfULAudlr0QPU5BVwK8= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2303 Xref: csiph.com comp.lang.java.programmer:13484 On 4/11/2012 8:24 AM, markspace wrote: > On 4/11/2012 4:56 AM, Maciej Labanowicz wrote: > >> Frame.java:2: error: foo.bar.Frame is already defined in this >> compilation unit > > > I *think* what the compiler is saying using Frame as an unqualified name > collides with the existing foo.bar.Frame usage. > > The solution is just to not use the "import" statement. > > package quicktest; > > class Frame extends java.awt.Frame { > public static final long serialVersionUID = 1L; > public static void main(String [] args) { > System.out.println("HELLO: args = " + args); > } > } > > If your compiler can find "import java.awt.Frame", then it can find > java.awt.Frame without the import. You don't need import, it just allows > you to shorten the FQN to just the class name. I think a better solution would be to rename foo.bar.Frame. If it did not have some functional difference from java.awt.Frame, it would not exist. Presumably, it is Frame specialized in some way, and its name should indicate that specialization. Patricia