Bug 84551 - [1.5][compiler] compiler must not allow implicit static reference to outer type
Summary: [1.5][compiler] compiler must not allow implicit static reference to outer type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-07 06:05 EST by Markus Keller CLA
Modified: 2005-05-11 13:48 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-02-07 06:05:40 EST
I20050202-0800

The compiler must not allow an implicit static reference to an outer type. 

class Outer<O> {
	class Inner { }
	
	static void test(Inner i) { }
	//javac:         ^           non-static class p.Outer.Inner cannot be
	//                           referenced from a static context
}
Comment 1 Kent Johnson CLA 2005-02-07 13:32:06 EST
This compiles fine:

class Outer {
	class Inner { }
	static void test(Inner i) { }
}

but once the reference involves a generic type it does not.
Comment 2 Kent Johnson CLA 2005-02-07 13:35:11 EST
This also compiles fine:

class Outer {
	class Inner<T> { }
	static void test(Inner i) { }
}

as does:

class X<T> {
	static class Outer {
		class Inner { }
		static void test(Inner i) { }
	}
}
Comment 3 Philipe Mulet CLA 2005-04-19 07:26:59 EDT
Added GenericTypeTest#test620-623.
Added static check during name resolution for member types.
Fixed (will be released along with changes for bug 84496)
Comment 4 Philipe Mulet CLA 2005-04-21 09:12:28 EDT
Released
Comment 5 Olivier Thomann CLA 2005-05-11 13:48:38 EDT
Verified in I20050510-0010.
Opened bug 94747 to fix the unoptimal error message.