Skip to content

Commit

Permalink
better name for static method newOne -> of
Browse files Browse the repository at this point in the history
  • Loading branch information
bulenkov committed Jun 1, 2014
1 parent b97e528 commit 80ea2b9
Show file tree
Hide file tree
Showing 102 changed files with 283 additions and 282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean process(VirtualFile file, ImageInfoIndex.ImageInfo value) {
}
}, project);

return s[0] == null ? null : Couple.newOne(file.getName(), s[0]);
return s[0] == null ? null : Couple.of(file.getName(), s[0]);
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ private void loadProfilesFromOldFormat(Element processing) {
continue;
}
final String dir = moduleElement.getAttributeValue("generatedDirName", (String)null);
modulesToProcess.add(Couple.newOne(name, dir));
modulesToProcess.add(Couple.of(name, dir));
}

myDefaultProcessorsProfile.setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public BuildPropertiesImpl(Project project, final GenerationOptions genOptions)
javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "jgoodies-forms.jar")));
add(javac2);
//noinspection HardCodedStringLiteral
register.add(new Tag("taskdef", Couple.newOne("name", "javac2"), Couple.newOne("classname", "com.intellij.ant.Javac2"),
Couple.newOne("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
register.add(new Tag("taskdef", Couple.newOne("name", "instrumentIdeaExtensions"),
Couple.newOne("classname", "com.intellij.ant.InstrumentIdeaExtensions"),
Couple.newOne("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
register.add(new Tag("taskdef", Couple.of("name", "javac2"), Couple.of("classname", "com.intellij.ant.Javac2"),
Couple.of("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
register.add(new Tag("taskdef", Couple.of("name", "instrumentIdeaExtensions"),
Couple.of("classname", "com.intellij.ant.InstrumentIdeaExtensions"),
Couple.of("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
}
if (customCompilers.length > 0) {
for (ChunkCustomCompilerExtension ext : customCompilers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public CompileModuleChunkTarget(final Project project,
GenerationOptions genOptions) {
final String moduleChunkName = moduleChunk.getName();
//noinspection HardCodedStringLiteral
final Tag compilerArgs = new Tag("compilerarg", Couple.newOne("line", BuildProperties.propertyRef(
final Tag compilerArgs = new Tag("compilerarg", Couple.of("line", BuildProperties.propertyRef(
BuildProperties.getModuleChunkCompilerArgsProperty(moduleChunkName))));
//noinspection HardCodedStringLiteral
final Couple<String> classpathRef = Couple.newOne("refid", BuildProperties.getClasspathProperty(moduleChunkName));
final Couple<String> classpathRef = Couple.of("refid", BuildProperties.getClasspathProperty(moduleChunkName));
final Tag classpathTag = new Tag("classpath", classpathRef);
//noinspection HardCodedStringLiteral
final Tag bootclasspathTag =
new Tag("bootclasspath", Couple.newOne("refid", BuildProperties.getBootClasspathProperty(moduleChunkName)));
new Tag("bootclasspath", Couple.of("refid", BuildProperties.getBootClasspathProperty(moduleChunkName)));
final PatternSetRef compilerExcludes = new PatternSetRef(BuildProperties.getExcludedFromCompilationProperty(moduleChunkName));

final String mainTargetName = BuildProperties.getCompileTargetName(moduleChunkName);
Expand Down Expand Up @@ -82,7 +82,7 @@ public CompileModuleChunkTarget(final Project project,

if (sourceRoots.length > 0) {
final String outputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(moduleChunkName));
final Tag srcTag = new Tag("src", Couple.newOne("refid", BuildProperties.getSourcepathProperty(moduleChunkName)));
final Tag srcTag = new Tag("src", Couple.of("refid", BuildProperties.getSourcepathProperty(moduleChunkName)));
productionTarget.add(new Mkdir(outputPathRef));
createCustomCompilerTasks(project, moduleChunk, genOptions, false, customCompilers, compilerArgs, bootclasspathTag,
classpathTag, compilerExcludes, srcTag, outputPathRef, productionTarget);
Expand All @@ -101,8 +101,8 @@ public CompileModuleChunkTarget(final Project project,
if (testSourceRoots.length > 0) {

final String testOutputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(moduleChunkName));
final Tag srcTag = new Tag("src", Couple.newOne("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName)));
final Couple<String> testClasspathRef = Couple.newOne("refid", BuildProperties.getTestClasspathProperty(moduleChunkName));
final Tag srcTag = new Tag("src", Couple.of("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName)));
final Couple<String> testClasspathRef = Couple.of("refid", BuildProperties.getTestClasspathProperty(moduleChunkName));
final Tag testClassPath = new Tag("classpath", testClasspathRef);
testsTarget.add(new Mkdir(testOutputPathRef));
createCustomCompilerTasks(project, moduleChunk, genOptions, true, customCompilers, compilerArgs, bootclasspathTag,
Expand Down Expand Up @@ -153,7 +153,7 @@ private static void createCustomCompilerTasks(Project project,
String outputPathRef,
Target target) {
if (customCompilers.length > 1) {
target.add(new Tag("fail", Couple.newOne("message", CompilerBundle.message(
target.add(new Tag("fail", Couple.of("message", CompilerBundle.message(
"generated.ant.build.compile.modules.fail.custom.compilers"))));
}
for (ChunkCustomCompilerExtension ext : customCompilers) {
Expand Down Expand Up @@ -182,7 +182,7 @@ private static Generator createCopyTask(final Project project,
File baseDir,
final GenerationOptions genOptions) {
//noinspection HardCodedStringLiteral
final Tag filesSelector = new Tag("type", Couple.newOne("type", "file"));
final Tag filesSelector = new Tag("type", Couple.of("type", "file"));
final PatternSetRef excludes = CompilerExcludes.isAvailable(project) ? new PatternSetRef(
BuildProperties.getExcludedFromCompilationProperty(chunk.getName())) : null;
final PatternSetRef resourcePatternsPatternSet = new PatternSetRef(BuildProperties.PROPERTY_COMPILER_RESOURCE_PATTERNS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public PropertyFileGeneratorImpl(Project project, GenerationOptions genOptions)
}

public void addProperty(String name, String value) {
myProperties.add(Couple.newOne(name, value));
myProperties.add(Couple.of(name, value));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static Couple<Module> addingDependencyFormsCircularity(final Module curre
for (Chunk<ModifiableRootModel> chunk : nodesAfter) {
if (chunk.containsNode(toDependOnModel) && chunk.containsNode(currentModel)) {
Iterator<ModifiableRootModel> nodes = chunk.getNodes().iterator();
return Couple.newOne(nodes.next().getModule(), nodes.next().getModule());
return Couple.of(nodes.next().getModule(), nodes.next().getModule());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ protected static Couple<String> pair(@NonNls String v1, @Nullable @NonNls String
if (v2 == null) {
return null;
}
return Couple.newOne(v1, v2);
return Couple.of(v1, v2);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class AntCall extends Tag{

public AntCall(final String target) {
super("antcall", Couple.newOne("target", target));
super("antcall", Couple.of("target", target));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class AntProject extends Tag {
public AntProject(@NonNls String name, @NonNls String defaultTarget) {
//noinspection HardCodedStringLiteral
super("project", Couple.newOne("name", name), Couple.newOne("default", defaultTarget));
super("project", Couple.of("name", name), Couple.of("default", defaultTarget));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class Attribute extends Tag{
public Attribute(@NonNls String name, String value) {
//noinspection HardCodedStringLiteral
super("attribute", Couple.newOne("name", name), Couple.newOne("value", value));
super("attribute", Couple.of("name", name), Couple.of("value", value));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
public class Copy extends Tag {
public Copy(@NonNls String toDir) {
//noinspection HardCodedStringLiteral
super("copy", Couple.newOne("todir", toDir));
super("copy", Couple.of("todir", toDir));
}
public Copy(@NonNls String file, @NonNls String toFile) {
//noinspection HardCodedStringLiteral
super("copy", Couple.newOne("file", file), Couple.newOne("tofile", toFile));
super("copy", Couple.of("file", file), Couple.of("tofile", toFile));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class Delete extends Tag{
public Delete(@NonNls String dir) {
//noinspection HardCodedStringLiteral
super("delete", Couple.newOne("dir", dir));
super("delete", Couple.of("dir", dir));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public class DirSet extends Tag{

public DirSet(@NonNls final String dir) {
//noinspection HardCodedStringLiteral
super("dirset", Couple.newOne("dir", dir));
super("dirset", Couple.of("dir", dir));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class Dirname extends Tag{
public Dirname(@NonNls String property, @NonNls String file) {
//noinspection HardCodedStringLiteral
super("dirname", Couple.newOne("property", property), Couple.newOne("file", file));
super("dirname", Couple.of("property", property), Couple.of("file", file));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Exclude extends Tag {

public Exclude(@NonNls final String name) {
//noinspection HardCodedStringLiteral
super("exclude", Couple.newOne("name", name));
super("exclude", Couple.of("name", name));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
public class Import extends Tag{
public Import(@NonNls String file, boolean optional) {
//noinspection HardCodedStringLiteral
super("import", Couple.newOne("file", file), Couple.newOne("optional", optional ? "true" : "false"));
super("import", Couple.of("file", file), Couple.of("optional", optional ? "true" : "false"));
}

public Import(@NonNls String file) {
//noinspection HardCodedStringLiteral
super("import", Couple.newOne("file", file));
super("import", Couple.of("file", file));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class Mkdir extends Tag {
public Mkdir(@NonNls String directory) {
//noinspection HardCodedStringLiteral
super("mkdir", Couple.newOne("dir", directory));
super("mkdir", Couple.of("dir", directory));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public class Param extends Tag {
public Param(@NonNls final String name, final String value) {
//noinspection HardCodedStringLiteral
super("param", Couple.newOne("name", name), Couple.newOne("value", value));
super("param", Couple.of("name", name), Couple.of("value", value));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class PatternSetRef extends Tag{
public PatternSetRef(@NonNls final String refid) {
//noinspection HardCodedStringLiteral
super("patternset", Couple.newOne("refid", refid));
super("patternset", Couple.of("refid", refid));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public class Property extends Tag {

public Property(@NonNls final String name, final String value) {
//noinspection HardCodedStringLiteral
super("property", Couple.newOne("name", name), Couple.newOne("value", value));
super("property", Couple.of("name", name), Couple.of("value", value));
}

public Property(@NonNls final String filePath) {
//noinspection HardCodedStringLiteral
super("property", Couple.newOne("file", filePath));
super("property", Couple.of("file", filePath));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Target(@NonNls String name, @Nullable String depends, @Nullable String de
@SuppressWarnings({"HardCodedStringLiteral"})
private static Pair[] getOptions(@NonNls String... names) {
final List<Pair> options = new ArrayList<Pair>();
options.add(Couple.newOne("name", names[0]));
options.add(Couple.of("name", names[0]));
appendIfNonEmpty(options, "depends", names[1]);
appendIfNonEmpty(options, "description", names[2]);
appendIfNonEmpty(options, "unless", names[3]);
Expand All @@ -54,7 +54,7 @@ private static Pair[] getOptions(@NonNls String... names) {

private static void appendIfNonEmpty(List<Pair> options, final String paramName, String value) {
if (!StringUtil.isEmptyOrSpaces(value)) {
options.add(Couple.newOne(paramName, value));
options.add(Couple.of(paramName, value));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
public class Zip extends Tag {
public Zip(@NonNls final String destFile) {
//noinspection HardCodedStringLiteral
super("zip", Couple.newOne("destfile", destFile));
super("zip", Couple.of("destfile", destFile));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public class UnBoxingEvaluator implements Evaluator{
private final Evaluator myOperand;
private static final Map<String, Couple<String>> TYPES_TO_CONVERSION_METHOD_MAP = new HashMap<String, Couple<String>>();
static {
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Boolean", Couple.newOne("booleanValue", "()Z"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Byte", Couple.newOne("byteValue", "()B"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Character", Couple.newOne("charValue", "()C"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Short", Couple.newOne("shortValue", "()S"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Integer", Couple.newOne("intValue", "()I"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Long", Couple.newOne("longValue", "()J"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Float", Couple.newOne("floatValue", "()F"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Double", Couple.newOne("doubleValue", "()D"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Boolean", Couple.of("booleanValue", "()Z"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Byte", Couple.of("byteValue", "()B"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Character", Couple.of("charValue", "()C"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Short", Couple.of("shortValue", "()S"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Integer", Couple.of("intValue", "()I"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Long", Couple.of("longValue", "()J"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Float", Couple.of("floatValue", "()F"));
TYPES_TO_CONVERSION_METHOD_MAP.put("java.lang.Double", Couple.of("doubleValue", "()D"));
}

public static boolean isTypeUnboxable(String typeName) {
Expand Down
2 changes: 1 addition & 1 deletion java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static PsiType getLeastContainingTypeArgument(PsiType type1,
PsiManager manager,
PsiClass nestedLayer,
PsiTypeParameter parameter) {
Couple<PsiType> types = Couple.newOne(type1, type2);
Couple<PsiType> types = Couple.of(type1, type2);
if (compared.contains(types)) {
if (nestedLayer != null) {
PsiSubstitutor subst = PsiSubstitutor.EMPTY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ else if (element instanceof PsiClass) {
myVariablesSet = set2 = localsSet.isEmpty() ? Collections.<String>emptySet() : localsSet;
myConflict = wasConflict = conflict.get();
}
return wasConflict ? null : Couple.newOne(set1, set2);
return wasConflict ? null : Couple.of(set1, set2);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ProblemDescriptorUtil {
@interface FlagConstant {
}

public static Couple<String> XML_CODE_MARKER = Couple.newOne("<xml-code>", "</xml-code>");
public static Couple<String> XML_CODE_MARKER = Couple.of("<xml-code>", "</xml-code>");

public static String extractHighlightedText(@NotNull CommonProblemDescriptor descriptor, PsiElement psiElement) {
if (psiElement == null || !psiElement.isValid()) return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public static Couple<String> getBlockPrefixSuffixPair(PsiElement comment) {
final String prefix = commenter.getBlockCommentPrefix();
final String suffix = commenter.getBlockCommentSuffix();
if (prefix != null || suffix != null) {
return Couple.newOne(StringUtil.notNullize(prefix), StringUtil.notNullize(suffix));
return Couple.of(StringUtil.notNullize(prefix), StringUtil.notNullize(suffix));
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static void findChildRangeDuplicates(PsiElement first, PsiElement last,
findChildRangeDuplicates(first, last, scope, new PairConsumer<PsiElement, PsiElement>() {
@Override
public void consume(final PsiElement start, final PsiElement end) {
result.add(Couple.newOne(start, end));
result.add(Couple.of(start, end));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected Couple<String> splitPath(@NotNull String path) {
}
String localPath = path.substring(0, separator);
String pathInJar = path.substring(separator + 2);
return Couple.newOne(localPath, pathInJar);
return Couple.of(localPath, pathInJar);
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static ASTNode findCommonParent(ASTNode one, ASTNode two) {
}

public static Couple<ASTNode> findTopmostSiblingParents(ASTNode one, ASTNode two) {
if (one == two) return Couple.newOne(null, null);
if (one == two) return Couple.of(null, null);

LinkedList<ASTNode> oneParents = new LinkedList<ASTNode>();
LinkedList<ASTNode> twoParents = new LinkedList<ASTNode>();
Expand All @@ -249,7 +249,7 @@ public static Couple<ASTNode> findTopmostSiblingParents(ASTNode one, ASTNode two
}
while (one == two && one != null);

return Couple.newOne(one, two);
return Couple.of(one, two);
}

public static void clearCaches(@NotNull final TreeElement tree) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public CachedValueProvider.Result<Runnable> compute(Couple<Boolean> param) {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document);
return getUpdateResult(file, document, param.first, project, editor, param.second);
}
}, false, Couple.newOne(quick, applyDefaultState));
}, false, Couple.of(quick, applyDefaultState));
}

private static CachedValueProvider.Result<Runnable> getUpdateResult(PsiFile file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ private Couple<TextRange> findCommentBlock(TextRange range, String commentPrefix
end = new TextRange(range.getEndOffset(), range.getEndOffset());
}

return Couple.newOne(start, end);
return Couple.of(start, end);
}

public void uncommentRange(TextRange range, String commentPrefix, String commentSuffix, Commenter commenter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
private Component myContextComponent;
private CalcThread myCalcThread;
private static AtomicBoolean ourShiftIsPressed = new AtomicBoolean(false);
private final static Couple<AtomicBoolean> ourPressed = Couple.newOne(new AtomicBoolean(false), new AtomicBoolean(false));
private final static Couple<AtomicBoolean> ourReleased = Couple.newOne(new AtomicBoolean(false), new AtomicBoolean(false));
private final static Couple<AtomicBoolean> ourPressed = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
private final static Couple<AtomicBoolean> ourReleased = Couple.of(new AtomicBoolean(false), new AtomicBoolean(false));
private static AtomicBoolean ourOtherKeyWasPressed = new AtomicBoolean(false);
private static AtomicLong ourLastTimePressed = new AtomicLong(0);
private static AtomicBoolean showAll = new AtomicBoolean(false);
Expand Down
Loading

0 comments on commit 80ea2b9

Please sign in to comment.