Examples of Fix


Examples of com.google.errorprone.fixes.Fix

     * Fixes instances of calling toString() on an array.  If the array is the result of calling
     * e.getStackTrace(), replaces e.getStackTrace().toString() with Guava's
     * Throwables.getStackTraceAsString(e).
     * Otherwise, replaces a.toString() with Arrays.toString(a).
     */
    Fix fix;

    ExpressionTree receiverTree = ASTHelpers.getReceiver(methodTree);
    if (receiverTree instanceof MethodInvocationTree &&
        getStackTraceMatcher.matches((MethodInvocationTree) receiverTree, state)) {
      String throwable = ASTHelpers.getReceiver(receiverTree).toString();
View Full Code Here

Examples of com.google.errorprone.fixes.Fix

    ExpressionTree lhs = ASTHelpers.getReceiver(methodInvocationTree);
    ExpressionTree rhs = methodInvocationTree.getArguments().get(0);
   
    // default fix for methods
    Fix fix = SuggestedFix.delete(parent);
    if (methodSelect(instanceMethod(Matchers.<ExpressionTree>anything(), "removeAll"))
        .matches(methodInvocationTree, state)) {
      fix = SuggestedFix.replace(methodInvocationTree, lhs + ".clear()");
    }
View Full Code Here

Examples of com.google.errorprone.fixes.Fix

    }

    if (!locks.allLocks().contains(guard)) {
      String message = String.format("Expected %s to be held, instead found %s", guard, locks);
      // TODO(user) - this fix is a debugging aid, remove it before productionizing the check.
      Fix fix = SuggestedFix.prefixWith(tree, String.format("/* %s */", message));
      return Description.builder(tree, pattern)
          .setMessage(message)
          .addFix(fix)
          .build();
    }
View Full Code Here

Examples of com.google.errorprone.fixes.Fix

    if (arrayMatcher.matches(t.getLeftOperand(), state)) {
      replacement = "Arrays.toString(" + leftOperand + ") + " + rightOperand;
    } else {
      replacement = leftOperand + " + Arrays.toString(" + rightOperand + ")";
    }
    Fix fix = SuggestedFix.builder()
        .replace(t, replacement)
        .addImport("java.util.Arrays")
        .build();
    return describeMatch(t, fix);
  }
View Full Code Here

Examples of com.google.errorprone.fixes.Fix

    if (matchState == MatchState.NONE) {
      throw new IllegalStateException("describe() called without a match");
    }

    // If we don't find a good field to use, then just replace with "true"
    Fix fix = SuggestedFix.replace(methodInvocationTree, "true");

    if (matchState == MatchState.OBJECTS_EQUAL) {
      /**
       * Cases:
       *    1) Objects.equal(foo, foo) ==> Objects.equal(foo, other.foo)
View Full Code Here

Examples of me.taylorkelly.bigbrother.fixes.Fix

        } else if (!getDataFolder().exists()) {
            getDataFolder().mkdirs();
        }

        // Apply fixes to DB for old BB
        Fix fix = new Fix1(getDataFolder());
        fix.apply();
        Fix fix2 = new Fix2(getDataFolder());
        fix2.apply();
        Fix fix3 = new Fix3(getDataFolder()); // 26 Feb
        fix3.apply();
        Fix fix4 = new Fix4(getDataFolder()); // 5 March, 2011 - N3X
        fix4.apply();
        Fix fix5 = new Fix5(getDataFolder()); // 24 March, 2011 - N3X
        fix5.apply();

        // Initialize Permissions, Help
        BBPermissions.initialize(getServer());
        BBHelp.initialize(this);
View Full Code Here

Examples of org.netbeans.spi.editor.hints.Fix

        if (("\"" + LyParser.lilyVersion + "\"").equals(doc.version)) {
            return;
        }
        try {
            Fix fix = new Fix() {

                public String getText() {
                    return "click here to upgrade version";
                }
View Full Code Here

Examples of org.netbeans.spi.editor.hints.Fix

    public void valueChanged(ListSelectionEvent lse) {
        JList list = (JList) lse.getSource();
        Object selectedValue = list.getSelectedValue();
       
        if (TextToSpeechOptions.isScreenReading() && selectedValue != null && selectedValue instanceof Fix) {
            Fix f = (Fix)selectedValue;
            speech.speak(f.getText(), SpeechPriority.MEDIUM_HIGH);
        }
    }
View Full Code Here

Examples of org.netbeans.spi.editor.hints.Fix

                                list.addComponentListener(EditorHintsListener.getInstance());

                                // Attempt to speak selection.
                                Object selectedValue = list.getSelectedValue();
                                if (TextToSpeechOptions.isScreenReading() && selectedValue != null && selectedValue instanceof Fix) {
                                    Fix f = (Fix) selectedValue;
                                    speech.speak(f.getText(), SpeechPriority.MEDIUM_HIGH);
                                }
                            } else {
                                if (TextToSpeechOptions.isScreenReading()) {
                                    speech.speak("Editor hints closing", SpeechPriority.MEDIUM_HIGH);
                                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.