debugging java implementation of Fame ...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

debugging java implementation of Fame ...

anquetil.nicolas
Hi all,

I need some help with the Java implementation of Fame.

I am trying to implement separate parsing in VerveineJ so that one can
deal with larger project by parsing them piece by piece.
This implies loading in verveine the MSE already created to be able to
add new entities to it.

And The import method of Repository does not work for big MSE files
(that were generated by the export method of Repository BTW) :-(

It crashes with a StackOverflow:
Exception in thread "main" java.lang.StackOverflowError
        at java.util.HashMap.put(HashMap.java:389)
        at java.util.HashMap.putAll(HashMap.java:541)
        at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:192)
        at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
        at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
        at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
        at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
        at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
        at ch.akuhn.fame.fm3.MetaDescription.allAttributes(MetaDescription.java:139)
        at ch.akuhn.fame.Repository.add(Repository.java:121)
        at ch.akuhn.fame.Repository.add(Repository.java:131)
        at ch.akuhn.fame.Repository.add(Repository.java:131)
+ zillions of this same line, Repository.add calling itself
recursively at line 131

I looked a bit into it and think that the problem may come from line
131 into the Repository.add() method :-)


    public void add(Object element) {
        assert element != null;
        if (elements.add(element)) {
            MetaDescription meta = metamodel.getDescription(element.getClass());
            assert meta != null : element.getClass();
            for (PropertyDescription property : meta.allAttributes())
{   <--- line 121
                if (!property.isPrimitive()) {
                    boolean isRoot = property.getType().isRoot();
                    for (Object value : property.readAll(element)) {
                        assert value != null : property.getFullname();
                        if (!(isRoot &&
                                (value instanceof String ||
                                value instanceof Boolean ||
                                value instanceof Number))) {
                            try {
                                this.add(value);
                              <--- line 131
                            } catch (ClassNotMetadescribedException e) {
                                throw new
ElementInPropertyNotMetadescribed(property);
                            }
                        }
                    }
                }
            }
        }
    }


My suspicion is that this recursive call is actually walking through
the entire graph of FamixEntities because every entity is related to
some other entity ...

1- Anybody want to comment on this suspicion?
2- Any idea how to correct it?


nicolas

--
Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: debugging java implementation of Fame ...

Stéphane Ducasse
nicolas

Do you use the FAME version of adrian in Java or you recoded your own?

Stef

On Dec 13, 2010, at 10:53 PM, [hidden email] wrote:

> Hi all,
>
> I need some help with the Java implementation of Fame.
>
> I am trying to implement separate parsing in VerveineJ so that one can
> deal with larger project by parsing them piece by piece.
> This implies loading in verveine the MSE already created to be able to
> add new entities to it.
>
> And The import method of Repository does not work for big MSE files
> (that were generated by the export method of Repository BTW) :-(
>
> It crashes with a StackOverflow:
> Exception in thread "main" java.lang.StackOverflowError
> at java.util.HashMap.put(HashMap.java:389)
> at java.util.HashMap.putAll(HashMap.java:541)
> at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:192)
> at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
> at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
> at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
> at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
> at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
> at ch.akuhn.fame.fm3.MetaDescription.allAttributes(MetaDescription.java:139)
> at ch.akuhn.fame.Repository.add(Repository.java:121)
> at ch.akuhn.fame.Repository.add(Repository.java:131)
> at ch.akuhn.fame.Repository.add(Repository.java:131)
> + zillions of this same line, Repository.add calling itself
> recursively at line 131
>
> I looked a bit into it and think that the problem may come from line
> 131 into the Repository.add() method :-)
>
>
>    public void add(Object element) {
>        assert element != null;
>        if (elements.add(element)) {
>            MetaDescription meta = metamodel.getDescription(element.getClass());
>            assert meta != null : element.getClass();
>            for (PropertyDescription property : meta.allAttributes())
> {   <--- line 121
>                if (!property.isPrimitive()) {
>                    boolean isRoot = property.getType().isRoot();
>                    for (Object value : property.readAll(element)) {
>                        assert value != null : property.getFullname();
>                        if (!(isRoot &&
>                                (value instanceof String ||
>                                value instanceof Boolean ||
>                                value instanceof Number))) {
>                            try {
>                                this.add(value);
>                              <--- line 131
>                            } catch (ClassNotMetadescribedException e) {
>                                throw new
> ElementInPropertyNotMetadescribed(property);
>                            }
>                        }
>                    }
>                }
>            }
>        }
>    }
>
>
> My suspicion is that this recursive call is actually walking through
> the entire graph of FamixEntities because every entity is related to
> some other entity ...
>
> 1- Anybody want to comment on this suspicion?
> 2- Any idea how to correct it?
>
>
> nicolas
>
> --
> Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: debugging java implementation of Fame ...

anquetil.nicolas
I am lazy, whatever I can reuse I do.

So yes it is Adrian's version, although I don't remember where or how I got it.
Somebody (Simon?) must have given it to me.

nicolas

On Tue, Dec 14, 2010 at 11:54 AM, Stéphane Ducasse
<[hidden email]> wrote:

> nicolas
>
> Do you use the FAME version of adrian in Java or you recoded your own?
>
> Stef
>
> On Dec 13, 2010, at 10:53 PM, [hidden email] wrote:
>
>> Hi all,
>>
>> I need some help with the Java implementation of Fame.
>>
>> I am trying to implement separate parsing in VerveineJ so that one can
>> deal with larger project by parsing them piece by piece.
>> This implies loading in verveine the MSE already created to be able to
>> add new entities to it.
>>
>> And The import method of Repository does not work for big MSE files
>> (that were generated by the export method of Repository BTW) :-(
>>
>> It crashes with a StackOverflow:
>> Exception in thread "main" java.lang.StackOverflowError
>>       at java.util.HashMap.put(HashMap.java:389)
>>       at java.util.HashMap.putAll(HashMap.java:541)
>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:192)
>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>       at ch.akuhn.fame.fm3.MetaDescription.allAttributes(MetaDescription.java:139)
>>       at ch.akuhn.fame.Repository.add(Repository.java:121)
>>       at ch.akuhn.fame.Repository.add(Repository.java:131)
>>       at ch.akuhn.fame.Repository.add(Repository.java:131)
>> + zillions of this same line, Repository.add calling itself
>> recursively at line 131
>>
>> I looked a bit into it and think that the problem may come from line
>> 131 into the Repository.add() method :-)
>>
>>
>>    public void add(Object element) {
>>        assert element != null;
>>        if (elements.add(element)) {
>>            MetaDescription meta = metamodel.getDescription(element.getClass());
>>            assert meta != null : element.getClass();
>>            for (PropertyDescription property : meta.allAttributes())
>> {   <--- line 121
>>                if (!property.isPrimitive()) {
>>                    boolean isRoot = property.getType().isRoot();
>>                    for (Object value : property.readAll(element)) {
>>                        assert value != null : property.getFullname();
>>                        if (!(isRoot &&
>>                                (value instanceof String ||
>>                                value instanceof Boolean ||
>>                                value instanceof Number))) {
>>                            try {
>>                                this.add(value);
>>                              <--- line 131
>>                            } catch (ClassNotMetadescribedException e) {
>>                                throw new
>> ElementInPropertyNotMetadescribed(property);
>>                            }
>>                        }
>>                    }
>>                }
>>            }
>>        }
>>    }
>>
>>
>> My suspicion is that this recursive call is actually walking through
>> the entire graph of FamixEntities because every entity is related to
>> some other entity ...
>>
>> 1- Anybody want to comment on this suspicion?
>> 2- Any idea how to correct it?
>>
>>
>> nicolas
>>
>> --
>> Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>



--
Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: debugging java implementation of Fame ...

Stéphane Ducasse
Ok

> I am lazy, whatever I can reuse I do.

Good practice.

>
> So yes it is Adrian's version, although I don't remember where or how I got it.
> Somebody (Simon?) must have given it to me.
>
> nicolas
>
> On Tue, Dec 14, 2010 at 11:54 AM, Stéphane Ducasse
> <[hidden email]> wrote:
>> nicolas
>>
>> Do you use the FAME version of adrian in Java or you recoded your own?
>>
>> Stef
>>
>> On Dec 13, 2010, at 10:53 PM, [hidden email] wrote:
>>
>>> Hi all,
>>>
>>> I need some help with the Java implementation of Fame.
>>>
>>> I am trying to implement separate parsing in VerveineJ so that one can
>>> deal with larger project by parsing them piece by piece.
>>> This implies loading in verveine the MSE already created to be able to
>>> add new entities to it.
>>>
>>> And The import method of Repository does not work for big MSE files
>>> (that were generated by the export method of Repository BTW) :-(
>>>
>>> It crashes with a StackOverflow:
>>> Exception in thread "main" java.lang.StackOverflowError
>>>       at java.util.HashMap.put(HashMap.java:389)
>>>       at java.util.HashMap.putAll(HashMap.java:541)
>>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:192)
>>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>>       at ch.akuhn.fame.fm3.MetaDescription.collectAllAttributes(MetaDescription.java:191)
>>>       at ch.akuhn.fame.fm3.MetaDescription.allAttributes(MetaDescription.java:139)
>>>       at ch.akuhn.fame.Repository.add(Repository.java:121)
>>>       at ch.akuhn.fame.Repository.add(Repository.java:131)
>>>       at ch.akuhn.fame.Repository.add(Repository.java:131)
>>> + zillions of this same line, Repository.add calling itself
>>> recursively at line 131
>>>
>>> I looked a bit into it and think that the problem may come from line
>>> 131 into the Repository.add() method :-)
>>>
>>>
>>>    public void add(Object element) {
>>>        assert element != null;
>>>        if (elements.add(element)) {
>>>            MetaDescription meta = metamodel.getDescription(element.getClass());
>>>            assert meta != null : element.getClass();
>>>            for (PropertyDescription property : meta.allAttributes())
>>> {   <--- line 121
>>>                if (!property.isPrimitive()) {
>>>                    boolean isRoot = property.getType().isRoot();
>>>                    for (Object value : property.readAll(element)) {
>>>                        assert value != null : property.getFullname();
>>>                        if (!(isRoot &&
>>>                                (value instanceof String ||
>>>                                value instanceof Boolean ||
>>>                                value instanceof Number))) {
>>>                            try {
>>>                                this.add(value);
>>>                              <--- line 131
>>>                            } catch (ClassNotMetadescribedException e) {
>>>                                throw new
>>> ElementInPropertyNotMetadescribed(property);
>>>                            }
>>>                        }
>>>                    }
>>>                }
>>>            }
>>>        }
>>>    }
>>>
>>>
>>> My suspicion is that this recursive call is actually walking through
>>> the entire graph of FamixEntities because every entity is related to
>>> some other entity ...
>>>
>>> 1- Anybody want to comment on this suspicion?
>>> 2- Any idea how to correct it?
>>>
>>>
>>> nicolas
>>>
>>> --
>>> Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>
>
>
> --
> Nicolas Anquetil        Univ. Lille1 / INRIA-equipe RMod
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev