Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast issue when BoundBoxing a custom view #2

Closed
flavienlaurent opened this issue Sep 20, 2013 · 5 comments
Closed

cast issue when BoundBoxing a custom view #2

flavienlaurent opened this issue Sep 20, 2013 · 5 comments
Assignees

Comments

@flavienlaurent
Copy link
Collaborator

When boundboxing a custom view @Boundbox(boundClass = MyCustomView.class), the generated class contains errors:

  • trying to cast Object to int, Object to boolean, Object to primitive type
public static int boundBox_getLAYOUT_DIRECTION_RTL() {
    try {
      Field field = View.class.getDeclaredField("LAYOUT_DIRECTION_RTL");
      field.setAccessible(true);
      return (int) field.get(null); // <-- problem
    }
    catch( Exception e ) {
      throw new BoundBoxException(e);
    }
  }
  • LayoutParams import
The import com.my.pack.MyCustomView.LayoutParams collides with another import statement
@stephanenicolas
Copy link
Owner

The part with Statement conflict is a bit funny too me. I tried something but I am not sure. Would you mind to try the state of master branch, or current snapshots to say if bbug is fixed. If not, please add more details about the conflict and, ideally provide a small test/gist for it.

@flavienlaurent
Copy link
Collaborator Author

Statement conflict is still here.

https://gist.github.com/flavienlaurent/6667867

@stephanenicolas
Copy link
Owner

We are waiting for this pull request to be merged in JavaWriter. TODO uncomment a test in the writer when JavaWriter becomes mockable (non final) :
square/javapoet#25

@stephanenicolas
Copy link
Owner

Follow up.
Pull request has been merged. Close this thread when JavaWriter is released.
TODO uncomment a test in the writer when JavaWriter becomes mockable (non final).

stephanenicolas added a commit that referenced this issue Sep 27, 2013
@stephanenicolas
Copy link
Owner

@flavienlaurent I will close the issue. But take care of changing your javawriter version for annotation processing in eclipse !

The text view test is now enabled in android-sample. That's really a nice test, very complex. The BoundBox is huge, but evrything seems fine.

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

No branches or pull requests

2 participants