Bug 22453 - Compiler Problem
Summary: Compiler Problem
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows All
: P3 major (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-14 17:02 EDT by Krishan Agarwal CLA
Modified: 2002-09-10 08:50 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 Krishan Agarwal CLA 2002-08-14 17:02:43 EDT
Yeah it's same kind of problem, but when I move this method foo() (in
scenario
you created and our actual code), from Outer class to Abstract Inner 
class,
it
works fine (but all occurance in outer class loose visibility to this
method).
OR if I change name to foo2()(or somehthing other then foo() it works 
fine.

When I consult JAVA language specification it says "ALL INNER CLASSES 
HAVE
UNLIMITED ACCESS TO MEMBERS OF OUTER CLASS".

One more thing this code works fine in VISUAL AGE for JAVA 3.5.4 and 
give
no
error and this code is also running in production with NO defact. that 
make
me
more surprised.


I've refined your scenerio.

public class Foo {

    public void foo() {
      System.out.println("Inside foo in outer class");
    }

    public abstract class AInnerFoo {
       public void foo(String s);
    }

    public class CInnerFoo extends AInnerFoo {
      public void foo(String v){
         System.out.println("Inside CInner"+s);
      }
      public void main() {
       foo();
       foo("===STRING"===);
      }
    }

    public class BInnerFoo extends AInnerFoo{
      public void foo(String s){
         System.out.println("Inside BInner"+s);
      }

      public void abc(){
        foo();
      }
    }
}

in this code if I move foo() from outer class to AInner class. it works
fine.
OR even if I change foo() to foo4() it works fine.
Or if I import this code in to VAJ and run it it works fine. if I run 
JAVAC
it
works fine. but when I bring this code in WSAD 4.0.3 with all
fixpacks/E-fix
installed it do not compile it.
I tried to figure out what are the compiler changes in WSAD over VAJ.
couldn't
find any article or hint. even NO red book address this issue. I 
thought if
code can be compiled in VAJ it should have no problems in WSAD atleast 
in
compilation.

You guyz are architects in IBM, have indepth product knowledge. and
probably
you have wrote some part of WSAD. so I just thought you can help me or 
just
give me little Hint.

Waiting for your comments.

Thanks a lot
Krishan
Comment 1 Philipe Mulet CLA 2002-08-16 08:36:30 EDT
I found a couple typos in your test case. With the one below, no javac 
implementation (since 1.1.7b) did accept it. Eclipse 2.0 compiler does reject 
it either in 1.3 or 1.4 compliant mode. I don't see a problem.

VAJ was wrong in finding the first applicable method, where it should only have 
found the first accessible one, and then checked for applicability (there are 
some nuances around this).


Closing 


-----------------
public class Foo {

	public void foo() {
		System.out.println("Inside foo in outer class");
	}

	public abstract class AInnerFoo {
		public abstract void foo(String s);
	}

	public class CInnerFoo extends AInnerFoo {
		public void foo(String v) {
			System.out.println("Inside CInner" + v);
		}
		public void main() {
			foo();
			foo("===STRING===");
		}
	}

	public class BInnerFoo extends AInnerFoo {
		public void foo(String s) {
			System.out.println("Inside BInner" + s);
		}

		public void abc() {
			foo();
		}
	}
}