| [news.eclipse.tools.emf] Re: JMerge customization |
Timothy,
Dear Marcelo,
okay, so here is my first question. Before, i tell you, what i planned with Jmerge to do:
I want to reuse the JAST from JMerge, for manual analyzation of a Java file. I didn't want to create Target/SourceCompilationUnit, because i didn't want to use the JMerge algorithm for merging. All i need is a JCompilationUnit, which i can traverse like i've mentioned in the snippet below within the for-loop. Therefore, i used the following code snippet:
final File f = new File("F:/TFH/SE/de.freundwendland.tfh.se.JMergeCodeGeneration/src/jmerge/importWizards/ImportWizardPage.java");
final File rules = new File("F:/TFH/SE/de.freundwendland.tfh.se.JMergeCodeGeneration/mergeRules.xml");
JControlModel model = new JControlModel();
ASTFacadeHelper helper = new ASTFacadeHelper();
model.initialize(helper, rules.toURI().toString());
JMerger merger = new JMerger(model);
JCompilationUnit unit = merger.createCompilationUnitForURI(f.toURI().toString()); //causes an exception
ASTJCompilationUnit junit = helper.createCompilationUnit("Test", unit.getContents());
for(final JNode o:junit.getChildren()){
if(o instanceof JMethod){
System.out.println(o.getQualifiedName());
}
}
Nothing unusual, as i think. But the process fails with the following, nut interpretable error message for me:
org.eclipse.emf.common.util.WrappedException: org.eclipse.emf.common.util.DiagnosticException: A problem was detected while parsing a Java file
at org.eclipse.emf.codegen.merge.java.facade.ast.ASTFacadeHelper.createCompilationUnit(ASTFacadeHelper.java:282)
at org.eclipse.emf.codegen.merge.java.facade.ast.ASTFacadeHelper.createCompilationUnit(ASTFacadeHelper.java:1)
at org.eclipse.emf.codegen.merge.java.JMerger.createCompilationUnitForURI(JMerger.java:368)
at org.eclipse.emf.codegen.merge.java.JMerger.createCompilationUnitForURI(JMerger.java:343)
So, does anyone or you know, why that happens? I've introspect the related codeline in the createCompilationUnit... method, but didn't get it.
Thx
Timothy