Bug 41278 - compiles with incorrect visibility
Summary: compiles with incorrect visibility
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-07 12:42 EDT by Blake Williams CLA
Modified: 2003-08-14 13:00 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 Blake Williams CLA 2003-08-07 12:42:55 EDT
pkg1.Abstract has a protected method callme()
pkg2.Concrete extends pkg1.Abstract, and overrides protected callme()
pkg1.Caller tries to call aConcrete = new Concrete(); aConcrete.callme()

This isn't allowed by either jikes or javac, but compiles and runs in eclipse. A
protected method in pkg2 shouldn't be seen by an object in pkg1.
Comment 1 Kent Johnson CLA 2003-08-11 11:19:52 EDT
Which drop on you running? Did you change any of the default compiler settings? 
If so, which ones?
Comment 2 Blake Williams CLA 2003-08-11 11:43:14 EDT
Using eclipse 2.1.1 with compiler compliance 1.3 and jdk1.4.1_02 jars.
Everything else is default.
Comment 3 Kent Johnson CLA 2003-08-12 13:08:19 EDT
Did I misunderstand your test?

I tried the following & javac compiled it without error:

package p1;
public class A { protected void foo() {} }

package p2;
public class B extends p1.A { protected void foo() {} }

package p1;
public class C {
	void test (p2.B b) { b.foo(); } 
}
Comment 4 Blake Williams CLA 2003-08-12 16:01:23 EDT
I can't get this to compile with either with javac 1.4.1_02 or jikes 1.18 from
the command line. I copied and pasted your code into new java files in
appropriate packages to test the build. 

This shouldn't work as C doesn't have view of B's protected methods.
Comment 5 Kent Johnson CLA 2003-08-12 16:13:54 EDT
But you said you were running with compliance level 1.3.

This was changed between javac 1.3 & 1.4 so you need to switch the Compiler 
compliance level in Eclipse to 1.4 to test apples to apples.