mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
apply redundant array creation for calling varargs method
This commit is contained in:
@@ -170,7 +170,7 @@ public final class Utils {
|
||||
|
||||
if (validateConstructor) {
|
||||
try {
|
||||
final Constructor constructor = aClass.getConstructor(new Class[0]);
|
||||
final Constructor constructor = aClass.getConstructor();
|
||||
if ((constructor.getModifiers() & Modifier.PUBLIC) == 0) {
|
||||
return "Class \"" + className + "\" does not have default public constructor";
|
||||
}
|
||||
@@ -315,7 +315,7 @@ public final class Utils {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
componentClass.getConstructor(new Class[]{});
|
||||
componentClass.getConstructor();
|
||||
}
|
||||
catch (NoSuchMethodException ex) {
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@ public class LwIntroEnumProperty extends LwIntrospectedProperty {
|
||||
@Override
|
||||
public Object read(Element element) throws Exception {
|
||||
String value = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_VALUE);
|
||||
final Method method = myEnumClass.getMethod("valueOf", new Class[] { String.class} );
|
||||
return method.invoke(null, new Object[] { value } );
|
||||
final Method method = myEnumClass.getMethod("valueOf", String.class);
|
||||
return method.invoke(null, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -137,8 +137,8 @@ public final class LwXmlReader {
|
||||
public static Object getRequiredPrimitiveTypeValue(final Element element, final String attributeName, final Class valueClass) {
|
||||
final String str = getRequiredString(element, attributeName);
|
||||
try {
|
||||
final Method method = valueClass.getMethod("valueOf", new Class[]{String.class});
|
||||
return method.invoke(null, new Object[]{str});
|
||||
final Method method = valueClass.getMethod("valueOf", String.class);
|
||||
return method.invoke(null, str);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("attribute '" + attributeName + "' is not a proper float: " + str);
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.AnActionButton;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -95,7 +94,7 @@ public class EnvVariablesTable extends ListTableWithButtons<EnvironmentVariable>
|
||||
return environmentVariable.getDescription();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
public TableCellEditor getEditor(EnvironmentVariable variable) {
|
||||
StringWithNewLinesCellEditor editor = new StringWithNewLinesCellEditor();
|
||||
@@ -104,7 +103,7 @@ public class EnvVariablesTable extends ListTableWithButtons<EnvironmentVariable>
|
||||
}
|
||||
};
|
||||
|
||||
return new ListTableModel((new ColumnInfo[]{name, value}));
|
||||
return new ListTableModel(name, value);
|
||||
}
|
||||
|
||||
public void editVariableName(final EnvironmentVariable environmentVariable) {
|
||||
|
||||
@@ -80,7 +80,7 @@ final class PathMappingTable extends ListTableWithButtons<PathMappingSettings.Pa
|
||||
}
|
||||
};
|
||||
|
||||
return new ListTableModel((new ColumnInfo[]{local, remote}));
|
||||
return new ListTableModel(local, remote);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ public class DetectionExcludesConfigurable implements Configurable {
|
||||
|
||||
private PopupStep addExcludedFramework(final @NotNull FrameworkType frameworkType) {
|
||||
final String projectItem = "In the whole project";
|
||||
return new BaseListPopupStep<String>(null, new String[]{projectItem, "In directory..."}) {
|
||||
return new BaseListPopupStep<String>(null, projectItem, "In directory...") {
|
||||
@Override
|
||||
public PopupStep onChosen(String selectedValue, boolean finalChoice) {
|
||||
if (selectedValue.equals(projectItem)) {
|
||||
|
||||
@@ -230,7 +230,7 @@ public class BegMenuItemUI extends BasicMenuItemUI {
|
||||
g.setFont(font);
|
||||
}
|
||||
|
||||
private String getKeyStrokeText(KeyStroke keystroke) {
|
||||
private static String getKeyStrokeText(KeyStroke keystroke) {
|
||||
String s1 = "";
|
||||
if (keystroke != null){
|
||||
int j1 = keystroke.getModifiers();
|
||||
@@ -238,7 +238,7 @@ public class BegMenuItemUI extends BasicMenuItemUI {
|
||||
if (SystemInfo.isMac) {
|
||||
try {
|
||||
Class appleLaf = Class.forName(AQUA_LOOK_AND_FEEL_CLASS_NAME);
|
||||
Method getModifiers = appleLaf.getMethod(GET_KEY_MODIFIERS_TEXT, new Class[] {int.class, boolean.class});
|
||||
Method getModifiers = appleLaf.getMethod(GET_KEY_MODIFIERS_TEXT, int.class, boolean.class);
|
||||
s1 = (String)getModifiers.invoke(appleLaf, new Object[] {new Integer(j1), Boolean.FALSE});
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -275,7 +275,7 @@ public class BegMenuItemUI extends BasicMenuItemUI {
|
||||
if (i1 == 0){
|
||||
return new MenuElement[0];
|
||||
}
|
||||
java.awt.Container container = menuItem.getParent();
|
||||
Container container = menuItem.getParent();
|
||||
MenuElement[] amenuelement1;
|
||||
if (amenuelement[i1 - 1].getComponent() == container){
|
||||
amenuelement1 = new MenuElement[i1 + 1];
|
||||
@@ -323,7 +323,7 @@ public class BegMenuItemUI extends BasicMenuItemUI {
|
||||
int menuItemGap
|
||||
) {
|
||||
SwingUtilities.layoutCompoundLabel(menuItem, fontmetrics, text, icon, verticalAlignment, horizontalAlignment, verticalTextPosition, horizontalTextPosition, viewRect, iconRect, textRect, textIconGap);
|
||||
if (keyStrokeText == null || "".equals(keyStrokeText)){
|
||||
if (keyStrokeText == null || keyStrokeText.isEmpty()){
|
||||
acceleratorRect.width = acceleratorRect.height = 0;
|
||||
}
|
||||
else{
|
||||
@@ -407,7 +407,7 @@ public class BegMenuItemUI extends BasicMenuItemUI {
|
||||
layoutMenuItem(fontmetrics, text, fontmetrics1, keyStrokeText, icon1, icon2, arrowIcon, jmenuitem.getVerticalAlignment(), jmenuitem.getHorizontalAlignment(), jmenuitem.getVerticalTextPosition(), jmenuitem.getHorizontalTextPosition(), f, l, j, c, h, d, text != null ? defaultTextIconGap : 0, defaultTextIconGap);
|
||||
i.setBounds(j);
|
||||
i = SwingUtilities.computeUnion(l.x, l.y, l.width, l.height, i);
|
||||
if (!(keyStrokeText == null || "".equals(keyStrokeText))){
|
||||
if (!(keyStrokeText == null || keyStrokeText.isEmpty())){
|
||||
i.width += c.width;
|
||||
i.width += 7 * defaultTextIconGap;
|
||||
}
|
||||
@@ -504,9 +504,9 @@ public class BegMenuItemUI extends BasicMenuItemUI {
|
||||
// It's a hack. The method BasicLookAndFeel.playSound has protected access, so
|
||||
// it's imposible to mormally invoke it.
|
||||
try {
|
||||
Method playSoundMethod=BasicLookAndFeel.class.getDeclaredMethod(PLAY_SOUND_METHOD,new Class[]{Action.class});
|
||||
Method playSoundMethod=BasicLookAndFeel.class.getDeclaredMethod(PLAY_SOUND_METHOD, Action.class);
|
||||
playSoundMethod.setAccessible(true);
|
||||
playSoundMethod.invoke(lf,new Object[]{audioAction});
|
||||
playSoundMethod.invoke(lf, audioAction);
|
||||
} catch(Exception ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class LogUtil {
|
||||
public static String getSystemMemoryInfo() {
|
||||
try {
|
||||
@SuppressWarnings("SpellCheckingInspection") Process process = new ProcessBuilder()
|
||||
.command(new String[]{SystemInfo.isWindows ? "systeminfo" : SystemInfo.isMac ? "vm_stat" : "free"})
|
||||
.command(SystemInfo.isWindows ? "systeminfo" : SystemInfo.isMac ? "vm_stat" : "free")
|
||||
.redirectErrorStream(true)
|
||||
.start();
|
||||
return FileUtil.loadTextAndClose(process.getInputStream());
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FilteringIteratorTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testCallsHashNextOncePerElement() {
|
||||
ArrayList list = new ArrayList(Arrays.asList(new Object[]{null, "a", null, "b"}));
|
||||
ArrayList list = new ArrayList(Arrays.asList(null, "a", null, "b"));
|
||||
MockIterator mockIterator = new MockIterator(list.iterator());
|
||||
MockCondition mockCondition = new MockCondition(STRINGS_ONLY);
|
||||
Iterator iterator = FilteringIterator.create(mockIterator, mockCondition);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.util.Assertion;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -40,8 +39,8 @@ public class SequenceIteratorTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testAllEmpty() {
|
||||
Assert.assertFalse(ContainerUtil.concatIterators(empty()).hasNext());
|
||||
Assert.assertFalse(ContainerUtil.concatIterators(empty(), empty()).hasNext());
|
||||
assertFalse(ContainerUtil.concatIterators(empty()).hasNext());
|
||||
assertFalse(ContainerUtil.concatIterators(empty(), empty()).hasNext());
|
||||
}
|
||||
|
||||
public void testIntermediateEmpty() {
|
||||
@@ -62,15 +61,14 @@ public class SequenceIteratorTest extends TestCase {
|
||||
return new ArrayList().iterator();
|
||||
}
|
||||
|
||||
|
||||
public void testSimple() {
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(iter(arr1), iter(arr2), iter(arr3)));
|
||||
int cnt = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
++ cnt;
|
||||
iterator.next();
|
||||
++cnt;
|
||||
}
|
||||
Assert.assertEquals(arr1.length + arr2.length + arr3.length, cnt);
|
||||
assertEquals(arr1.length + arr2.length + arr3.length, cnt);
|
||||
}
|
||||
|
||||
private static Iterator<Integer> compose(List<Iterator<Integer>> iterators) {
|
||||
@@ -81,30 +79,30 @@ public class SequenceIteratorTest extends TestCase {
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(iter(arr1)));
|
||||
int cnt = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
++ cnt;
|
||||
iterator.next();
|
||||
++cnt;
|
||||
}
|
||||
Assert.assertEquals(arr1.length, cnt);
|
||||
assertEquals(arr1.length, cnt);
|
||||
}
|
||||
|
||||
public void testOneOne() {
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(iter(new Integer[]{1})));
|
||||
int cnt = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
++ cnt;
|
||||
iterator.next();
|
||||
++cnt;
|
||||
}
|
||||
Assert.assertEquals(1, cnt);
|
||||
assertEquals(1, cnt);
|
||||
}
|
||||
|
||||
public void testEmpty() {
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(iter(new Integer[]{})));
|
||||
int cnt = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
++ cnt;
|
||||
iterator.next();
|
||||
++cnt;
|
||||
}
|
||||
Assert.assertEquals(0, cnt);
|
||||
assertEquals(0, cnt);
|
||||
}
|
||||
|
||||
public void testManyEmpty() {
|
||||
@@ -112,10 +110,10 @@ public class SequenceIteratorTest extends TestCase {
|
||||
compose(Arrays.asList(iter(new Integer[]{}), iter(new Integer[]{}), iter(new Integer[]{})));
|
||||
int cnt = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
++ cnt;
|
||||
iterator.next();
|
||||
++cnt;
|
||||
}
|
||||
Assert.assertEquals(0, cnt);
|
||||
assertEquals(0, cnt);
|
||||
}
|
||||
|
||||
public void testRemoveSimple() {
|
||||
@@ -127,25 +125,25 @@ public class SequenceIteratorTest extends TestCase {
|
||||
compose(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()));
|
||||
int cnt = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
iterator.next();
|
||||
if ((cnt - 2) % 5 == 0) {
|
||||
iterator.remove();
|
||||
}
|
||||
++ cnt;
|
||||
++cnt;
|
||||
}
|
||||
Assert.assertTrue(! list1.contains(3));
|
||||
Assert.assertTrue(! list2.contains(13));
|
||||
Assert.assertTrue(! list3.contains(103));
|
||||
assertFalse(list1.contains(3));
|
||||
assertFalse(list2.contains(13));
|
||||
assertFalse(list3.contains(103));
|
||||
}
|
||||
|
||||
public void testRemoveAfterLast() {
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(arr1));
|
||||
final Iterator<Integer> it1 = list1.iterator();
|
||||
while (it1.hasNext()) {
|
||||
Integer next = it1.next();
|
||||
it1.next();
|
||||
}
|
||||
it1.remove(); // ok, removes last
|
||||
Assert.assertTrue(! list1.contains(5));
|
||||
assertFalse(list1.contains(5));
|
||||
list1.add(5);
|
||||
|
||||
final ArrayList<Integer> list2 = new ArrayList<>(Arrays.asList(arr2));
|
||||
@@ -154,18 +152,18 @@ public class SequenceIteratorTest extends TestCase {
|
||||
final Iterator<Integer> iterator =
|
||||
compose(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()));
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
iterator.next();
|
||||
}
|
||||
iterator.remove();
|
||||
Assert.assertTrue(! list3.contains(105));
|
||||
assertFalse(list3.contains(105));
|
||||
}
|
||||
|
||||
public void testRemoveOnlyOne() {
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(new Integer[]{1}));
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1));
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator()));
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
Assert.assertTrue(list1.isEmpty());
|
||||
assertTrue(list1.isEmpty());
|
||||
}
|
||||
|
||||
public void testIterateWithEmptyInside() {
|
||||
@@ -174,33 +172,35 @@ public class SequenceIteratorTest extends TestCase {
|
||||
int sum = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
++ cnt;
|
||||
++cnt;
|
||||
sum += next;
|
||||
}
|
||||
Assert.assertEquals(arr1.length + arr3.length, cnt);
|
||||
Assert.assertEquals(530, sum);
|
||||
assertEquals(arr1.length + arr3.length, cnt);
|
||||
assertEquals(530, sum);
|
||||
}
|
||||
|
||||
public void testRemoveIfNextNotCalled() {
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(new Integer[]{1}));
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1));
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator()));
|
||||
try {
|
||||
iterator.remove();
|
||||
Assert.assertTrue(false);
|
||||
} catch (IllegalStateException e) {
|
||||
fail();
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
public void testRemoveTwice() {
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(new Integer[]{1, 2, 3, 4, 5}));
|
||||
final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
|
||||
final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator()));
|
||||
try {
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
iterator.remove(); // wrong, next() should be called inside
|
||||
Assert.assertTrue(false);
|
||||
} catch (IllegalStateException e) {
|
||||
fail();
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
@@ -213,12 +213,12 @@ public class SequenceIteratorTest extends TestCase {
|
||||
final Iterator<Integer> iterator =
|
||||
compose(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()));
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
}
|
||||
Assert.assertTrue(list1.isEmpty());
|
||||
Assert.assertTrue(list2.isEmpty());
|
||||
Assert.assertTrue(list3.isEmpty());
|
||||
assertTrue(list1.isEmpty());
|
||||
assertTrue(list2.isEmpty());
|
||||
assertTrue(list3.isEmpty());
|
||||
}
|
||||
|
||||
public void testRemoveAllWithEmptyInside() {
|
||||
@@ -229,12 +229,12 @@ public class SequenceIteratorTest extends TestCase {
|
||||
final Iterator<Integer> iterator =
|
||||
compose(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()));
|
||||
while (iterator.hasNext()) {
|
||||
Integer next = iterator.next();
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
}
|
||||
Assert.assertTrue(list1.isEmpty());
|
||||
Assert.assertTrue(list2.isEmpty());
|
||||
Assert.assertTrue(list3.isEmpty());
|
||||
assertTrue(list1.isEmpty());
|
||||
assertTrue(list2.isEmpty());
|
||||
assertTrue(list3.isEmpty());
|
||||
}
|
||||
|
||||
public void testRemoveLastAndFirstINNext() {
|
||||
@@ -250,17 +250,16 @@ public class SequenceIteratorTest extends TestCase {
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
|
||||
Assert.assertTrue(list1.size() == 1 && ! list1.contains(2));
|
||||
Assert.assertTrue(list2.size() == 1 && ! list1.contains(3));
|
||||
Assert.assertTrue(list3.size() == 2);
|
||||
assertTrue(list1.size() == 1 && !list1.contains(2));
|
||||
assertTrue(list2.size() == 1 && !list1.contains(3));
|
||||
assertEquals(2, list3.size());
|
||||
}
|
||||
|
||||
private static final Integer[] arr1 = {1,2,3,4,5};
|
||||
private static final Integer[] arr2 = {11,12,13,14,15};
|
||||
private static final Integer[] arr3= {101,102,103,104,105};
|
||||
private static final Integer[] arr1 = {1, 2, 3, 4, 5};
|
||||
private static final Integer[] arr2 = {11, 12, 13, 14, 15};
|
||||
private static final Integer[] arr3 = {101, 102, 103, 104, 105};
|
||||
|
||||
private Iterator<Integer> iter(final Integer[] arr) {
|
||||
private static Iterator<Integer> iter(final Integer[] arr) {
|
||||
return Arrays.asList(arr).iterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
AnAction collapseAction = actionsManager.createCollapseAllAction(expander, myTree);
|
||||
collapseAction.getTemplatePresentation().setIcon(AllIcons.General.CollapseAll);
|
||||
|
||||
toolWindow.setTitleActions(new AnAction[]{new ScrollFromSourceAction(), collapseAction});
|
||||
toolWindow.setTitleActions(new ScrollFromSourceAction(), collapseAction);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -330,7 +330,7 @@ public class JavaFxArtifactPropertiesEditor extends ArtifactPropertiesEditor {
|
||||
}
|
||||
};
|
||||
|
||||
return new ListTableModel((new ColumnInfo[]{name, value}));
|
||||
return new ListTableModel(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class UpdateOutputLineConverter {
|
||||
return new ProgressEvent(file, revision, null, null, action, error, null);
|
||||
}
|
||||
|
||||
private final static Set<Character> ourActions = new HashSet<>(Arrays.asList(new Character[]{'A', 'D', 'U', 'C', 'G', 'E', 'R'}));
|
||||
private final static Set<Character> ourActions = new HashSet<>(Arrays.asList('A', 'D', 'U', 'C', 'G', 'E', 'R'));
|
||||
|
||||
@Nullable
|
||||
private ProgressEvent parseNormalString(final String line) {
|
||||
|
||||
@@ -37,5 +37,5 @@ public interface SvnServerFileKeys {
|
||||
String SSL_CLIENT_CERT_FILE = "ssl-client-cert-file";
|
||||
String SSL_CLIENT_CERT_PASSWORD = "ssl-client-cert-password";
|
||||
|
||||
List YES_OPTIONS = Arrays.asList(new String[]{"yes", "on", "true", "1"});
|
||||
List YES_OPTIONS = Arrays.asList("yes", "on", "true", "1");
|
||||
}
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ public class ManageTemplateVariablesDialog extends DialogWrapper {
|
||||
return "Whether this template variable will be hidden like password field";
|
||||
}
|
||||
};
|
||||
return new ListTableModel((new ColumnInfo[]{name, value, isShownOnFirstTab, isHidden}));
|
||||
return new ListTableModel(name, value, isShownOnFirstTab, isHidden);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,13 +24,11 @@ public class XPathHighlightingTest extends TestBase {
|
||||
super.setUp();
|
||||
new XPathSupportLoader();
|
||||
//noinspection unchecked
|
||||
myFixture.enableInspections(new Class[]{
|
||||
CheckNodeTest.class,
|
||||
ImplicitTypeConversion.class,
|
||||
RedundantTypeConversion.class,
|
||||
IndexZeroPredicate.class,
|
||||
HardwiredNamespacePrefix.class,
|
||||
});
|
||||
myFixture.enableInspections(CheckNodeTest.class,
|
||||
ImplicitTypeConversion.class,
|
||||
RedundantTypeConversion.class,
|
||||
IndexZeroPredicate.class,
|
||||
HardwiredNamespacePrefix.class);
|
||||
}
|
||||
|
||||
public void testPathTypeMismatch() {
|
||||
|
||||
@@ -131,7 +131,7 @@ public class IpnbJfxUtils {
|
||||
|
||||
final ExtDecorator decorator = new ExtDecorator();
|
||||
final Configuration.Builder builder = Configuration.builder().forceExtentedProfile()
|
||||
.registerPlugins(new Plugin[]{new YumlPlugin(), new WebSequencePlugin(), new IncludePlugin()}).setDecorator(decorator)
|
||||
.registerPlugins(new YumlPlugin(), new WebSequencePlugin(), new IncludePlugin()).setDecorator(decorator)
|
||||
.setCodeBlockEmitter(new CodeBlockEmitter());
|
||||
String processed = Processor.process(result, builder.build());
|
||||
processed = unwrapMath(processed);
|
||||
|
||||
@@ -158,9 +158,10 @@ public class PythonLexerTest extends PyLexerTestCase {
|
||||
public void _testWithKeyword() {
|
||||
// processing of 'from __future__ import' is now done on parser level, so a pure lexer test won't handle
|
||||
// this correctly
|
||||
doTest("from __future__ import with_statement\nwith x as y", new String[] { "Py:FROM_KEYWORD", "Py:SPACE", "Py:IDENTIFIER", "Py:SPACE", "Py:IMPORT_KEYWORD", "Py:SPACE", "Py:IDENTIFIER",
|
||||
doTest("from __future__ import with_statement\nwith x as y", "Py:FROM_KEYWORD", "Py:SPACE", "Py:IDENTIFIER", "Py:SPACE",
|
||||
"Py:IMPORT_KEYWORD", "Py:SPACE", "Py:IDENTIFIER",
|
||||
"Py:STATEMENT_BREAK", "Py:LINE_BREAK",
|
||||
"Py:WITH_KEYWORD", "Py:SPACE", "Py:IDENTIFIER", "Py:SPACE", "Py:AS_KEYWORD", "Py:SPACE", "Py:IDENTIFIER" });
|
||||
"Py:WITH_KEYWORD", "Py:SPACE", "Py:IDENTIFIER", "Py:SPACE", "Py:AS_KEYWORD", "Py:SPACE", "Py:IDENTIFIER");
|
||||
}
|
||||
|
||||
public void testBackslashBeforeEmptyLine() {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ProxyTest extends TestCase {
|
||||
|
||||
public void testExtendClass() throws Throwable {
|
||||
final List<String> invocations = new ArrayList<>();
|
||||
Implementation implementation = AdvancedProxy.createProxy(Implementation.class, new Class[]{Interface3.class}, new InvocationHandler(){
|
||||
Implementation implementation = AdvancedProxy.createProxy(Implementation.class, new Class[]{Interface3.class}, new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
invocations.add(method.getName());
|
||||
@@ -43,6 +43,7 @@ public class ProxyTest extends TestCase {
|
||||
return Implementation.class.getMethod("getField").invoke(proxy);
|
||||
}
|
||||
}, "239");
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
implementation.hashCode();
|
||||
implementation.method();
|
||||
assertEquals("239", implementation.getFoo());
|
||||
@@ -113,9 +114,9 @@ public class ProxyTest extends TestCase {
|
||||
|
||||
public void testAddInterfaces() {
|
||||
final BaseImpl proxy = AdvancedProxy.createProxy(BaseImpl.class, BaseIEx.class);
|
||||
assertEquals(proxy.sayA(), "a");
|
||||
assertEquals(((BaseI)proxy).sayA(), "a");
|
||||
assertEquals(((BaseIEx)proxy).sayA(), "a");
|
||||
assertEquals("a", proxy.sayA());
|
||||
assertEquals("a", ((BaseI)proxy).sayA());
|
||||
assertEquals("a", ((BaseIEx)proxy).sayA());
|
||||
}
|
||||
|
||||
public interface BaseI {
|
||||
@@ -138,24 +139,27 @@ public class ProxyTest extends TestCase {
|
||||
@Override
|
||||
public abstract String sayA();
|
||||
|
||||
public abstract static class AbstractBaseImpl extends AbstractBase {}
|
||||
public abstract static class AbstractBaseImpl extends AbstractBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testCovariantFromInterface() {
|
||||
final AbstractBase.AbstractBaseImpl proxy = AdvancedProxy.createProxy(AbstractBase.AbstractBaseImpl.class, ArrayUtil.EMPTY_CLASS_ARRAY,
|
||||
new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) {
|
||||
public Object invoke(Object proxy,
|
||||
Method method,
|
||||
Object[] args) {
|
||||
return "a";
|
||||
}
|
||||
}, false, new Object[0]);
|
||||
assertEquals(proxy.sayA(), "a");
|
||||
assertEquals(((AbstractBase)proxy).sayA(), "a");
|
||||
assertEquals(((BaseI)proxy).sayA(), "a");
|
||||
}, false, ArrayUtil.EMPTY_OBJECT_ARRAY);
|
||||
assertEquals("a", proxy.sayA());
|
||||
assertEquals("a", proxy.sayA());
|
||||
assertEquals("a", ((BaseI)proxy).sayA());
|
||||
}
|
||||
|
||||
public static class CovariantFromBaseClassTest {
|
||||
public static interface Intf {
|
||||
public interface Intf {
|
||||
String sayA();
|
||||
}
|
||||
|
||||
@@ -178,10 +182,10 @@ public class ProxyTest extends TestCase {
|
||||
public Object invoke(Object proxy, Method method, Object[] args) {
|
||||
return "a";
|
||||
}
|
||||
}, false, new Object[0]);
|
||||
assertEquals(proxy.sayA(), "a");
|
||||
assertEquals(((CovariantFromBaseClassTest.Base)proxy).sayA(), "a");
|
||||
assertEquals(((CovariantFromBaseClassTest.Intf)proxy).sayA(), "a");
|
||||
}, false, ArrayUtil.EMPTY_OBJECT_ARRAY);
|
||||
assertEquals("a", proxy.sayA());
|
||||
assertEquals("a", ((CovariantFromBaseClassTest.Base)proxy).sayA());
|
||||
assertEquals("a", ((CovariantFromBaseClassTest.Intf)proxy).sayA());
|
||||
}
|
||||
|
||||
public void testGenericMethodInvocationJava8() throws Throwable {
|
||||
@@ -205,6 +209,4 @@ public class ProxyTest extends TestCase {
|
||||
@Override
|
||||
Object foo(String t);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user