You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Claude Warren <cl...@xenei.com> on 2015/05/09 18:07:08 UTC
Assembler Class loading
Has the assembler class loading strategy changed? I have two tests that
were working but now fail because the object of the ja:loadClass is loaded
before a call to a.open( root ).
Claude
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: Assembler Class loading
Posted by Claude Warren <cl...@xenei.com>.
Found the issue. It was getting loaded by another test as well.
On Sat, May 9, 2015 at 8:10 PM, Claude Warren <cl...@xenei.com> wrote:
> Method in question is:
>
> public class TestAssemblerGroup extends AssemblerTestBase
> {
>
> public void testLoadsClasses()
> {
> AssemblerGroup a = AssemblerGroup.create();
> a.implementWith( resource( "T" ), new MockAssembler() );
> Resource root = resourceInModel( "x rdf:type T; _c ja:loadClass '"
> + TestAssemblerGroup.class.getName() + "$Trivial'" );
> assertFalse( "something has pre-loaded Trivial, so we can't test
> if it gets loaded", loaded );
> assertEquals( "mockmockmock", a.open( root ) );
> assertTrue( "the assembler group did not obey the ja:loadClass
> directive", loaded );
> }
>
> public static boolean loaded = false;
>
> public static class Trivial
> {
> static { loaded = true; }
> }
>
> [ code removed for brevity ]
>
> }
>
> The error is that
> assertFalse( "something has pre-loaded Trivial, so we can't test if it
> gets loaded", loaded );
> is triggered.
>
> This used to work -- perhaps a difference in how java 8 loads classes. It
> might make sense to move the "Trivial" class to a different file.
>
> Claude
>
> On Sat, May 9, 2015 at 6:52 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> On 09/05/15 17:07, Claude Warren wrote:
>>
>>> Has the assembler class loading strategy changed? I have two tests that
>>> were working but now fail because the object of the ja:loadClass is
>>> loaded
>>> before a call to a.open( root ).
>>>
>>> Claude
>>>
>>>
>> Details?
>>
>> ja:loadClass is affected by class renames. Could that be it?
>>
>> Helper migration code is not (yet) in place.
>>
>> Andy
>>
>>
>
>
> --
> I like: Like Like - The likeliest place on the web
> <http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: Assembler Class loading
Posted by Claude Warren <cl...@xenei.com>.
Method in question is:
public class TestAssemblerGroup extends AssemblerTestBase
{
public void testLoadsClasses()
{
AssemblerGroup a = AssemblerGroup.create();
a.implementWith( resource( "T" ), new MockAssembler() );
Resource root = resourceInModel( "x rdf:type T; _c ja:loadClass '"
+ TestAssemblerGroup.class.getName() + "$Trivial'" );
assertFalse( "something has pre-loaded Trivial, so we can't test if
it gets loaded", loaded );
assertEquals( "mockmockmock", a.open( root ) );
assertTrue( "the assembler group did not obey the ja:loadClass
directive", loaded );
}
public static boolean loaded = false;
public static class Trivial
{
static { loaded = true; }
}
[ code removed for brevity ]
}
The error is that
assertFalse( "something has pre-loaded Trivial, so we can't test if it gets
loaded", loaded );
is triggered.
This used to work -- perhaps a difference in how java 8 loads classes. It
might make sense to move the "Trivial" class to a different file.
Claude
On Sat, May 9, 2015 at 6:52 PM, Andy Seaborne <an...@apache.org> wrote:
> On 09/05/15 17:07, Claude Warren wrote:
>
>> Has the assembler class loading strategy changed? I have two tests that
>> were working but now fail because the object of the ja:loadClass is loaded
>> before a call to a.open( root ).
>>
>> Claude
>>
>>
> Details?
>
> ja:loadClass is affected by class renames. Could that be it?
>
> Helper migration code is not (yet) in place.
>
> Andy
>
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: Assembler Class loading
Posted by Andy Seaborne <an...@apache.org>.
On 09/05/15 17:07, Claude Warren wrote:
> Has the assembler class loading strategy changed? I have two tests that
> were working but now fail because the object of the ja:loadClass is loaded
> before a call to a.open( root ).
>
> Claude
>
Details?
ja:loadClass is affected by class renames. Could that be it?
Helper migration code is not (yet) in place.
Andy