Bug 22149 - jdk compiles but eclipse does not
Summary: jdk compiles but eclipse does not
Status: VERIFIED DUPLICATE of bug 21116
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.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-04 07:09 EDT by Thomas Schniewind CLA
Modified: 2002-08-21 10:15 EDT (History)
0 users

See Also:


Attachments
Example Project reproducing the bung on Windows NT and 2000 (3.80 KB, application/octet-stream)
2002-08-08 04:11 EDT, Jan Gentsch CLA
no flags Details
Yes it does fail. Have a look at this screenshot. (640.12 KB, image/bmp)
2002-08-09 07:21 EDT, Jan Gentsch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schniewind CLA 2002-08-04 07:09:14 EDT
In the following example Sub.java compiles under jdk 1.3.1_01 (1.3.0 as well)
but not under eclipse (tried out multiple configurations)
Error: The method publicMethod() from the type service.Super.SuperInner is not
visible

// file: service/Super.java
package service;

public class Super
{
    /**
     * This inner class should not be visible outside the package service,
     * except whithin other classes derived from Super, so it is protected.
     */
    protected static class SuperInner
    {
        /**
         * Visible to everyone, who can see SuperInner.
         */
        public void publicMethod()
        {
            
        }
    }
}

// file: client/Sub.java
package client;

import service.Super;

class Sub extends Super
{
    void usesSuperInnerWithinSub(SuperInner superInner)
    {
        // ok: compiles
        superInner.publicMethod();
    }

    /**
     * In this inner class everything should be visible that is visible within Sub.
     */
    private static class SubInner
    {
        /**
         * SuperInner is visible here: no comile error in declaration.
         */
        void usesSuperInnerWithinSubInner(SuperInner superInner)
        {
            // because SuperInner is visible and publicMethod is public within
SuperInner, it should be accessible.
            // but:
            // ok in jdk 1.3.1_01: compiles
            // not ok in eclipse 2.0: "Error: The method publicMethod() from the
type service.Super.SuperInner is not visible"
            superInner.publicMethod();
        }
    }
}
Comment 1 Kent Johnson CLA 2002-08-07 14:58:35 EDT
I was unable to reproduce this problem in 2.0 or 2.0 + latest patches...

Thomas can you please double check the example classes.
Comment 2 Jan Gentsch CLA 2002-08-08 04:11:21 EDT
Created attachment 1813 [details]
Example Project reproducing the bung on Windows NT and 2000
Comment 3 Kent Johnson CLA 2002-08-08 11:28:19 EDT
That is the identical testcase... but it does not fail in R2.0 (at least not 
when I try it).

Does it fail for you?
Comment 4 Jan Gentsch CLA 2002-08-09 07:21:59 EDT
Created attachment 1819 [details]
Yes it does fail. Have a look at this screenshot.
Comment 5 Jan Gentsch CLA 2002-08-09 07:35:52 EDT
Hi Kent,

as I understand Eclipse uses its own (internal) compiler and does not use the 
configured jdk for compilation. Is this correct? If it is Thomas and I are a 
bit stuck trying to figure out possible differeneces between your and our 
configuration.
Can you list the factors which influence compilation?
Comment 6 Kent Johnson CLA 2002-08-09 12:02:00 EDT
Essentially its just the compliance level of the compiler... Window-
>Preferences->Java->Compiler->JDK Compliance.

If Auto-build is enabled, then problems should be added and removed 
immediately. If it is off, then project rebuilds will change the problem list.

I'm using a R2.0 workspace so Auto-build is on and my compliance level is 1.3. 
I've tried changing to 1.4.1 and still couldn't cause the problem.

Just to double check: which build are you running? Have you installed any 
patches?
Comment 7 Jan Gentsch CLA 2002-08-12 01:48:56 EDT
Hi Kent,

I gave it another try.
This time:
* fresh download of R2.0 from the eclipse web page
* version linux-gtk
* started, imported bug project attached to this entry
* I get the Error

We also tried experimenting with the settings before but had no luck.
Comment 8 Philipe Mulet CLA 2002-08-12 07:40:28 EDT
Was able to reproduce problem at first attempt (Kent did you put Sub.java in 
package client?).

Investigating.
Comment 9 Philipe Mulet CLA 2002-08-12 09:12:37 EDT
This is a duplicate of bug 21116. 
Either get a newer 2.0 integration build, or get the latest JDT/Core patch from 
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-
home/patches/org.eclipse.jdt.core_2.0.0.zip).

*** This bug has been marked as a duplicate of 21116 ***
Comment 10 Jan Gentsch CLA 2002-08-13 04:28:17 EDT
Gone with the wind.

Thanks.
Comment 11 Jerome Lanneluc CLA 2002-08-21 10:15:38 EDT
Verified