manolo / gwt-api-generator

Generator for creating GWT JSInterop clients from Polymer Web Components
Apache License 2.0
50 stars 24 forks source link

Compilation errors on the generated code. #65

Closed komasoftware closed 8 years ago

komasoftware commented 8 years ago

I installed following Polymer components

"dependencies": { "google-drive": "GoogleWebcomponents/google-drive#^1.0.1", "google-apis": "GoogleWebcomponents/google-apis#^1.1.5", "google-signin": "GoogleWebcomponents/google-signin#^1.3.3", "vaadin-grid": "vaadin/vaadin-grid#1.0.0", "vaadin-combo-box": "vaadin/vaadin-combo-box#1.0.0", "paper-elements": "PolymerElements/paper-elements#^1.0.7", "iron-elements": "PolymerElements/iron-elements#^1.0.10", "neon-elements": "PolymerElements/neon-elements#^1.0.0", "vaadin-icons": "vaadin/vaadin-icons#1.0.0" }

gwt-api-generator --pom mvn package

bunch of errors ...

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.EventHandler.java:[13,80] '{' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.EventHandler.java:[15,74] '(' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.EventHandler.java:[15,150] = expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[23,80] '{' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/PaperButton.java:[574,97] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/PaperButton.java:[574,98] invalid method declaration; return type required
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[19,76] '{' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[19,162] > expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[19,175] '(' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,5] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,12] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,23] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,101] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,106] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,107] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,116] not a statement
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[21,193] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[22,107] not a statement
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[22,112] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[22,188] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[25,5] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[25,82] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[28,5] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[28,111] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[32,5] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[32,15] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[32,28] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[32,112] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[33,82] <identifier> expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[36,5] illegal start of expression
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[36,127] ';' expected
[ERROR] /home/koen/workspace/asics/gwt-api-generator/src/main/java/com/vaadin/polymer/paper/widget/event/TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event.java:[41,2] reached end of file while parsing
[INFO] 32 errors 
tehapo commented 8 years ago

I can verify the same compilation errors. I did the following steps in an empty test directory.

bower install paper-elements
gwt-api-generator --pom
mvn package

Could you @manolo take a look at this?

komasoftware commented 8 years ago

Yes, the basic sample from the README does not work anymore :

$ gwt-api-generator --package=PolymerElements/paper-elements --pom $ mvn package

returns the same errors. I'd love to help to get this fixed if @manolo could provide some pointers ?

ghost commented 8 years ago

It's a Polymer comment change in paper-button.html (line 174) that causes this issue:

before: @param {{node: Object}} detail Contains the animated node.

now: Event param: {{node: Object}} detail Contains the animated node.

It seems that the missing @param annotation causes the extension of the TransitionendEventto TransitionendEventparamnodeObjectdetailContainstheanimatednode.Event

komasoftware commented 8 years ago

Can we be a bit more forgiving for this kind of errors in the comments when generating ? @muelbr can you past a link to the relevant part of the generator code ?

ghost commented 8 years ago

I am not committer to this project. But if you are going for the latest polymer version then download the components manually with bower, fix this line and generate the wrapper classes.

$ bower install --save PolymerElements/paper-elements $ gwt-api-generator

cpboyd commented 8 years ago

As a note, the Polymer team changed from @param to Event param due to compiler issues: https://github.com/PolymerElements/paper-button/commit/2f44db5170fb09d213c1dc87f0859770fe510658

Basically, I think the "name" function (at least for events) needs to take newlines into account.

It doesn't make sense that an event name would span multiple lines.

cpboyd commented 8 years ago

@komasoftware Using a split on newlines and taking the first line seems to fix the issue. (Granted, the event's generated NAME string still has the long comment nonsense with only this change in camelCase, so probably making the same change with other functions)

In helpers.js line 61:


  camelCase: function(s) {
    return (s.split('\n')[0] || '').replace(/^Polymer\./, '').replace(/[^\-\w\.]/g,'').replace(/(\b|-|\.)\w/g, function (m) {
      return m.toUpperCase().replace(/[-\.]/g, '');
    });
  },
komasoftware commented 8 years ago

Back here. The change did not really solve the issue.

Wondering if @manolo still plans to support this library. Otherwise I need to look into another solution and rewrite my code. I would really like to know !

andrescirulo commented 8 years ago

I used an awful solution. The solution of helpers.js line 61 dind't work for me, so i changed it to

camelCase: function(s) {
    if (s.toLowerCase().startsWith('transitionend')){
        console.log('name--:' + s);
        return 'Transitionend';
    }   
    return (s || '').replace(/^Polymer\./, '').replace(/[^\-\w\.]/g,'').replace(/(\b|-|\.)\w/g, function (m) {
        return m.toUpperCase().replace(/[-\.]/g, '');
    });
}

It's horrible, but it compiles. Then i had to use the fix mentioned here.

The problem I have now is that in Chrome the PaperInput does not work. It is visible, but i can't get the focus. Anyone with the same problem? Could it have to do with the change i made in the function camelCase?

For what i could see, the compilation now is showing a lot of errors/warnings (?) like this one but with many components Behavior Polymer.Templatizer not found when mixing properties into vaadin-infinite-scroller! Any idea why this could be? Could this be the problem?

manolo commented 8 years ago

Fixed in ecb419c8c3264bab7e93c54ac7f6c6792bc4a1e6

komasoftware commented 8 years ago

How can I "npm install -g vaadin/gwt-api-generator" a specific commit ecb419c ? Or will a new release soon follow ?

Thx for all the work !