auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void check(CoreEvent event) throws FlowBackPressureException { START if (abstractPipeline.getSource().getBackPressureStrategy() == MessageSource.BackPressureStrategy.WAIT) { END checkWithWaitStrategy(event); } else { checkWithFailDropStrategy(event); } } static import

Target:
public void check(CoreEvent event) throws FlowBackPressureException { if (abstractPipeline.getSource().getBackPressureStrategy() == WAIT) { checkWithWaitStrategy(event); } else { checkWithFailDropStrategy(event); } }
Source:
private static void setMaxAttributeSizeProperty(XMLInputFactory factory) { String maxAttributeSizeProperty = getProperty(MULE_MAX_ATTRIBUTE_SIZE); if(maxAttributeSizeProperty != null) { Integer maxAttributeSize = parseInt(maxAttributeSizeProperty); if(maxAttributeSize > 0) { factory.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSizeProperty); return; } else if (LOGGER.isDebugEnabled()) { START LOGGER.debug("Invalid " + P_MAX_ATTRIBUTE_SIZE + " property value"); END } } factory.setProperty(P_MAX_ATTRIBUTE_SIZE, MAX_VALUE); } make this a WARN

Target:
private static void setMaxAttributeSizeProperty(XMLInputFactory factory) { String maxAttributeSizeProperty = getProperty(MULE_MAX_ATTRIBUTE_SIZE); if(maxAttributeSizeProperty != null) { Integer maxAttributeSize = parseInt(maxAttributeSizeProperty); if(maxAttributeSize > 0) { factory.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSizeProperty); return; } else { LOGGER.warn("Invalid " + P_MAX_ATTRIBUTE_SIZE + " property value"); } } factory.setProperty(P_MAX_ATTRIBUTE_SIZE, MAX_VALUE); }
Source:
private BiConsumer<Throwable, Object> completeWithErrorPropagate() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); START System.out.println("propagating error... " + errorEvent.getContext().getDepthLevel()); END errorEvent.getContext().error(error); }; } Remove

Target:
private BiConsumer<Throwable, Object> completeWithErrorPropagate() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); errorEvent.getContext().error(error); }; }
Source:
private BiConsumer<Throwable, Object> completeWithErrorContinue() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); START System.out.println("continuing after error... " + errorEvent.getContext().getDepthLevel()); END (errorEvent.getContext()).success(errorEvent); }; } Remove

Target:
private BiConsumer<Throwable, Object> completeWithErrorContinue() { return (error, event) -> { final PrivilegedEvent errorEvent = (PrivilegedEvent) ((MessagingException) error).getEvent(); (errorEvent.getContext()).success(errorEvent); }; }
Source:
private PolicyInstance initPolicyInstance() throws InitialisationException { if (policyContext == null) { START initPolicyContext(); END } return policyContext.getRegistry().lookupByType(PolicyInstance.class).get(); } this should be set already, why do you need to add this?

Target:
private PolicyInstance initPolicyInstance() { return policyContext.getRegistry().lookupByType(PolicyInstance.class).get(); }
Source:
public static boolean deleteFile(File file) { START boolean shouldFailIfOpen = DefaultMuleConfiguration.shouldFailIfDeleteOpenFile(); END if (shouldFailIfOpen) { if (isFileOpen(file)) { Message message = MessageFactory.createStaticMessage("Attempting to delete an open file: " + file); throw new MuleRuntimeException(message); } } else if (shouldLogWarningIfDeleteOpenFile()) { if (isFileOpen(file)) { logger.warn("Attempting to delete an open file: " + file); } } return file.delete(); } static import

Target:
public static boolean deleteFile(File file) { boolean shouldFailIfOpen = shouldFailIfDeleteOpenFile(); if (shouldFailIfOpen) { if (isFileOpen(file)) { throw new MuleRuntimeException(createStaticMessage("Attempting to delete an open file: " + file)); } } else if (shouldLogWarningIfDeleteOpenFile()) { if (isFileOpen(file)) { logger.warn("Attempting to delete an open file: " + file); } } return file.delete(); }
Source:
public void fileIsOpenWhenUsingAFileOutputStream() throws IOException { File file = FileUtils.newFile(TEST_FILE); START assertThat(FileUtils.isFileOpen(file), is(false)); END FileOutputStream outputStream = new FileOutputStream(file); assertThat(FileUtils.isFileOpen(file), is(true)); outputStream.close(); assertThat(FileUtils.isFileOpen(file), is(false)); } static importa

Target:
public void fileIsOpenWhenUsingAFileOutputStream() throws IOException { File file = newFile(TEST_FILE); assertThat(isFileOpen(file), is(false)); FileOutputStream outputStream = new FileOutputStream(file); assertThat(isFileOpen(file), is(true)); outputStream.close(); assertThat(isFileOpen(file), is(false)); }
Source:
private CoreEvent addContextToEvent(CoreEvent event, Context ctx) { START final CoreEvent eventWithContext; END if (ctx.hasKey(POLICY_NEXT_OPERATION)) { return quickCopy(event, singletonMap(INNER_CHAIN_CTX_MAPPING, (Function<Context, Context>) (innerChainCtx -> innerChainCtx .put(POLICY_NEXT_OPERATION, ctx.get(POLICY_NEXT_OPERATION))))); } else { return event; } } ![Code Smell](https://sonarsource.github.io/sonar-github/code_smell.png 'Code Smell') Code Smell: Remove this unused "eventWithContext" local variable. ([squid:S1481](https://sonarqube.kbuild.msap.io/coding_rules#rule_key=squid%3AS1481)) [See it in SonarQube](https://sonarqube.kbuild.msap.io/project/issues?id=mule-runtime-mule&pullRequest=7661&issues=AWjOiDKKotIXnmsUmtMc&open=AWjOiDKKotIXnmsUmtMc) [ISSUE_KEY]: AWjOiDKKotIXnmsUmtMc

Target:
private CoreEvent addContextToEvent(CoreEvent event, Context ctx) { if (ctx.hasKey(POLICY_NEXT_OPERATION)) { return quickCopy(event, singletonMap(INNER_CHAIN_CTX_MAPPING, (Function<Context, Context>) (innerChainCtx -> innerChainCtx .put(POLICY_NEXT_OPERATION, ctx.get(POLICY_NEXT_OPERATION))))); } else { return event; } }
Source:
public static boolean isOfType(DetailAST ast, int... types) { return ast != null START && Arrays.stream(types).anyMatch(tokenType -> tokenType == ast.getType()); END } please reuse function you wrote above

Target:
public static boolean isOfType(DetailAST ast, int... types) { return ast != null && isOfType(ast.getType(), types); }
Source:
public void visitToken(DetailAST arrayInit) { final DetailAST rcurly = arrayInit.findFirstToken(TokenTypes.RCURLY); final DetailAST previousSibling = rcurly.getPreviousSibling(); if (arrayInit.getChildCount() != 1 START && (alwaysDemandTrailingComma || !TokenUtil.areOnSameLine(rcurly, previousSibling)) && (alwaysDemandTrailingComma || !TokenUtil.areOnSameLine(arrayInit, previousSibling)) END && previousSibling.getType() != TokenTypes.COMMA) { log(previousSibling, MSG_KEY); } } I wonder if it would be easier/harder to read if pulling out `alwaysDemandTrailingComma`, e.g. ```java && (alwaysDemandTrailingComma || (!TokenUtil.areOnSameLine(rcurly, previousSibling) && !TokenUtil.areOnSameLine(arrayInit, previousSibling))) ```

Target:
public void visitToken(DetailAST arrayInit) { final DetailAST rcurly = arrayInit.findFirstToken(TokenTypes.RCURLY); final DetailAST previousSibling = rcurly.getPreviousSibling(); if (arrayInit.getChildCount() != 1 && (alwaysDemandTrailingComma || !TokenUtil.areOnSameLine(rcurly, previousSibling) && !TokenUtil.areOnSameLine(arrayInit, previousSibling)) && previousSibling.getType() != TokenTypes.COMMA) { log(previousSibling, MSG_KEY); } }
Source:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionMissingLeadingAsterisk.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingLeadingAsteriskCheck.class); final String[] expectedViolation = { START "3:1: " + getCheckMessage(JavadocStyleCheck.class, END MissingLeadingAsteriskCheck.MSG_MISSING_ASTERISK), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMissingLeadingAsterisk']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); } why `JavadocStyleCheck.class`?

Target:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionMissingLeadingAsterisk.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingLeadingAsteriskCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(MissingLeadingAsteriskCheck.class, MissingLeadingAsteriskCheck.MSG_MISSING_ASTERISK), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMissingLeadingAsterisk']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
private static boolean isColonOfCaseOrDefault(DetailAST colonAst) { START boolean result = false; final DetailAST parent = colonAst.getParent(); if (parent.getType() == TokenTypes.LITERAL_CASE || parent.getType() == TokenTypes.LITERAL_DEFAULT) { result = true; } return result; END } ```java boolean result = false; final DetailAST parent = colonAst.getParent(); if (parent.getType() == TokenTypes.LITERAL_CASE || parent.getType() == TokenTypes.LITERAL_DEFAULT) { result = true; } return result; ``` ----> ```java final DetailAST parent = colonAst.getParent(); return parent.getType() == TokenTypes.LITERAL_CASE || parent.getType() == TokenTypes.LITERAL_DEFAULT; ```

Target:
private static boolean isColonOfCaseOrDefault(DetailAST colonAst) { final DetailAST parent = colonAst.getParent(); return parent.getType() == TokenTypes.LITERAL_CASE || parent.getType() == TokenTypes.LITERAL_DEFAULT; }
Source:
public void testClassWithPrivateCtorAndNestedExtendingSubclass() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(FinalClassCheck.class); final String[] expected = { START "10:5: " + getCheckMessage(MSG_KEY, "B"), END "16:5: " + getCheckMessage(MSG_KEY, "C"), }; verify(checkConfig, getNonCompilablePath( "InputFinalClassClassWithPrivateCtorWithNestedExtendingClass.java"), expected); } we do not expect new violations. Can you explain why it appeared after you deleted package name from the class?

Target:
public void testClassWithPrivateCtorAndNestedExtendingSubclass() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(FinalClassCheck.class); final String[] expected = { "16:5: " + getCheckMessage(MSG_KEY, "C"), }; verify(checkConfig, getNonCompilablePath( "InputFinalClassClassWithPrivateCtorWithNestedExtendingClass.java"), expected); }
Source:
private boolean hasIgnoredModifiers(DetailAST modifiers) { final boolean isStatic = modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) != null; final boolean isFinal = modifiers.findFirstToken(TokenTypes.FINAL) != null; final boolean ignoredStatic = ignoreStatic && isStatic; final boolean ignoredFinal = ignoreFinal && isFinal; final boolean result; if (ignoreStaticFinal) { result = isStatic && isFinal || ignoredFinal || ignoredStatic; } else { result = ignoredFinal && !isStatic START || ignoredStatic && !isFinal; END } return result; } please simplify boolean expressions above. Here `ignoredStatic` and `ignoredFinal` contain `isStatic` and `isFinal` in their initialization.

Target:
private boolean hasIgnoredModifiers(DetailAST modifiers) { final boolean isStatic = modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) != null; final boolean isFinal = modifiers.findFirstToken(TokenTypes.FINAL) != null; final boolean result; if (isStatic && isFinal) { result = ignoreStaticFinal; } else { result = ignoreStatic && isStatic || ignoreFinal && isFinal; } return result; }
Source:
public void anotherMethod() { this.anonMethod(new AnonWithEmpty() { private int member; START @Override END public void fooEmpty() { this.member++; } }); } `@Override` this annotations is not needed in test inputs

Target:
public void anotherMethod() { this.anonMethod(new AnonWithEmpty() { private int member; public void fooEmpty() { this.member++; } }); }
Source:
private static int indexOfTypeParameter(List<DetailAST> typeParams, String requiredTypeName) { final Iterator<DetailAST> typeParamsIt = typeParams.iterator(); int paramIndex = -1; int index = 0; while (typeParamsIt.hasNext()) { START final DetailAST typeParam = typeParamsIt.next(); END if (typeParam.findFirstToken(TokenTypes.IDENT).getText() .equals(requiredTypeName)) { paramIndex = index; break; } index++; } return paramIndex; } Why isn't this a for each loop like the other method?

Target:
private static int indexOfTypeParameter(List<DetailAST> typeParams, String requiredTypeName) { int paramIndex = -1; int index = 0; for (DetailAST typeParam : typeParams) { if (typeParam.findFirstToken(TokenTypes.IDENT).getText() .equals(requiredTypeName)) { paramIndex = index; break; } index++; } return paramIndex; }
Source:
void test() { START Function<String, String> trimmer = s -> s.trim(); // warn END } Inputs between the 2 should be more unique. Please add a parenthesis around the lambda parameter like https://github.com/checkstyle/checkstyle/blob/3835575706d8240b3ec054d17ed48f692b168611/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/lambdaparametername/InputLambdaParameterName.java#L10 /

Target:
void test() { Function<String, String> trimmer = (s) -> s.trim(); // warn }
Source:
START public static boolean isTypeDef(DetailAST node) { END return node.getType() == TokenTypes.CLASS_DEF || node.getType() == TokenTypes.ENUM_DEF || node.getType() == TokenTypes.INTERFACE_DEF; } why public?

Target:
private static boolean isTypeDef(DetailAST node) { return node.getType() == TokenTypes.CLASS_DEF || node.getType() == TokenTypes.ENUM_DEF || node.getType() == TokenTypes.INTERFACE_DEF; }
Source:
public int compareOrder(NodeInfo other) { int result = 0; if (other instanceof ElementNode) { START result = getDepth() - ((AbstractNode) other).getDepth(); END if (result == 0) { final ElementNode[] children = getCommonAncestorChildren(other); result = children[0].indexAmongSiblings - children[1].indexAmongSiblings; } } return result; } We check instance to be ElementNode but do a cast to AbstractNode. Shouldn't both be the same class?

Target:
public int compareOrder(NodeInfo other) { int result = 0; if (other instanceof AbstractNode) { result = getDepth() - ((AbstractNode) other).getDepth(); if (result == 0) { final ElementNode[] children = getCommonAncestorChildren(other); result = children[0].indexAmongSiblings - children[1].indexAmongSiblings; } } return result; }
Source:
public void visitToken(final DetailAST ast) { if (!allowClassImports && ast.getType() == TokenTypes.IMPORT) { final DetailAST startingDot = ast.getFirstChild(); logsStarredImportViolation(startingDot); } else if (!allowStaticMemberImports) { // must navigate past the static keyword START final DetailAST startingDot = ast.getFirstChild().getNextSibling(); END logsStarredImportViolation(startingDot); } } Please generate regression report with `allowClassImports = true` and `allowStaticMemberImports = false`

Target:
public void visitToken(final DetailAST ast) { if (ast.getType() == TokenTypes.IMPORT) { if (!allowClassImports) { final DetailAST startingDot = ast.getFirstChild(); logsStarredImportViolation(startingDot); } } else if (!allowStaticMemberImports) { // must navigate past the static keyword final DetailAST startingDot = ast.getFirstChild().getNextSibling(); logsStarredImportViolation(startingDot); } }
Source:
public void visitToken(DetailAST arrayInit) { final DetailAST rcurly = arrayInit.findFirstToken(TokenTypes.RCURLY); final DetailAST previousSibling = rcurly.getPreviousSibling(); if (arrayInit.getChildCount() != 1 && !TokenUtil.areOnSameLine(rcurly, previousSibling) && !TokenUtil.areOnSameLine(arrayInit, previousSibling) && previousSibling.getType() != TokenTypes.COMMA) { START log(rcurly, MSG_KEY); END } } @romani @rnveach May be violation should be reported on last array item instead of rcurly?

Target:
public void visitToken(DetailAST arrayInit) { final DetailAST rcurly = arrayInit.findFirstToken(TokenTypes.RCURLY); final DetailAST previousSibling = rcurly.getPreviousSibling(); if (arrayInit.getChildCount() != 1 && !TokenUtil.areOnSameLine(rcurly, previousSibling) && !TokenUtil.areOnSameLine(arrayInit, previousSibling) && previousSibling.getType() != TokenTypes.COMMA) { log(previousSibling, MSG_KEY); } }
Source:
public int compareOrder(NodeInfo nodeInfo) { START int cmp = getLineNumber() - nodeInfo.getLineNumber(); END if (cmp == 0) { cmp = getColumnNumber() - nodeInfo.getColumnNumber(); if (cmp == 0) { cmp = getLocalPart().compareTo(nodeInfo.getLocalPart()); } } return cmp; } Rename it `result` to fix spelling failure

Target:
public int compareOrder(NodeInfo nodeInfo) { int result = getLineNumber() - nodeInfo.getLineNumber(); if (result == 0) { result = getColumnNumber() - nodeInfo.getColumnNumber(); if (result == 0) { result = getLocalPart().compareTo(nodeInfo.getLocalPart()); } } return result; }
Source:
private static boolean shouldCheckWhitespaceAfter(DetailAST ast) { boolean checkWhitespace = true; if (ast.getNextSibling() != null) { START final DetailAST sibling = ast.getNextSibling(); END if (sibling.getType() == TokenTypes.ANNOTATIONS) { checkWhitespace = false; } else if (sibling.getType() == TokenTypes.ARRAY_DECLARATOR) { checkWhitespace = sibling.getFirstChild().getType() != TokenTypes.ANNOTATIONS; } } return checkWhitespace; } please move this line outside of IF.

Target:
private static boolean shouldCheckWhitespaceAfter(DetailAST ast) { boolean checkWhitespace = true; final DetailAST sibling = ast.getNextSibling(); if (sibling != null) { if (sibling.getType() == TokenTypes.ANNOTATIONS) { checkWhitespace = false; } else if (sibling.getType() == TokenTypes.ARRAY_DECLARATOR) { checkWhitespace = sibling.getFirstChild().getType() != TokenTypes.ANNOTATIONS; } } return checkWhitespace; }
Source:
private static Set<String> getListById(Node subSection, String id) { final Node node = XmlUtil.findChildElementById(subSection, id); START assertNotNull(node, "Expected list element with id " + id); END return XmlUtil.getChildrenElements(node) .stream() .map(Node::getTextContent) .collect(Collectors.toSet()); } please remove this assert, it is util method, it should just do some job.

Target:
private static Set<String> getListById(Node subSection, String id) { Set<String> result = null; final Node node = XmlUtil.findChildElementById(subSection, id); if (node != null) { result = XmlUtil.getChildrenElements(node) .stream() .map(Node::getTextContent) .collect(Collectors.toSet()); } return result; }
Source:
public void testNonExistentArgument(@SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { systemErr.capture(); START systemOut.capture(); END JavadocPropertiesGenerator.main("--nonexistent-argument"); final String expected = String.format(Locale.ROOT, "Missing required options " + "[--destfile=<outputFile>, params[0]=<inputFile>]%n") + USAGE; assertEquals(expected, systemErr.getCapturedData(), "Unexpected error log"); assertEquals("", systemOut.getCapturedData(), "Unexpected output log"); } ``` systemErr.capture(); systemOut.capture(); ``` looks like these lines are duplicated many times. May be extract them to some method with `@BeforeEach ` annotation?

Target:
public void testNonExistentArgument(@SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { JavadocPropertiesGenerator.main("--nonexistent-argument"); final String expected = String.format(Locale.ROOT, "Missing required options " + "[--destfile=<outputFile>, params[0]=<inputFile>]%n") + USAGE; assertEquals(expected, systemErr.getCapturedData(), "Unexpected error log"); assertEquals("", systemOut.getCapturedData(), "Unexpected output log"); }
Source:
public void testLocaleIsSupported() { final String language = DEFAULT_LOCALE.getLanguage(); START if (!Locale.ROOT.getLanguage().equals(language) END && !Locale.ENGLISH.getLanguage().equals(language)) { final LocalizedMessage localizedMessage = createSampleLocalizedMessage(); assertThat("Unsupported language: " + DEFAULT_LOCALE, localizedMessage.getMessage(), not("Empty statement.")); } } I think check for `language.isEmpty()` is better , as will be same as in other tests, so it will look like a family

Target:
public void testLocaleIsSupported() { final String language = DEFAULT_LOCALE.getLanguage(); if (!language.isEmpty() && !Locale.ENGLISH.getLanguage().equals(language)) { final LocalizedMessage localizedMessage = createSampleLocalizedMessage(); assertThat("Unsupported language: " + DEFAULT_LOCALE, localizedMessage.getMessage(), not("Empty statement.")); } }
Source:
private boolean isMessageMatch(AuditEvent event) { final boolean match; if (eventMessageRegexp == null) { match = true; START } END else { final Matcher messageMatcher = eventMessageRegexp.matcher(event.getMessage()); match = messageMatcher.find(); } return match; } Please make it like `boolean match = true;` and test `eventMessageRegexp != null`

Target:
private boolean isMessageMatch(AuditEvent event) { boolean match = true; if (eventMessageRegexp != null) { final Matcher messageMatcher = eventMessageRegexp.matcher(event.getMessage()); match = messageMatcher.find(); } return match; }
Source:
private static DetailAST getLastLambdaToken(DetailAST lambda) { DetailAST node = lambda.getLastChild(); while (node.getLastChild() != null) { node = node.getLastChild(); START } END return node; } Would the code be cleaner with ```` DetailAST node = lambda; do { node = node.getLastChild(); } while (node.getLastChild() != null); ```` ?

Target:
private static DetailAST getLastLambdaToken(DetailAST lambda) { DetailAST node = lambda; do { node = node.getLastChild(); } while (node.getLastChild() != null); return node; }
Source:
public boolean isMatch(TreeWalkerAuditEvent event) { boolean match = false; if (isInScopeOfSuppression(event)) { START if (isCheckMatch(event)) { END match = isMessageMatch(event); } else if (isIdMatch(event)) { match = isMessageMatch(event); } } return match; } It could be `match = isInScopeOfSuppression(event) && isMessageMatch(event) (isCheckMatch(event) || isIdMatch(event));`

Target:
public boolean isMatch(TreeWalkerAuditEvent event) { return isInScopeOfSuppression(event) && (isCheckMatch(event) || isIdMatch(event)) && isMessageMatch(event); }
Source:
private static boolean hasUnbracedStatements(DetailAST ast) { final DetailAST nextSibling = ast.getNextSibling(); return nextSibling != null && nextSibling.getType() == TokenTypes.SLIST START && !"{".equals(nextSibling.getFirstChild().getText()); END } This can be ``` return nextSibling != null && nextSibling.getType() == TokenTypes.SLIST && nextSibling.getFirstChild().getType() != TokenTypes.SLIST; ```

Target:
private static boolean hasUnbracedStatements(DetailAST ast) { final DetailAST nextSibling = ast.getNextSibling(); return nextSibling != null && nextSibling.getType() == TokenTypes.SLIST && nextSibling.getFirstChild().getType() != TokenTypes.SLIST; }
Source:
private static boolean shouldBeAloneOnLineWithAloneOrSinglelineOption(Details details, String targetSrcLine) { return !isAloneOnLine(details, targetSrcLine) && !isEmptyBody(details.lcurly) START && !isSingleLineBlock(details); END } This is no longer re-ordered so I am assume it was resolved.

Target:
private static boolean shouldBeAloneOnLineWithAloneOrSinglelineOption(Details details, String targetSrcLine) { return !isAloneOnLine(details, targetSrcLine) && !isSingleLineBlock(details) && !isEmptyBody(details.lcurly); }
Source:
public int[] getAcceptableTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.PACKAGE_DEF, TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.ENUM_DEF, START TokenTypes.METHOD_DEF, END TokenTypes.CTOR_DEF, TokenTypes.VARIABLE_DEF, TokenTypes.PARAMETER_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.TYPECAST, TokenTypes.LITERAL_THROWS, TokenTypes.IMPLEMENTS_CLAUSE, TokenTypes.TYPE_ARGUMENT, TokenTypes.LITERAL_NEW, TokenTypes.DOT, TokenTypes.ANNOTATION_FIELD_DEF, }; } @pbludov @romani Any reasons why these shouldn't be default?

Target:
public int[] getAcceptableTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.PACKAGE_DEF, TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.ENUM_DEF, TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF, TokenTypes.VARIABLE_DEF, TokenTypes.PARAMETER_DEF, TokenTypes.ANNOTATION_DEF, TokenTypes.ANNOTATION_FIELD_DEF, }; }
Source:
public boolean accept(TreeWalkerAuditEvent treeWalkerAuditEvent) { START final XpathFilter xpathFilter = getXpathFilter(); END return xpathFilter.accept(treeWalkerAuditEvent); } We should only create the inner filter once and re-use the same one. Accept is called for every file, so this will cause an unnecessary slowdown just to recreate the instance over and over. Please remove `getXpathFilter` and move all code to `finishLocalSetup` and assign it to a field.

Target:
public boolean accept(TreeWalkerAuditEvent treeWalkerAuditEvent) { return xpathFilter.accept(treeWalkerAuditEvent); }
Source:
private void visitTypeDef(DetailAST typeDef) { if (isVerifiable(typeDef)) { START checkIdent(typeDef.findFirstToken(TokenTypes.IDENT)); END checkTypeParameters(typeDef); final DetailAST extendsClause = typeDef.findFirstToken(TokenTypes.EXTENDS_CLAUSE); if (extendsClause != null) { checkBaseTypes(extendsClause); } final DetailAST implementsClause = typeDef.findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE); if (implementsClause != null) { checkBaseTypes(implementsClause); } } } Issue says we are just checking `extends` and `implements`. Don't these 2 lines do more than that? I see the content of your issue went with Class name too, but the issue title doesn't agree too. @romani Should `IllegalType` really extend to defined class names too?

Target:
private void visitTypeDef(DetailAST typeDef) { if (isVerifiable(typeDef)) { checkTypeParameters(typeDef); final DetailAST extendsClause = typeDef.findFirstToken(TokenTypes.EXTENDS_CLAUSE); if (extendsClause != null) { checkBaseTypes(extendsClause); } final DetailAST implementsClause = typeDef.findFirstToken(TokenTypes.IMPLEMENTS_CLAUSE); if (implementsClause != null) { checkBaseTypes(implementsClause); } } }
Source:
private static void fillChecksFromModifierPackage() { NAME_TO_FULL_MODULE_NAME.put("ModifierOrderCheck", BASE_PACKAGE + ".checks.modifier.ModifierOrderCheck"); NAME_TO_FULL_MODULE_NAME.put("RedundantModifierCheck", BASE_PACKAGE + ".checks.modifier.RedundantModifierCheck"); NAME_TO_FULL_MODULE_NAME.put("InterfaceMemberImpliedModifierCheck", START BASE_PACKAGE + ".checks.modifier.InterfaceMemberImpliedModifierCheck"); END } please order the checks alphabetically.

Target:
private static void fillChecksFromModifierPackage() { NAME_TO_FULL_MODULE_NAME.put("InterfaceMemberImpliedModifierCheck", BASE_PACKAGE + ".checks.modifier.InterfaceMemberImpliedModifierCheck"); NAME_TO_FULL_MODULE_NAME.put("ModifierOrderCheck", BASE_PACKAGE + ".checks.modifier.ModifierOrderCheck"); NAME_TO_FULL_MODULE_NAME.put("RedundantModifierCheck", BASE_PACKAGE + ".checks.modifier.RedundantModifierCheck"); }
Source:
protected static DefaultConfiguration createRootConfig(Configuration config) { final DefaultConfiguration dc = new DefaultConfiguration(ROOT_MODULE_NAME); START if (config != null) { END dc.addChild(config); } return dc; } why check for null become required, you do not pass null at AbstractXpathRegressionTest

Target:
protected static DefaultConfiguration createRootConfig(Configuration config) { final DefaultConfiguration dc = new DefaultConfiguration(ROOT_MODULE_NAME); dc.addChild(config); return dc; }
Source:
START public ParseErrorMessage(int lineNumber, String messageKey, Object... messageArguments) { END this.lineNumber = lineNumber; this.messageKey = messageKey; this.messageArguments = messageArguments.clone(); } Why should this be `public`? Now anyone can instantiate this class as the class is public and the constructor is public.

Target:
/* default */ ParseErrorMessage(int lineNumber, String messageKey, Object... messageArguments) { this.lineNumber = lineNumber; this.messageKey = messageKey; this.messageArguments = messageArguments.clone(); }
Source:
private String getHeaderLine(int headerLineNo) { START String header = getHeaderLines().get(headerLineNo); END if (header.isEmpty()) { header = EMPTY_LINE_PATTERN; } return header; } please name it as `line` ,as term header we use for block of lines.

Target:
private String getHeaderLine(int headerLineNo) { String line = getHeaderLines().get(headerLineNo); if (line.isEmpty()) { line = EMPTY_LINE_PATTERN; } return line; }
Source:
private void loadHeader(final Reader headerReader) throws IOException { final LineNumberReader lnr = new LineNumberReader(headerReader); try { while (true) { START final String line = lnr.readLine(); END if (line == null) { break; } readerLines.add(line); } postProcessHeaderLines(); } finally { Closeables.closeQuietly(lnr); } } please refactor code a bit more like: ``` do{ String line = lnr.readLine(); if (line != null) { readerLines.add(line); } } while (line != null) ```

Target:
private void loadHeader(final Reader headerReader) throws IOException { final LineNumberReader lnr = new LineNumberReader(headerReader); try { String line; do { line = lnr.readLine(); if (line != null) { readerLines.add(line); } } while (line != null); postProcessHeaderLines(); } finally { Closeables.closeQuietly(lnr); } }
Source:
public void testHeaderIsValidWithBlankLines() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.blank-lines.header")); START checkConfig.addAttribute("ignoreLines", ""); END verify(checkConfig, getPath("InputHeaderBlankLines.java")); } http://checkstyle.sourceforge.net/config_header.html#Header ignoreLines are empty by default, why mention it here ?

Target:
public void testHeaderIsValidWithBlankLines() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.blank-lines.header")); verify(checkConfig, getPath("InputHeaderBlankLines.java")); }
Source:
START public static void syncDishImage(ArrayList<Dish> dishList) { END if (dishList == null) { return; } for (Dish dish : dishList) { String imgUrl = getRequestUrl(null, dish.getImageServer()); String imgName = dish.getImageServer().split("/", 2)[1]; String filePath = getLocalFileStorageUrl("", imgName); RequestHelper.getFileFromServer(imgUrl, null, filePath); dish.setImageLocal(filePath); } } keep return type as boolean and return the same value as RequestHelper.getFileFromServer

Target:
public static boolean syncDishImage(ArrayList<Dish> dishList) { if (dishList == null) { return true; } for (Dish dish : dishList) { String imgUrl = getRequestUrl(null, dish.getImageServer()); String imgName = dish.getImageServer().split("/", 2)[1]; String filePath = getLocalFileStorageUrl("", imgName); RequestHelper.getFileFromServer(imgUrl, null, filePath); dish.setImageLocal(filePath); } return true; }
Source:
START synchronized public static OrderManager getInstance() { END return sInstance; } why need synchonized?

Target:
public static OrderManager getInstance() { return sInstance; }
Source:
public void onCreate(Bundle savedInstanceState) { START if (DEVELOPER_MODE) { END StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads() .detectDiskWrites().detectNetwork().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectAll().penaltyLog().penaltyDeath().build()); } super.onCreate(savedInstanceState); // Initial all the data needed initData(); // Initial the UI manually. initUi(); } I think we could only just set the StrictMode in Application.

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initial all the data needed initData(); // Initial the UI manually. initUi(); }
Source:
START public String getRequestUrl(String reqContext, String page) { END if (reqContext == null) { reqContext = DEFAULT_URL + DEFAULT_APP; } return reqContext + "/" + page; } why not make these tool methods as static?

Target:
public static String getRequestUrl(String reqContext, String page) { if (reqContext == null) { reqContext = DEFAULT_URL + DEFAULT_APP; } return reqContext + "/" + page; }
Source:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { // now that the service should be available, build the required source HaleConnectService hcs = getServiceProvider().getService(HaleConnectService.class); // TODO login if applicable? (based on reader parameters) // XXX for now only support public projects LocatableInputSupplier<? extends InputStream> hcSource; try { hcSource = hcs.loadProject(owner, projectId); } catch (HaleConnectException e) { START throw new IllegalStateException(); END } super.setSource(hcSource); return super.execute(progress, reporter); } Should we add the cause here? ```suggestion throw new IllegalStateException(e.getMessage(), e); ```

Target:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { // now that the service should be available, build the required source HaleConnectService hcs = getServiceProvider().getService(HaleConnectService.class); // TODO login if applicable? (based on reader parameters) // XXX for now only support public projects LocatableInputSupplier<? extends InputStream> hcSource; try { hcSource = hcs.loadProject(owner, projectId); } catch (HaleConnectException e) { throw new IllegalStateException(e.getMessage(), e); } super.setSource(hcSource); return super.execute(progress, reporter); }
Source:
public boolean isPassthrough() { if (isThresholdConfigured()) { InstanceCollectionPartitioner partitioner = getPartitioner(this, SimpleLog.NO_LOG); return !partitioner.usesReferences(); } START else if (isPartitionByFeatureTypeConfigured()) { END return false; } else { return true; } } So `isThresholdConfigured()` and `isPartitionByFeatureTypeConfigured()` cannot be true at the same time? Otherwise I would move the `isPartitionByFeatureTypeConfigured()` condition to be the first check.

Target:
public boolean isPassthrough() { if (isPartitionByFeatureTypeConfigured()) { return false; } else if (isThresholdConfigured()) { InstanceCollectionPartitioner partitioner = getPartitioner(this, SimpleLog.NO_LOG); return !partitioner.usesReferences(); } else { return true; } }
Source:
public boolean isEmpty() { START return size > 0; END } This seems wrong

Target:
public boolean isEmpty() { return size == 0; }
Source:
protected DriverConfiguration create(String elementId, IConfigurationElement element) { if (element.getName().equals("driver")) { DriverConfiguration driverConfiguration = new DriverConfiguration(elementId, element); START if (!driverConfiguration.isFileBased()) END return driverConfiguration; } return null; } The DriverConfiguration fullfills more purposes than just the Driver listing in the UI. Wouldn't it make more sense to just hide file based drivers in the UI?

Target:
protected DriverConfiguration create(String elementId, IConfigurationElement element) { if (element.getName().equals("driver")) { return new DriverConfiguration(elementId, element); } return null; }
Source:
public void setWindingOrder(EnumWindingOrderTypes windingOrderType) { START setParameter(PARAM_UNIFY_WINDING_ORDER, Value.of(windingOrderType)); END } Note that you can only do that here because the enum value returns its name in `toString()`. Thus it is OK to be treated as a simple value.

Target:
public void setWindingOrder(EnumWindingOrderTypes windingOrderType) { setParameter(PARAM_UNIFY_WINDING_ORDER, Value.of(windingOrderType.toString())); }
Source:
public static boolean isCounterClockwise(Geometry geometry) { if (geometry == null) return false; // Get coordinates of geometry Coordinate[] coordinates = geometry.getCoordinates(); // Using algorithm get order of geometry boolean orientation = false; try { orientation = CGAlgorithms.isCCW(coordinates); } catch (IllegalArgumentException ex) { START System.err.println("Illegal Argument"); END // TODO:: or Throw ? } return orientation; } It makes sense to propagate the exception instead of silently ignoring it. Otherwise you will return information that was not checked in any way. Thus a caller would never be sure if the result from the `isCounterClockwise` is correct or if there was an internal error.

Target:
public static boolean isCounterClockwise(Geometry geometry) { if (geometry == null) return false; // Get coordinates of geometry Coordinate[] coordinates = geometry.getCoordinates(); // Get order of geometry using algorithm boolean orientation = false; orientation = CGAlgorithms.isCCW(coordinates); return orientation; }
Source:
private boolean isNestedSingleResourceBinaryModule() { START if( module.length > 1 && all.length == 1 && all[0] instanceof IModuleFile) { END return true; } return false; } what do you think to write it return module.length > 1 && all.length == 1 && all[0] instanceof IModuleFile;

Target:
private boolean isNestedSingleResourceBinaryModule() { return module.length > 1 && all.length == 1 && all[0] instanceof IModuleFile; }
Source:
public IConnectionWrapper getConnection() throws CoreException { START HashMap<String,String> map = new HashMap<String,String>(); END map.put(DefaultConnectionProvider.ID, name); map.put(DefaultConnectionProvider.URL, url); map.put(DefaultConnectionProvider.USERNAME, userName); map.put(DefaultConnectionProvider.PASSWORD, password); IConnectionProvider provider = ExtensionManager.getProvider(DefaultConnectionProvider.PROVIDER_ID); return provider.createConnection(map); } Optional: can be written in a more compact way: Map<String,String> map = new HashMap<>();

Target:
public IConnectionWrapper getConnection() throws CoreException { Map<String,String> map = new HashMap<>(); map.put(DefaultConnectionProvider.ID, name); map.put(DefaultConnectionProvider.URL, url); map.put(DefaultConnectionProvider.USERNAME, userName); map.put(DefaultConnectionProvider.PASSWORD, password); IConnectionProvider provider = ExtensionManager.getProvider(DefaultConnectionProvider.PROVIDER_ID); return provider.createConnection(map); }
Source:
public JMXConnectionTypeFragment() { providerMap = UIExtensionManager.getConnectionUIElements(); START childFragmentMap = new HashMap<String, WizardFragment>(); END } Optional more compact way should be possible childFragmentMap = new HashMap<>(); BTW, why not creating it directly on the attribute instead of the constructor?

Target:
public JMXConnectionTypeFragment() { providerMap = UIExtensionManager.getConnectionUIElements(); childFragmentMap = new HashMap<>(); }
Source:
protected String getLaunchCommand(JBossServer jbossServer) throws CoreException { String programArguments = getLaunchProgramArgs(); String vmArguments = getLaunchVMArgs(); String jar = getJar(jbossServer.getServer()); START String command = "java " + vmArguments + " -jar " + jar + " " + IJBossRuntimeConstants.SPACE + programArguments + "&"; END return command; } `" " + IJBossRuntimeConstants.SPACE` that's 2 spaces right?

Target:
protected String getLaunchCommand(JBossServer jbossServer) throws CoreException { String programArguments = getLaunchProgramArgs(); String vmArguments = getLaunchVMArgs(); String jar = getJar(jbossServer.getServer()); String command = "java " + vmArguments + " -jar " + jar + IJBossRuntimeConstants.SPACE + programArguments + "&"; return command; }
Source:
START public static void register() { END try { final DeploymentStructureChangeListener listener = new DeploymentStructureChangeListener(); final IWorkspace ws = ResourcesPlugin.getWorkspace(); ws.addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_BUILD); } catch(Exception e) { ClasspathCorePlugin.log("Unable to add jboss-deployment-structure.xml change listener", e); } } and no deregister?

Target:
public static void register() { try { listener = new DeploymentStructureChangeListener(); final IWorkspace ws = ResourcesPlugin.getWorkspace(); ws.addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_BUILD); } catch(Exception e) { ClasspathCorePlugin.log("Unable to add jboss-deployment-structure.xml change listener", e); } }
Source:
protected char getSeparatorCharacter(IServer server) { // Discover the proper separator character for the paths being used char sep = File.separatorChar; START IControllableServerBehavior beh = JBossServerBehaviorUtils.getControllableBehavior(server); END if( beh != null ) { try { IDeploymentOptionsController cont = (IDeploymentOptionsController)beh.getController(IDeploymentOptionsController.SYSTEM_ID); if( cont != null ) { sep = cont.getPathSeparatorCharacter(); } } catch(CoreException ce) { // Ignore } } return sep; } How about reducing the code by calling getController instead? See https://github.com/jbosstools/jbosstools-server/blob/master/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/core/util/JBossServerBehaviorUtils.java#L63

Target:
protected char getSeparatorCharacter(IServer server) { // Discover the proper separator character for the paths being used try { IDeploymentOptionsController cont = (IDeploymentOptionsController)JBossServerBehaviorUtils.getController(server, IDeploymentOptionsController.SYSTEM_ID, IDeploymentOptionsController.class); return cont == null ? File.separatorChar : cont.getPathSeparatorCharacter(); } catch(CoreException ce) { // Ignore } return File.separatorChar; }
Source:
private int removeModule(IModule[] module, IProgressMonitor monitor) throws CoreException { START IControllableServerBehavior beh = JBossServerBehaviorUtils.getControllableBehavior(getServer()); END if( beh != null ) { IPublishController pc = (IPublishController)beh.getController(IPublishController.SYSTEM_ID); if( pc instanceof IPrimaryPublishController) { return ((IPrimaryPublishController)pc).removeModule(module, monitor); } } return IServer.PUBLISH_STATE_UNKNOWN; } can't you reuse the server instance you collected in publishModule()?

Target:
private int removeModule(IModule[] module, IProgressMonitor monitor) throws CoreException { IPrimaryPublishController pc = JBossServerBehaviorUtils.getController(getServer(), IPublishController.SYSTEM_ID, IPrimaryPublishController.class); if( pc != null) { return pc.removeModule(module, monitor); } return IServer.PUBLISH_STATE_UNKNOWN; }
Source:
START public static String implodeStrings(String[] strings) { END StringBuffer buffer = new StringBuffer(); for( int i = 0; i < strings.length; i++ ) buffer.append(strings[i]).append(','); return buffer.toString(); } this doesn't belong here. If we don't have a generic concatenation method available in foundation already, then either use [StringUtils.join from commons-lang](https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#join%28java.lang.Object[]%29) or [Joiner from guava](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Joiner.html)

Target:
public static String implodeStrings(String[] strings) { StringBuilder buffer = new StringBuilder(); for( int i = 0; i < strings.length; i++ ) buffer.append(strings[i]).append(','); return buffer.toString(); }
Source:
public void performCancel(IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); START trackNewServerEvent(UsageEventType.FAILED_VALUE); END } we should not use constants for these values. Better to have a method return value as otherwise everything have to be recompiled to pick up a possible change

Target:
public void performCancel(IProgressMonitor monitor) throws CoreException { super.performCancel(monitor); trackNewServerEvent(0); }
Source:
private IModuleResource[] getCleanedChildren(IModuleResource[] children) { // Depth-first cleaning START ArrayList<IModuleResource> cleaned = new ArrayList<IModuleResource>(); END IModuleResource tmp = null; for( int i = 0; i < children.length; i++ ) { tmp = getCleanedResource(children[i]); if( tmp != null ) cleaned.add(tmp); } return cleaned.toArray(new IModuleResource[cleaned.size()]); } Should initialize list size with children.length

Target:
private IModuleResource[] getCleanedChildren(IModuleResource[] children) { // Depth-first cleaning ArrayList<IModuleResource> cleaned = new ArrayList<IModuleResource>(children.length); IModuleResource tmp = null; for( int i = 0; i < children.length; i++ ) { tmp = getCleanedResource(children[i]); if( tmp != null ) cleaned.add(tmp); } return cleaned.toArray(new IModuleResource[cleaned.size()]); }
Source:
public boolean canRestartModule(IModule[] module) { START if( module.length == 1 ) END return true; return false; } should module[0] == null be considered?

Target:
public boolean canRestartModule(IModule[] module) { if( module.length == 1 && module[0] != null) return true; return false; }
Source:
protected IModule promptForModule(ArrayList<IModule> modules) { if(modules.size() == 1 ) return modules.get(0); // TODO prompt START return modules.get(0); END } protected method, IndexOutOfBoundException friendly

Target:
protected IModule promptForModule(ArrayList<IModule> modules) { if( modules.size() > 0 ) { if(modules.size() == 1 ) return modules.get(0); // TODO prompt. Unfortunately there's no easy way to do this in UI // Since there's no prompt-for-module dialogs in wtp, // and it is unclear what type of ui should be designed return modules.get(0); } return null; }
Source:
protected synchronized void forceStop() { START System.out.println("Stopping in forcestop"); //$NON-NLS-1$ END // just terminate the process. if( isProcessRunning()) { try { process.terminate(); addForceStopEvent(); } catch( DebugException e ) { addForceStopFailedEvent(e); } } process = null; getActualBehavior().setServerStopped(); nextStopRequiresForce = false; } no system out please - use tracing.

Target:
protected synchronized void forceStop() { // just terminate the process. if( isProcessRunning()) { try { process.terminate(); addForceStopEvent(); } catch( DebugException e ) { addForceStopFailedEvent(e); } } process = null; getActualBehavior().setServerStopped(); nextStopRequiresForce = false; }
Source:
private synchronized void handleProcessTerminatedEvent(ProcessTerminatedDebugListener listener) { // If there's a new process that's not equal to myProcess, // then the server is already starting again if( listener.myProcess != null && !listener.myProcess.equals(getProcess())) return; START System.out.println(getProcess()); END if( getServer().getServerState() != IServer.STATE_STOPPED) { stopPolling(); addProcessTerminatedEvent(); getActualBehavior().setServerStopped(); } DebugPlugin.getDefault().removeDebugEventListener(listener); processListener = null; process = null; nextStopRequiresForce = false; } more unnecesaary println

Target:
private synchronized void handleProcessTerminatedEvent(ProcessTerminatedDebugListener listener) { // If there's a new process that's not equal to myProcess, // then the server is already starting again if( listener.myProcess != null && !listener.myProcess.equals(getProcess())) return; if( getServer().getServerState() != IServer.STATE_STOPPED) { stopPolling(); addProcessTerminatedEvent(); getActualBehavior().setServerStopped(); } DebugPlugin.getDefault().removeDebugEventListener(listener); processListener = null; process = null; nextStopRequiresForce = false; }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (MapzenApplication) getApplication(); app.inject(this); BugSenseHandler.initAndStartSession(this, "ebfa8fd7"); BugSenseHandler.addCrashExtraData("OEM", Build.MANUFACTURER); START app = (MapzenApplication) getApplication(); END setContentView(R.layout.base); initMapFragment(); gpsPromptDialogFragment = new MapzenGPSPromptDialogFragment(); initMapController(); initLocationClient(); initAlarm(); initSavedSearches(); } looks like a bad merge ... assigning app is already included above.

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (MapzenApplication) getApplication(); app.inject(this); BugSenseHandler.initAndStartSession(this, "ebfa8fd7"); BugSenseHandler.addCrashExtraData("OEM", Build.MANUFACTURER); setContentView(R.layout.base); initMapFragment(); gpsPromptDialogFragment = new MapzenGPSPromptDialogFragment(); initMapController(); initLocationClient(); initAlarm(); initSavedSearches(); }