Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Create blocks for injection and after injection#1585

Merged
yDelouis merged 2 commits into
androidannotations:developandroidannotations/androidannotations:developfrom
WonderCsabo:1466_refactorInjectionBlocksWonderCsabo/androidannotations:1466_refactorInjectionBlocksCopy head branch name to clipboard
Nov 11, 2015
Merged

Create blocks for injection and after injection#1585
yDelouis merged 2 commits into
androidannotations:developandroidannotations/androidannotations:developfrom
WonderCsabo:1466_refactorInjectionBlocksWonderCsabo/androidannotations:1466_refactorInjectionBlocksCopy head branch name to clipboard

Conversation

@WonderCsabo

Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

@dodgex

dodgex commented Oct 11, 2015

Copy link
Copy Markdown
Member

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

@WonderCsabo

Copy link
Copy Markdown
Member Author

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

@dodgex

dodgex commented Oct 11, 2015

Copy link
Copy Markdown
Member

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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.