[Demonstration 1]

[Buggy Method]
public final CodeContext code() throws RecognitionException {
    CodeContext _localctx = new CodeContext(_ctx, getState());
    enterRule(_localctx, 4, RULE_code);
    try {
        int _alt;
        enterOuterAlt(_localctx, 1);
        {
            setState(28);
            _errHandler.sync(this);
            _alt = 1;
            do {
                switch(_alt) {
                    case 1:
                        {
                            {
                                setState(27);
                                match(CODE);
                            }
                        }
                        break;
                    default:
                        throw new NoViableAltException(this);
                }
                setState(30);
                _errHandler.sync(this);
                _alt = getInterpreter().adaptivePredict(_input, 2, _ctx);
            } while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER);
        }
    } catch (RecognitionException re) {
        _localctx.exception = re;
        _errHandler.reportError(this, re);
        _errHandler.recover(this, re);
    } finally {
        exitRule();
    }
    return _localctx;
}

[Buggy Hunk]
} while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER );

[Patch]
} while ( _alt!=2 && _alt!= ATN.INVALID_ALT_NUMBER );

[Demonstration 2]

[Buggy Method]
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    android.support.v7.app.ActionBar mActionBar = getSupportActionBar();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    tabPagesAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {

        @Override
        public int getCount() {
            return 3;
        }

        @Override
        public Fragment getItem(int position) {
            switch(position) {
                case 0:
                    return new HomePageFragment();
                case 1:
                    return new MyRecipesFragment();
                case 2:
                    return new AddNewRecipeFragment();
                default:
                    return null;
            }
        }
    };
    viewPager = (ViewPager) findViewById(R.id.vp);
    viewPager.setAdapter(tabPagesAdapter);
    viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            getSupportActionBar().setSelectedNavigationItem(position);
        }
    });
    android.support.v7.app.ActionBar.TabListener listener = new android.support.v7.app.ActionBar.TabListener() {

        @Override
        public void onTabSelected(android.support.v7.app.ActionBar.Tab tab, FragmentTransaction ft) {
            viewPager.setCurrentItem(tab.getPosition());
        }

        @Override
        public void onTabUnselected(android.support.v7.app.ActionBar.Tab tab, FragmentTransaction ft) {
        }

        @Override
        public void onTabReselected(android.support.v7.app.ActionBar.Tab tab, FragmentTransaction ft) {
        }
    };
    // Home
    android.support.v7.app.ActionBar.Tab home = mActionBar.newTab();
    home.setText("Home");
    home.setTabListener(listener);
    mActionBar.addTab(home);
    // AllRecipie
    android.support.v7.app.ActionBar.Tab allRecipie = mActionBar.newTab();
    allRecipie.setText("All recipe");
    allRecipie.setTabListener(listener);
    mActionBar.addTab(allRecipie);
    //NewRecipie
    android.support.v7.app.ActionBar.Tab newRecipie = mActionBar.newTab();
    newRecipie.setText("Add new recipe");
    newRecipie.setTabListener(listener);
    mActionBar.addTab(newRecipie);
}

[Buggy Hunk]
case 1: return new MyRecipesFragment();

[Patch]
case 1: return new AllRecipesFragment();

[Demonstration 3]

[Buggy Method]
private void checkValidDefaultValue(String name, String[] validValues, String defaultValue) {
    if (isValid(defaultValue, validValues)) {
        throw new IllegalArgumentException("The default value '" + defaultValue + "' is not valid for argument " + name);
    }
}

[Buggy Hunk]
if(isValid(defaultValue, validValues)) {

[Patch]
if(!isValid(defaultValue, validValues)) {