Skip to content

Commit

Permalink
8213932: [TESTBUG] assertEquals is invoked with the arguments in the …
Browse files Browse the repository at this point in the history
…wrong order

Backport-of: d98fe57
  • Loading branch information
GoeLin committed Jan 5, 2023
1 parent 1713cf1 commit dc5590f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions test/jdk/java/lang/invoke/CompileThresholdBootstrapTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -38,7 +38,7 @@ public final class CompileThresholdBootstrapTest {

@Test
public void testBootstrap() throws Throwable {
Assert.assertEquals(0, (int)MethodHandles.constant(int.class, (int)0).invokeExact());
Assert.assertEquals((int)MethodHandles.constant(int.class, (int)0).invokeExact(), 0);
}

public static void main(String ... args) {
Expand Down
10 changes: 4 additions & 6 deletions test/jdk/java/lang/invoke/ConstantIdentityMHTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -31,11 +31,9 @@

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.List;
import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*;
import static org.testng.AssertJUnit.*;
import static org.testng.Assert.*;
import org.testng.annotations.*;

public class ConstantIdentityMHTest {
Expand Down Expand Up @@ -69,9 +67,9 @@ public void testZeroNPE() {
@Test
void testEmpty() throws Throwable {
MethodHandle cat = lookup().findVirtual(String.class, "concat", methodType(String.class, String.class));
assertEquals("xy", (String)cat.invoke("x","y"));
assertEquals((String)cat.invoke("x","y"), "xy");
MethodHandle mhEmpty = MethodHandles.empty(cat.type());
assertEquals(null, (String)mhEmpty.invoke("x","y"));
assertEquals((String)mhEmpty.invoke("x","y"), null);
}

@Test(expectedExceptions = { NullPointerException.class })
Expand Down
6 changes: 3 additions & 3 deletions test/jdk/java/lang/invoke/FilterArgumentsTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -85,8 +85,8 @@ static class FilterTest {

void run(List<String> expected) throws Throwable {
filters.clear();
assertEquals("x-0-z", (String)mh.invokeExact("x", 0, 'z'));
assertEquals(expected, filters);
assertEquals((String)mh.invokeExact("x", 0, 'z'), "x-0-z");
assertEquals(filters, expected);
}

static String filterA(String s) {
Expand Down
8 changes: 4 additions & 4 deletions test/jdk/java/lang/invoke/lookup/SpecialStatic.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -26,17 +26,17 @@
* @summary JSR292: invokeSpecial: InternalError attempting to lookup a method
* @modules java.base/jdk.internal.org.objectweb.asm
* @compile -XDignore.symbol.file SpecialStatic.java
* @run junit test.java.lang.invoke.lookup.SpecialStatic
* @run testng test.java.lang.invoke.lookup.SpecialStatic
*/
package test.java.lang.invoke.lookup;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import jdk.internal.org.objectweb.asm.*;
import org.junit.Test;
import org.testng.annotations.*;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
import static org.junit.Assert.*;
import static org.testng.Assert.*;

/**
* Test case:
Expand Down

1 comment on commit dc5590f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.