Bug 6456 - Invalid error when compiling access to protected member inside innerclass
Summary: Invalid error when compiling access to protected member inside innerclass
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-30 07:42 EST by Philipe Mulet CLA
Modified: 2002-01-11 09:22 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2001-11-30 07:42:19 EST
From post in eclipse.tools
===================================
The internal java compiler has some serious bugs which
prevent me from compiling programs which compile just fine when using the
java compiler. (One annoying one is if I have an inner class within my
class and the inner class tries to access the protected methods of the
outer class's parents, i get exceptions thrown)
Comment 1 Philipe Mulet CLA 2001-11-30 07:44:18 EST
I tried to send a trimmed out version of my package as a zip but the group
does not allow any attachments. So what I am doing now is attaching all the
source files as plain text demarcated with lines.

Can somebody create appropriate directory structure for the files and see
the problem ? It happens in EmailDialog.java. I see a small red "x" in front
of it with the message "the method showInfoPopup in EmailDialog is not
visible"

I think the class is compiled, but the byte codes might not be correct
because of this problem.

Thanks,
Jalpesh.

===================
/*
* EmailTest.java
*
* Created on January 3, 2001, 1:41 PM
*/

package com.bea.commerce.tools.rules;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.net.URLEncoder;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
*
* @author jalpesh
*/
public class EmailDialog extends AbstractClauseEditor
{
ActionListener previewButtonListener = null;

** Creates new form EmailTest */
public EmailDialog(Dialog aParent)
{
super(aParent);
}

class PreviewButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent ae)
{
Component c = (Component)ae.getSource();
EmailDialog.this.showInfoPopup("INFO_ValidURI","INFO_ValidURI_message");
}
}
}

====================
package com.bea.commerce.tools.rules;
import java.awt.*;
import javax.swing.*;
import com.bea.commerce.tools.AbstractEditorDialog;
abstract public class AbstractClauseEditor extends AbstractEditorDialog
{
public AbstractClauseEditor(Frame anOwner)
{
super();
}
public AbstractClauseEditor(Dialog anOwner)
{
super();
}
}

====================
package com.bea.commerce.tools;
import java.awt.*;
import java.awt.event.ComponentListener;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;
import java.awt.event.MouseAdapter;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import java.awt.Cursor;
abstract public class AbstractEditorDialog extends JDialog
{
protected void showInfoPopup(String aTitle, String aMessage)
{
JOptionPane.showMessageDialog(this, aMessage, aTitle,
JOptionPane.INFORMATION_MESSAGE);
}
}
====================





Comment 2 Philipe Mulet CLA 2001-11-30 08:56:46 EST
Our compiler rejects the code, it only allows the protected access if the 
invocation is implicit. If removing the qualifier, then it compiles fine:

/*EmailDialog.this.*/showInfoPopup("INFO_ValidURI", "INFO_ValidURI_message");

This is still a bug though.
Comment 3 Philipe Mulet CLA 2001-11-30 10:33:55 EST
Problem identified. We authorized such qualified super calls but not qualified 
this calls (also needed to tune the visibility check).
Comment 4 Philipe Mulet CLA 2001-11-30 13:54:58 EST
Actually, even "new EmailDialog().showInfoPopup" should be authorized.
Adding test cases to suites.
Comment 5 Philipe Mulet CLA 2001-11-30 19:41:53 EST
Fixed for both method and field access.