Timonthy,
I doubt the tools are making it up. The diagnostic that's created has
the string with the contents, so look closely at those...
Timothy Marc wrote:
Ed,
indeed, you're right. The IProblem says, that the ClassBody contains a
missing "}", but that isn't so in real, because the java file i want to
parse is a valid file in a working project without syntax errors.
Why does this error appears?
Thx
Timothy
"Ed Merks" <Ed.Merks@xxxxxxxxx> schrieb im Newsbeitrag
news:gbarvg$bkt$1@xxxxxxxxxxxxxxxxx...
Timothy,
Try setting a breakpoint in ASTFacadeHelper.analyzeCompilationUnit and see
what IProblems are reported. Perhaps you're generating code with syntax
errors?
Timothy Marc wrote:
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
|