Hello Doru,
I am trying jdt2famix by creating a binary release from sources. After
creating the binary release, I run it on jfreechart (version:
54eeb32a0bbf61db346fa3d37ef94a00b9747b1c), and I have the following
exception.
obs: it works if I download and use "Release 1.0.3".
======== Script ===========
git clone https://github.com/girba/jdt2famix.git
cd jdt2famix
./release.sh
cd ..
git clone https://github.com/jfree/jfreechart.git
cd jfreechart/
git reset --hard 54eeb32a0bbf61db346fa3d37ef94a00b9747b1c
../jdt2famix/release/jdt2famix.sh
========= Exception ========
16:46:07 - importing file - 0163/1010 -
/Users/andrehora/Desktop/jfreechart/src/main/java/org/jfree/chart/fx/ChartCanvas.java
Exception in thread "main" java.lang.NullPointerException
at
com.feenk.jdt2famix.injava.InJavaImporter.createAccessFromVariableBinding(InJavaImporter.java:768)
at
com.feenk.jdt2famix.injava.InJavaImporter.createAccessFromExpression(InJavaImporter.java:760)
at com.feenk.jdt2famix.injava.AstVisitor.visit(AstVisitor.java:454)
at org.eclipse.jdt.core.dom.Assignment.accept0(Assignment.java:309)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759)
at
org.eclipse.jdt.core.dom.ExpressionStatement.accept0(ExpressionStatement.java:145)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:137)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2759)
at
org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:635)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
at
org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:470)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
at
org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:212)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at com.feenk.jdt2famix.injava.AstRequestor.acceptAST(AstRequestor.java:30)
at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1029)
at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:636)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:990)
at com.feenk.jdt2famix.Importer.run(Importer.java:39)
at com.feenk.jdt2famix.injava.Main.main(Main.java:30)
--
Andre Hora
Anne spotted a bug in numberOfLinesOfCode.
In Java, one can easily find classes with numberOfLinesOfCode <
numberOfLinesOfCodewithMoreThanOnecharacter
The reason is that numberOfLinesOfCodewithMoreThanOnecharacter is
defined in SourcedEntity by counting the lines (with more than 1 char)
in the sourceText
numberOfLinesOfCode is the sum of numberOfLinesOfCode of the methods.
This is clearly not right for Java where a class as more code than just
its methods.
But it is not even coherent for Smalltalk where a class' sourceText
includes the name of the class (at least 1 additional line).
So even in Smalltalk, one finds classes with numberOfLinesOfCode <
numberOfLinesOfCodewithMoreThanOnecharacter
(happens when none of the methods of the class have blank lines e.g.
FamixEntity)
So I propose to unify both methods and compute numberOfLinesOfCode in
SourcedEntity from the sourceText
(and remove FAMIXClass>>numberOfLinesOfCode)
Second, for methods, the same numberOfLinesOfCode has a backward
compatibilty with "exporters that use LOC as a property name"
(in this case, it uses LOC instead of computing the number)
Anybody still having this case?
So I propose to remove FAMIXBehaviouralEntity>>numberOfLinesOfCode
nicolas
--
Nicolas Anquetil -- MCF (HDR)
Project-Team RMod