Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Generated code cleaner issues #102

Closed
istvanrath opened this issue May 4, 2012 · 6 comments
Closed

Generated code cleaner issues #102

istvanrath opened this issue May 4, 2012 · 6 comments

Comments

@istvanrath
Copy link
Contributor

The cleaner for generated code does not work well in certain cases.

Problematic cases:

We should double check whether the cleaner correctly updates the plugin.xml after patterns have been deleted from .eiq files.

The cleaner does not seem to remove stale source folders from src-gen after pattern removal.

Constraint annotations are problematic

  1. Create pattern with @constraint annotation
  2. Delete pattern
  3. Optionally: Delete @constraint annotations

Result: while generated PM code will be deleted, constraint code will not, resulting in compile errors.

@ghost ghost assigned cmark May 4, 2012
@istvanrath
Copy link
Contributor Author

Idea: implement "custom" clean logic that removes everything from plugin.xml, manifest.mf etc. This will ensure that a consistent state of the project/workspace can be restored regardless of Xtext/etc issues.

cmark added a commit that referenced this issue May 13, 2012
class.

Moved GeneratorFragment logic, Extension and package ensure logic into a
custom BuilderParticipant class called
EMFPatternLanguageBuilderParticipant. Missing features: XMI Build, Clean
logic for Clean/Normal Build.
cmark added a commit that referenced this issue May 13, 2012
Added removing of global XMI model file logic to Clean Build.
Plug-in dependencies for the previous commit.
cmark added a commit that referenced this issue May 13, 2012
cmark added a commit that referenced this issue May 13, 2012
@istvanrath
Copy link
Contributor Author

It seems that the @PatterUI annotation is problematic with the new cleaner, too:

Error
Mon May 14 22:13:13 CEST 2012
org.eclipse.viatra2.patternlanguage.ui.builder.EMFPatternLanguageBuilderParticipant  - Java file cannot be deleted 
through IFileSystemAccess: test/TestMatch.java
java.lang.NullPointerException
   at org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2.getTraceFile(EclipseResourceFileSystemAccess2.java:379)
   at org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2.deleteFile(EclipseResourceFileSystemAccess2.java:401)
   at org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2.deleteFile(EclipseResourceFileSystemAccess2.java:390)
   at org.eclipse.xtext.generator.AbstractFileSystemAccess.deleteFile(AbstractFileSystemAccess.java:81)

An additional stack trace:

Error
Mon May 14 22:13:13 CEST 2012
org.eclipse.xtext.builder.impl.XtextBuilder  - String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
   at java.lang.String.substring(Unknown Source)
   at java.lang.String.substring(Unknown Source)
   at org.eclipse.viatra2.emf.incquery.core.project.ProjectGenerationHelper.ensureExtensions(ProjectGenerationHelper.java:516)
   at org.eclipse.viatra2.emf.incquery.core.project.ProjectGenerationHelper.ensureExtensions(ProjectGenerationHelper.java:474)
   at org.eclipse.viatra2.patternlanguage.ui.builder.EMFPatternLanguageBuilderParticipant.build(EMFPatternLanguageBuilderParticipant.java:190)
   at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)

See https://modeling.inf.mit.bme.hu/trac/modeling_2_2012/ticket/20 for details.

cmark added a commit that referenced this issue May 19, 2012
Changed DataBindingGenerator's annotation to ObservableValue.
Extracted extension name method for removeAllExtension and
ensureExtension methods, and added check for IndexOutOfBounds.
@cmark
Copy link
Contributor

cmark commented May 19, 2012

With the steps mentioned in Team2 issue, i cannot reproduce the problems. Maybe it is resolved with the fix for #114.
Additional improvements added to the cleaner, such as databinding clean support, and parameter check for ensure and remove extension methods).

@cmark cmark closed this as completed May 19, 2012
cmark added a commit that referenced this issue May 20, 2012
cmark added a commit that referenced this issue May 20, 2012
created during cleanUp, if the project is deleted from Eclipse, and the
annotation is removed from the pattern).
cmark added a commit that referenced this issue May 22, 2012
@abelhegedus abelhegedus reopened this Jun 23, 2012
@abelhegedus
Copy link
Member

Cleanup is not called for fragments when the annotation is removed.

I have tested this with the generator.derived projects.

cmark added a commit that referenced this issue Jun 25, 2012
@cmark
Copy link
Contributor

cmark commented Jun 25, 2012

Fixed in master.

@cmark cmark closed this as completed Jun 25, 2012
@abelhegedus
Copy link
Member

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants