You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by "David Read (JIRA)" <be...@incubator.apache.org> on 2005/04/01 16:20:47 UTC
[jira] Created: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
NPE in APT when Control references another Control via Control Bean
-------------------------------------------------------------------
Key: BEEHIVE-486
URL: http://issues.apache.org/jira/browse/BEEHIVE-486
Project: Beehive
Type: Bug
Components: Controls
Versions: V1Beta
Environment: Window NT, Java 1.5
Reporter: David Read
Fix For: V1
Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
StackTrace:
[apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
[apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
[apt] symbol : class AnotherCustomControlBean
[apt] location: class controls.CustomControlImpl
[apt] protected AnotherCustomControlBean customControlBean;
[apt] ^
[apt] Problem encountered during annotation processing;
[apt] see stacktrace below for more information.
[apt] java.lang.NullPointerException
[apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
[apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
[apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
[apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
:161)
[apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
[apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Resolved: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/BEEHIVE-486?page=history ]
Kyle Marvin resolved BEEHIVE-486:
---------------------------------
Resolution: Fixed
Resolved by svn revision 161051, which improves the @Control annotation processing model to make it possible to resolve bean types from either compiled classes *or* using sources of control interface/extensions passed into the current processer invocation. It should no longer be necessary to use the compileByExtension option of <apt> or multiple <apt> invocations to manually manage dependency ordering.
> NPE in APT when Control references another Control via Control Bean
> -------------------------------------------------------------------
>
> Key: BEEHIVE-486
> URL: http://issues.apache.org/jira/browse/BEEHIVE-486
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Window NT, Java 1.5
> Reporter: David Read
> Assignee: Kyle Marvin
> Fix For: V1
> Attachments: aptOnTomcat.zip
>
> Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
> StackTrace:
> [apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
> [apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
> [apt] symbol : class AnotherCustomControlBean
> [apt] location: class controls.CustomControlImpl
> [apt] protected AnotherCustomControlBean customControlBean;
> [apt] ^
> [apt] Problem encountered during annotation processing;
> [apt] see stacktrace below for more information.
> [apt] java.lang.NullPointerException
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
> :161)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
> [apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
> a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Commented: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
Posted by "David Read (JIRA)" <be...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/BEEHIVE-486?page=comments#action_61971 ]
David Read commented on BEEHIVE-486:
------------------------------------
A simpler scenario (and another one to consider) is a reflexive relationship between the control and it's own type. If MyControlImpl has a reference to the public interface MyControl, build and runtime work fine. If MyControlImpl has a field of type MyControlBean, then the same error (the NPE) occurs during build.
> NPE in APT when Control references another Control via Control Bean
> -------------------------------------------------------------------
>
> Key: BEEHIVE-486
> URL: http://issues.apache.org/jira/browse/BEEHIVE-486
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Window NT, Java 1.5
> Reporter: David Read
> Assignee: Kyle Marvin
> Fix For: V1
>
> Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
> StackTrace:
> [apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
> [apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
> [apt] symbol : class AnotherCustomControlBean
> [apt] location: class controls.CustomControlImpl
> [apt] protected AnotherCustomControlBean customControlBean;
> [apt] ^
> [apt] Problem encountered during annotation processing;
> [apt] see stacktrace below for more information.
> [apt] java.lang.NullPointerException
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
> :161)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
> [apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
> a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Closed: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
Posted by "Zach Smith (JIRA)" <be...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/BEEHIVE-486?page=all ]
Zach Smith closed BEEHIVE-486:
------------------------------
I can now build, deploy, and run the attached app successfully on Tomcat however I do see a warning from apt about ReflexiveControlBean not being found.
[apt] Compiling 6 source files to D:\TEMP\aptOnTomcat\WEB-INF\classes
[apt] D:\TEMP\aptOnTomcat\WEB-INF\src\controls\ReflexiveControlImpl.java:15: cannot find symbol
[apt] symbol : class ReflexiveControlBean
[apt] location: class controls.ReflexiveControlImpl
[apt] protected ReflexiveControlBean reflexiveControlBean;
This appears to work ok but I am curious if the warning is problematic.
> NPE in APT when Control references another Control via Control Bean
> -------------------------------------------------------------------
>
> Key: BEEHIVE-486
> URL: http://issues.apache.org/jira/browse/BEEHIVE-486
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Window NT, Java 1.5
> Reporter: David Read
> Assignee: Kyle Marvin
> Fix For: v1m1
> Attachments: aptOnTomcat.zip
>
> Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
> StackTrace:
> [apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
> [apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
> [apt] symbol : class AnotherCustomControlBean
> [apt] location: class controls.CustomControlImpl
> [apt] protected AnotherCustomControlBean customControlBean;
> [apt] ^
> [apt] Problem encountered during annotation processing;
> [apt] see stacktrace below for more information.
> [apt] java.lang.NullPointerException
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
> :161)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
> [apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
> a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
Posted by "David Read (JIRA)" <be...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/BEEHIVE-486?page=history ]
David Read updated BEEHIVE-486:
-------------------------------
Attachment: aptOnTomcat.zip
attached is a simple app that includes two scenarios:
ControlImpl->ControlBean (different type)
ControlImpl->ControlBean (same type)
The files from web-inf/lib have beeen removed and build.properties will have to be updated.
> NPE in APT when Control references another Control via Control Bean
> -------------------------------------------------------------------
>
> Key: BEEHIVE-486
> URL: http://issues.apache.org/jira/browse/BEEHIVE-486
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Window NT, Java 1.5
> Reporter: David Read
> Assignee: Kyle Marvin
> Fix For: V1
> Attachments: aptOnTomcat.zip
>
> Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
> StackTrace:
> [apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
> [apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
> [apt] symbol : class AnotherCustomControlBean
> [apt] location: class controls.CustomControlImpl
> [apt] protected AnotherCustomControlBean customControlBean;
> [apt] ^
> [apt] Problem encountered during annotation processing;
> [apt] see stacktrace below for more information.
> [apt] java.lang.NullPointerException
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
> :161)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
> [apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
> a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Commented: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/BEEHIVE-486?page=comments#action_61980 ]
Kyle Marvin commented on BEEHIVE-486:
-------------------------------------
I'll go back and look at this again, but in the past I ran into some APT issues that made this problematic. Specifically, APT parses all input source files before it invokes any processors or does any codegen. If this parsing fails due to a type that is yet to be generated, then processor never gets invoked, or at least is the behavior I'd seen in the past. The interesting thing is that the NPE in this bug is happening inside of a processor, which doesn't fit this description so needs more study.
In the past, the workaround I've proposed is that you can make your 'simple scenario' work by doing two separate APT invocations: first on the public interface for the control (which generates the associated bean type), and then on the control impl (which can now safely reference the generated bean type). But forcing a developer to deal with these sorts of dependendencies manually is pretty ugly.
> NPE in APT when Control references another Control via Control Bean
> -------------------------------------------------------------------
>
> Key: BEEHIVE-486
> URL: http://issues.apache.org/jira/browse/BEEHIVE-486
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Window NT, Java 1.5
> Reporter: David Read
> Assignee: Kyle Marvin
> Fix For: V1
>
> Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
> StackTrace:
> [apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
> [apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
> [apt] symbol : class AnotherCustomControlBean
> [apt] location: class controls.CustomControlImpl
> [apt] protected AnotherCustomControlBean customControlBean;
> [apt] ^
> [apt] Problem encountered during annotation processing;
> [apt] see stacktrace below for more information.
> [apt] java.lang.NullPointerException
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
> :161)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
> [apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
> a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Assigned: (BEEHIVE-486) NPE in APT when Control references another Control via Control Bean
Posted by "Kyle Marvin (JIRA)" <be...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/BEEHIVE-486?page=history ]
Kyle Marvin reassigned BEEHIVE-486:
-----------------------------------
Assign To: Kyle Marvin
> NPE in APT when Control references another Control via Control Bean
> -------------------------------------------------------------------
>
> Key: BEEHIVE-486
> URL: http://issues.apache.org/jira/browse/BEEHIVE-486
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: V1Beta
> Environment: Window NT, Java 1.5
> Reporter: David Read
> Assignee: Kyle Marvin
> Fix For: V1
>
> Scenario is Control->AnotherControl in the same webapp and package. If the reference is via the Control's public interface, it works fine. If the reference is via the generated Control Bean, then the build fails. It looks like it might be a problem with the order of generation. If I comment out the reference and run the build again, then everything is generated. If I then uncomment the reference, the build works fine and the application runs. At the point of failure, I can see in the generated tmp dir that the referenced Control Bean source file has not yet been created.
> StackTrace:
> [apt] Compiling 4 source files to C:\data\workspaces\aptOnTomcat\WEB-INF\classes
> [apt] C:\data\workspaces\aptOnTomcat\WEB-INF\src\controls\CustomControlImpl.java:15: cannot find symbol
> [apt] symbol : class AnotherCustomControlBean
> [apt] location: class controls.CustomControlImpl
> [apt] protected AnotherCustomControlBean customControlBean;
> [apt] ^
> [apt] Problem encountered during annotation processing;
> [apt] see stacktrace below for more information.
> [apt] java.lang.NullPointerException
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.initTypeParameterBindings(AptEventField.java:61)
> [apt] at org.apache.beehive.controls.runtime.generator.AptEventField.getControlInterface(AptEventField.java:108)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlField.<init>(AptControlField.java:50)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.initControls(AptControlImplementation.java
> :161)
> [apt] at org.apache.beehive.controls.runtime.generator.AptControlImplementation.<init>(AptControlImplementation.java:71)
> [apt] at org.apache.beehive.controls.runtime.generator.apt.ControlAnnotationProcessor.check(ControlAnnotationProcessor.jav
> a:80)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira