Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Conversation

@WonderCsabo
Copy link
Member

Related to #1466.

This is incomplete. For some reasons, it generates the following:

private void init_(Bundle savedInstanceState) {
    {
        Resources resources_ = this.getResources();
        injected_string = resources_.getString(R.string.injected_string);
        injectedString = resources_.getString(R.string.injected_string);
        helloHtml = Html.fromHtml(resources_.getString(R.string.hello_html));
        htmlInjected = Html.fromHtml(resources_.getString(R.string.hello_html));
    }
}

Note the extra block with braces and indent. I could not figure out why is this happening. Any help is much appreciated.

@WonderCsabo
Copy link
Member Author

The problem can be seen in ContextCompatDrawableTest.activityCompilesOnMinSdkLower21CompileSdkHigher21WithoutContextCompat().

@dodgex
Copy link
Member

dodgex commented Oct 11, 2015

i have a similar problem. jcodemodel sets the braces to required as soon as one calls decl. see JBlock.java#L275

@WonderCsabo
Copy link
Member Author

Thanks! I just realized this myself. See phax/jcodemodel#32.

@dodgex
Copy link
Member

dodgex commented Oct 11, 2015

haha :) good to know. btw we can do some kind of workaround by calling .bracesRequired(false).indentRequired(false); but this is... kind of ugly :(

That way we can make sure that after injection code will always happen
after injection, regardless of the annotation handler calling order.
@WonderCsabo WonderCsabo force-pushed the 1466_refactorInjectionBlocks branch from 18f9ae2 to cb7aaef Compare October 11, 2015 16:01
@WonderCsabo WonderCsabo changed the title [WIP] Create blocks for injection and after injection Create blocks for injection and after injection Nov 11, 2015
yDelouis added a commit that referenced this pull request Nov 11, 2015
[WIP] Create blocks for injection and after injection
@yDelouis yDelouis merged commit 93c7f3d into androidannotations:develop Nov 11, 2015
@yDelouis
Copy link
Contributor

Great.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants