polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niclas Hedhman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POLYGENE-249) private and package protected types are not accessible when the should be.
Date Sat, 13 May 2017 10:09:04 GMT

    [ https://issues.apache.org/jira/browse/POLYGENE-249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16009246#comment-16009246

Niclas Hedhman commented on POLYGENE-249:

So, I think that this mean that all classes must be defined by the FragmentClassLoader and
not delegate. 

But shouldn't that be the case already? No... FragmentClassLoader is only instantiated upon
reaching org.apache.polygene.runtime.bootstrap.AssemblyHelper#instantiationClass, where the
fragment type has already been loaded into memory, and the FragmentClassLoader will only be
used for defining the _Stub classes.

I would say that this is a bug and we should redesign this, so that a FragmentClassLoader
is instantiated and used by each Polygene Runtime instance.

I also conclude that this change can be done pretty much without breaking compatibility and
we should simply push this to 3.1 or 3.2. Might consider plugin support in the same breath
of that.

> private and package protected types are not accessible when the should be.
> --------------------------------------------------------------------------
>                 Key: POLYGENE-249
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-249
>             Project: Polygene
>          Issue Type: Bug
>            Reporter: Niclas Hedhman
>             Fix For: 3.1
> The FragmentClassLoader creates new subclasses (_Stub) in the same package as its superclass.
Yet, the classloading of a 
> {code:java}
>     package org.apache.polygene.abc;
>     class Abc
>         implements SomeType
>     {}
> {code}
> will insist that the Abc.class is public or protected and that the SomeType.class is
public. Otherwise an IllegalAccessException is thrown.
> {code}
> java.lang.IllegalAccessError: class org.apache.polygene.abc.Abc_Stub cannot access its
superclass org.apache.polygene.abc.Abc
> {code}
> and
> {code}
> java.lang.IllegalAccessError: tried to access class org.apache.polygene.abc.SomeType
from class org.apache.polygene.abc.Abc_Stub
> {code}
> This is probably because the FragmentClassLoader is doing something wrong regarding packages.
Maybe it is not enough to give the right name to the class, but also have to put in some type
of package reference.
> The work-around is more 'public' and 'protected' fragment types, but that is not ideal.

This message was sent by Atlassian JIRA

View raw message