RE: [Java Spec Report] reference to nonstatic type from static context
"Roly Perera" <[email protected]> Sun, 4 Apr 2004 08:59:56 +0100
| Newsgroups | gmane.comp.java.spec-report |
|---|---|
| Organization | Ergnosis Ltd |
| Message-ID | <[email protected]> |
At first glance that sounds like a mistake in the JLS. The constraint should only apply to uses of non-static methods and fields. The rationale I think is that to *name* an inner class one does not need an instance of its enclosing class, although to *construct* one, one does. > -----Original Message----- > From: Neal Gafter [mailto:[email protected]] > Sent: 04 April 2004 08:51 > To: [email protected] > Subject: [Java Spec Report] reference to nonstatic type from > static context > > > I know of no compilers that properly implement this JLS rule: > > // JLS 8.5.2, 2nd paragraph: It is a compile-time error if a static > // class contains a usage of a non-static member of an enclosing > // class. > class A { > class B {} > static class C { > B b; // error > } > } --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.590 / Virus Database: 373 - Release Date: 16/02/2004 ------------------------ Yahoo! Groups Sponsor ---------------------~--> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511 http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/5cFolB/TM ---------------------------------------------------------------------~-> To unsubscribe from this mailing list, send an email to: [email protected] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/java-spec-report/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/