APT issues

16 views
Skip to first unread message

Pierre

unread,
Jan 11, 2011, 11:07:01 PM1/11/11
to Mvp4g
With the last snapshot, I added an APT to use inside Eclipse to detect
errors in the IDE. This APT also runs in maven or ant. This wouldn't
be an issue if the APT runs the same way in Eclipse as in maven or ant
but it is not the case (it seems the Java environement is not the same
in Eclipse as in maven/ant).

Since the APT is only useful in Eclipse (because all the errors it
detects are already detected thanks to the GWT compilation), I'm
thinking creating 2 jars: one without the apt and the other one
containing the APT. The first would be used as usual and the second
one will only be added to eclipse apt factory path.

Even if this means 2 jars to update, I feel like it gives a better
separation between the library and the apt which prevents errors from
the apt to impact the regular library.

What do you guys think?

Thanks,
Pierre

Dennis

unread,
Jan 12, 2011, 7:55:31 AM1/12/11
to Mvp4g
Hi Pierre,

why do you think that the 'the APT is only useful in Eclipse '?
- Several times already I got weird error messages that were hard to
debug (finding the root of the problem) for problems that are now
detected by APT and produce nicely readable errors.
- Wasn't the goal of making an APT instead of an eclipse plugin to
make it independent of the IDE - but now the APT seems to be eclipse
(compiler) specific and won't run in other IDE's that use javac.

For me personally a jar without APT is totally fine, as I develop in
Eclipse anyway before I push my changes to the repo where it then gets
build by hudson.

thanks,
Dennis

Jeff Larsen

unread,
Jan 12, 2011, 10:04:34 AM1/12/11
to mv...@googlegroups.com
I think it makes sense to split the annotation processing stuff out of the main library and have it in its own jar. This is how I have been implementing my own annotation processors. 


John

unread,
Jan 12, 2011, 1:32:54 PM1/12/11
to Mvp4g

Pierre

unread,
Jan 12, 2011, 4:55:45 PM1/12/11
to Mvp4g
> why do you think that the 'the APT is only useful in Eclipse '?
> - Several times already I got weird error messages that were hard to
> debug (finding the root of the problem) for problems that are now
> detected by APT and produce nicely readable errors.
> - Wasn't the goal of making an APT instead of an eclipse plugin to
> make it independent of the IDE - but now the APT seems to be eclipse
> (compiler) specific and won't run in other IDE's that use javac.
The APT detects the same errors as the GWT/Java compiler but it's true
they have a better messaging so it could have been useful to use it
everywhere (eclipse, maven, ant...). I developed an APT so that it can
be used everywhere but it seems it can't be the case and has to be
eclipse compliant. I guess for future release, it may be a better idea
to develop a plugin if the APT can work only for eclipse anyways.

Thanks for your feedback, I will move the apt in its own jar and also
correct the issue 61.
Pierre

John

unread,
Jan 20, 2011, 11:16:25 AM1/20/11
to Mvp4g
Hey Pierre,

Thanks for fixing issue 61, however now when I add a new Event to the
bus but haven't yet put it into the handler/presenter, the build
doesn't catch it at all (same case of parent bus annotated with
Events, child bus extends EventBus - happens regardless of which the
new Event is added to).

John

unread,
Jan 20, 2011, 11:28:31 AM1/20/11
to Mvp4g
As an added twist, these are in a sub project of a main project. The
sub project gwt compiles fine and builds fine. However, upon gwt
compiling the main project, the eventbus errors are discovered in the
sub project. Let me know if that's unclear ...

John

Pierre

unread,
Jan 20, 2011, 12:13:48 PM1/20/11
to Mvp4g
Hi John,

This seems to be a tricky case. Would you mind posting some code to
help me understand? I'm not sure to get it correctly.

Thanks,
Pierre
> > > Pierre- Hide quoted text -
>
> - Show quoted text -

John

unread,
Jan 20, 2011, 3:56:59 PM1/20/11
to Mvp4g
I'll try and explain with snippets and see if that clarifies things
for you.

--------------- in ProjectA ---------------------
@Events(startView = ContentView.class, historyOnStart = true)
@ChildModules({ @ChildModule(moduleClass = ModuleB.class, autoDisplay
= false) })
public interface EventBusA extends EventBus

-------------- in ProjectB (included in build path of ProjectA)
--------------------
@Events(module = ModuleB.class, startView = OverviewView.class)
public interface EventBusB extends EventBusC {
...
@Event(handlers = EventHandler1.class)
public void setEditor();
}

public interface EventBusC extends EventBus

@EventHandler
public class EventHandler1 extends BaseEventHandler<EventBusB>
----------------------------------------------------------------------------------------------------------

EventHandler1 does not have a function onSetEditor, yet when I build
ProjectB, I get no errors. When I compile ProjectB I get no errors.
When I build ProjectA I get no errors. But when I compile ProjectA I
get:

[ERROR] Line X: The method onSetEditor() is undefined for the type
EventHandler1

Hopefully that clarifies the situation - let me know if I can help
clarify anything more.

Pierre

unread,
Jan 20, 2011, 4:30:13 PM1/20/11
to Mvp4g
Thanks John,

> ProjectB, I get no errors. When I compile ProjectB I get no errors.
By compiling, do you mean a GWT compilation? Does it mean you have an
entry point for Project B?

I have a few questions:
-do you have any error in the eclipse logs?
-do you still have the error if EventBusB doesn't extend EventBusC?
-is it specific to only one event (setEditor) or all events? is it
specific to only one event bus (EventBusB) or all event bus?
-I'm guessing you have 2 eclipse projects (A & B). Did you set the apt
for both projects?

Thanks,
Pierre

John

unread,
Jan 20, 2011, 4:50:54 PM1/20/11
to Mvp4g
Just figured it out! I had everything setup when the apt was included
in the snapshot, but when they were split, I forgot to change the
factory path to the apt jar! Sorry for the confusion and any time I
cost you :/

Pierre

unread,
Jan 20, 2011, 5:27:45 PM1/20/11
to Mvp4g
No problem, I appreciate you taking time to test the last snapshot.

Pierre

John

unread,
Jan 25, 2011, 1:59:39 PM1/25/11
to Mvp4g
I think I have found a bug / missing feature - a different one - with
the apt.

if you set forwardToParent = true in a module eventbus, it doesn't
check if that event exists in the parent eventBus. So,

-------------- in ProjectA ---------------------
@Events(startView = ContentView.class)
@ChildModules({ @ChildModule(moduleClass = ModuleB.class, autoDisplay
= false) })
public interface EventBusA extends EventBus {

}

-------------- in ProjectB (included in build path of ProjectA)
--------------------
@Events(module = ModuleB.class, startView = OverviewView.class)
public interface EventBusB extends EventBus {

@Event(forwardToParent = true)
public void updateNavigation(String page);
}

the APT doesn't find any error with this, even though the parent
EventBus is missing the updateNavigation method. Thus the error is
missed until the gwt compiler runs.

Keep up the good work!
John

Pierre

unread,
Jan 25, 2011, 3:50:10 PM1/25/11
to Mvp4g
Hi John,

APT doesn't detect yet if the child/parent event bus has the right
event. I created the issue 65 and I plan to correct it for the final
1.3.0 release.

Thanks,
Pierre
> > > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages