| Summary: | EMF CodeGen/Jet: generated code with compile errors is not saved but a runtime error is thrown | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Martin Taal <mtaal> |
| Component: | Core | Assignee: | Marcelo Paternostro <marcelop> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | ||
| Version: | 2.3.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
The changes are committed to CVS. Now when you generate a new file, it will be written even if it has compilation errors. If this new file is being merged over an existing one, the error is displayed on the Dialog Box, as described on: https://bugs.eclipse.org/bugs/show_bug.cgi?id=181099 Fixed in I200704050200. Move to verified as per bug 206558. |
Build ID: 3.3M4 Steps To Reproduce: Jet throws a runtimeexception when it generates a java file with compile errors, it is easier if the java source is still written to a file because then errors in templates can more easily be identified. More information: Here is a part of an emft newsgroup exchange: By Ed: A similar type of issue came up in the GMF newsgroup and in that case it wasn't really even an error in the generated code but simply a redundant semicolon that was configured to be treated as a warning. The issue arises here in ASTFacadeHelper: public ASTJCompilationUnit createCompilationUnit(String name, String contents) { // set source char[] contentAsCharArray = contents.toCharArray(); ASTParser astParser = createASTParser(); astParser.setSource(contentAsCharArray); // parse CompilationUnit astCompilationUnit = (CompilationUnit)astParser.createAST(null); // display errors if any if (astCompilationUnit.getProblems().length > 0) { // TODO do a better job with reporting errors String problems = logCompilationErrors(astCompilationUnit.getProblems()); // NAME may be passed as name - do not show it if (name != null && !"".equals(name) && !"NAME".equals(name)) { problems = name + ":" + problems; } // stop merging and report problems throw new RuntimeException(problems); }