Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ public void initializeFromMemento(String memento) throws CoreException {
index = memento.indexOf("</findAll>", start); //$NON-NLS-1$
if (index > 0) {
String findAll = memento.substring(start, index);
Boolean all = Boolean.valueOf(findAll);
boolean all = Boolean.parseBoolean(findAll);
String rest = memento.substring(index + 10);
fJavaProject = (IJavaProject) JavaCore.create(handle);
fIsFindAllSourceElements = all.booleanValue();
fIsFindAllSourceElements = all;
fSourceLocator.initializeFromMemento(rest);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ private AskRecurrenceDialog(Shell parentShell) {
MessageDialog.QUESTION, 0, //
DebugUIMessages.JavaDebugOptionsManager_skip_buttonLabel, //
DebugUIMessages.JavaDebugOptionsManager_suspend_buttonLabel);
parentShell.getDisplay().syncExec(() -> open());
parentShell.getDisplay().syncExec(this::open);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,28 +546,28 @@ private Expression getCompiledExpression(IJavaPrimitiveValue javaPM, IJavaDebugT
private String primitiveSnippets(String snippet, String typeName, IJavaPrimitiveValue primitiveValue) {
String modified = null;
if (typeName.equals("float")) {
String thisValue = Float.valueOf(primitiveValue.getFloatValue()).toString();
String thisValue = Float.toString(primitiveValue.getFloatValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("int")) {
String thisValue = Integer.valueOf(primitiveValue.getIntValue()).toString();
String thisValue = Integer.toString(primitiveValue.getIntValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("byte")) {
String thisValue = Byte.valueOf(primitiveValue.getByteValue()).toString();
String thisValue = Byte.toString(primitiveValue.getByteValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("long")) {
String thisValue = Long.valueOf(primitiveValue.getLongValue()).toString();
String thisValue = Long.toString(primitiveValue.getLongValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("short")) {
String thisValue = Short.valueOf(primitiveValue.getShortValue()).toString();
String thisValue = Short.toString(primitiveValue.getShortValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("double")) {
String thisValue = Double.valueOf(primitiveValue.getDoubleValue()).toString();
String thisValue = Double.toString(primitiveValue.getDoubleValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("boolean")) {
String thisValue = Boolean.valueOf(primitiveValue.getBooleanValue()).toString();
String thisValue = Boolean.toString(primitiveValue.getBooleanValue());
modified = snippet.replace("this", thisValue);
} else if (typeName.equals("char")) {
String thisValue = Character.valueOf(primitiveValue.getCharValue()).toString();
String thisValue = Character.toString(primitiveValue.getCharValue());
modified = snippet.replace("this", thisValue);
} else {
modified = snippet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ private static List<String> getArgumentTypeNames(IJavaElement parent) throws Cor
String[] ptypes = method.getParameterTypes();
for (String ps : ptypes) {
@SuppressWarnings("restriction")
String resolvedName = org.eclipse.jdt.internal.corext.util.JavaModelUtil.getResolvedTypeName(ps, type);
StringBuilder resolvedName = new StringBuilder().append(org.eclipse.jdt.internal.corext.util.JavaModelUtil.getResolvedTypeName(ps, type));
int arrayCount = Signature.getArrayCount(ps);
for (int i = 0; i < arrayCount; i++) {
resolvedName += "[]"; //$NON-NLS-1$
resolvedName.append("[]"); //$NON-NLS-1$
}
psig.add(resolvedName);
psig.add(resolvedName.toString());
}
return psig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ public static List<String> getInterfaces(String className) {
if (interfaces.isEmpty()) {
interfaces = List.of(Class.forName(className).getSuperclass().getInterfaces());
}
names = new ArrayList<>(interfaces.stream().map(e -> e.getCanonicalName()).toList());
names = new ArrayList<>(interfaces.stream().map(Class::getCanonicalName).toList());
names.add(Class.forName(className).getSuperclass().getSimpleName());
} catch (Exception e) {
names = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ private void displayMapResultsInDialogBox(Map<IJavaVariable, Object> result) thr
*/
@SuppressWarnings("nls")
private String printListContents(String Selection, List<String> list, int displayLimit) {
StringBuffer content = new StringBuffer();
StringBuilder content = new StringBuilder();
content.append("[");
content.append(list.stream().limit(displayLimit).collect(Collectors.joining(",")));
content.append("......]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1596,11 +1596,11 @@ private void toggleFieldOrMethodBreakpoints(IWorkbenchPart part, ISelection sele
* Additional diagnosis info for bug 528321
*/
private static void logBadAnnotation(SimpleMarkerAnnotation annotation, CoreException e) {
String message = "Editor annotation with non existing marker found: "; //$NON-NLS-1$
message += "text: " + annotation.getText(); //$NON-NLS-1$
message += ", type: " + annotation.getType(); //$NON-NLS-1$
message += ", " + annotation.getMarker(); //$NON-NLS-1$
JDIDebugUIPlugin.log(message, e);
StringBuilder message = new StringBuilder("Editor annotation with non existing marker found: "); //$NON-NLS-1$
message.append("text: ").append(annotation.getText()); //$NON-NLS-1$
message.append(", type: ").append(annotation.getType()); //$NON-NLS-1$
message.append(", ").append(annotation.getMarker()); //$NON-NLS-1$
JDIDebugUIPlugin.log(message.toString(), e);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class JavaDebugStackTraceConsoleTracker extends JavaConsoleTracker {
public void matchFound(PatternMatchEvent event) {
try {
// add a hyperlink at "line: 123"
addHyperlinkAtContent(event, line -> JavaDebugStackTraceHyperlink.extractLineText(line));
addHyperlinkAtContent(event, JavaDebugStackTraceHyperlink::extractLineText);
// add a hyperlink at the type
addHyperlinkAtContent(event, line -> JavaDebugStackTraceHyperlink.extractTypeName(line));
addHyperlinkAtContent(event, JavaDebugStackTraceHyperlink::extractTypeName);
} catch (BadLocationException e) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
try {
return processAmbiguousResults(matches, typeName, lineNumber, link);
} catch(Exception e) {
StringBuffer temp = new StringBuffer();
StringBuilder temp = new StringBuilder();
temp.append("Unable to parse \"" + link + "\" \n "); //$NON-NLS-1$ //$NON-NLS-2$
temp.append(e.getClass().getSimpleName());
exceptionHandler(temp.toString(), e);
Expand Down Expand Up @@ -281,7 +281,7 @@ public IStatus processAmbiguousResults(List<Object> matches, String typeName, in
if (methodSignature == null) {
return openClipboard(matches, line, typeName);
}
methodSignature = methodSignature.replaceAll(" ", ""); //$NON-NLS-1$//$NON-NLS-2$ ;
methodSignature = methodSignature.replace(" ", ""); //$NON-NLS-1$//$NON-NLS-2$ ;
String methodNameExtracted = methodSignature.substring(0, methodSignature.indexOf('('));
for (Object obj : matches) {
if (filterClasses(obj, methodSignature, methodNameExtracted, link)) {
Expand Down Expand Up @@ -439,7 +439,7 @@ private boolean extractFromResults(IType type, String methodSignature, String me
return false;
}
String methodName = matcher.group();
methodName = methodName.replaceAll(" ", ""); //$NON-NLS-1$//$NON-NLS-2$
methodName = methodName.replace(" ", ""); //$NON-NLS-1$//$NON-NLS-2$
pattern = Pattern.compile(METHOD_ARGUMENTS_REGEX);
matcher = pattern.matcher(methodSignature);
if (!matcher.find()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public void run(IProgressMonitor monitor) {
}

if (locations.isEmpty()) {
String messagePath = path.replaceAll("&", "&&"); // @see bug 29855 //$NON-NLS-1$//$NON-NLS-2$
String messagePath = path.replace("&", "&&"); // @see bug 29855 //$NON-NLS-1$//$NON-NLS-2$
MessageDialog.openInformation(getShell(), JREMessages.InstalledJREsBlock_12, NLS.bind(JREMessages.InstalledJREsBlock_13, new String[]{messagePath})); //
} else {
Iterator<IVMInstallType> iter2 = types.iterator();
Expand Down Expand Up @@ -1055,7 +1055,7 @@ protected void search(File directory, List<File> found, List<IVMInstallType> typ
}
File file = name == null ? directory : new File(directory, name);
monitor.subTask(NLS.bind(JREMessages.InstalledJREsBlock_14, new String[] { Integer.toString(found.size()),
file.toPath().normalize().toAbsolutePath().toString().replaceAll("&", "&&") })); // @see bug 29855 //$NON-NLS-1$ //$NON-NLS-2$
file.toPath().normalize().toAbsolutePath().toString().replace("&", "&&") })); // @see bug 29855 //$NON-NLS-1$ //$NON-NLS-2$
IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
if (file.isDirectory()) {
if (ignore.add(file)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ public Image getImage(Object element) {
}
@Override
public String getText(Object element) {
if(element instanceof IType) {
IType type = (IType) element;
String label = type.getTypeQualifiedName();
if (element instanceof IType type) {
StringBuilder label = new StringBuilder().append(type.getTypeQualifiedName());
String container = getDeclaringContainerName(type);
if(container != null && !"".equals(container)) { //$NON-NLS-1$
label += " - "+container; //$NON-NLS-1$
label.append(" - ").append(container); //$NON-NLS-1$
}
return label;
return label.toString();
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

public class MainMethodSearchEngine{

private class MethodCollector extends SearchRequestor {
private static class MethodCollector extends SearchRequestor {
private final List<IType> fResult;

public MethodCollector() {
Expand Down