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 they should be.
Date Thu, 25 May 2017 04:23:04 GMT

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

Niclas Hedhman commented on POLYGENE-249:
-----------------------------------------

Ok, to make matters more complicated; Earlier it was only possible to get a Runtime started
via the Energy4Java class, but now that can be handled by ApplicationBuilder & Co. That
means that the creation of the classloader needs to be moved to custom code, and we are suddenly
in dangerous territory (since people could do all kinds of bad mistakes). Maybe that could
be solved by a clever use of lambdas. Let's rename the FragmentClassLoader and we could have
something like;

{code:java}
    PolygeneClassLoader.load( () -> {
        // regular application startup.
    });
{code}

But how is that going to work for unit tests? Still doesn't solve that problem.

> private and package protected types are not accessible when they 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.0
>
>
> 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
(v6.3.15#6346)

Mime
View raw message