Is the following legal?

From: bluke (martybluke_at_hotmail.com)
Date: 05/17/04


Date: 17 May 2004 10:10:54 -0700

I have the following:
package test1;

class Test {
  public final Color RED = new Color("red");

  protected static final class Color {
    private String id;
    private Color (String id) {
        this.id = id;
    }
    public String toString() {
        return id;
    }
  }
}

package test1;
 public class Test1 extends Test {
  }

package test2;
 public class Test2 extends Test1 {
   someMethod(RED);
}

I am getting an IllegalAccessError with this because Class Test is
package protected and Test2 is in a different package, so when Test2
tries to access RED I get an IllegalAccessError that tried to access
class test1.Test from class test2.Test2. The interesting thing about
this is that it compiles. This means that there is either a VM bug or
a compiler bug, because if it compiles I should not get an
IllegalAccessError. Is this actually legal?



Relevant Pages

  • Multiple Log Providers
    ... Logs the output from the package to custom tables. ... Dim strPathPkg As String ... Dim pkgChild As New Package ... ByVal sourceName As String, ByVal sourceID As String, ByVal ...
    (microsoft.public.sqlserver.dts)
  • Re: (?{..}) and lexical scoping issues.
    ... > @_ is most definitely a package variable. ... > (You are counting how many substrings of each string are also substrings ... > all substrings of a string. ... it will be hard to beat with a Perl program. ...
    (comp.lang.perl.misc)
  • COM problem calling DTS from vb.net
    ... Select or create a DTS package for use in this test, ... Overridable Overloads Sub OnError(ByVal EventSource As String, ... Overridable Overloads Sub OnFinish_ ...
    (microsoft.public.sqlserver.dts)
  • A simple metaobject protocol for packages
    ... Under this proposal, for each package there is a corresponding class that represents this package. ... A function search-symbol is introduced that behaves similar to find-symbol, except that the string that it is passed is understood to be unmodified, as read for example from source code. ... A corresponding protocol for intern-symbol and intern-symbol-using-class is probably also needed. ...
    (comp.lang.lisp)
  • Re: False string truncation error
    ... String or binary data would be truncated. ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... Microsoft Data Transformation Services> Package ...
    (microsoft.public.sqlserver.dts)