Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetInterfaces test in TestClassUtil.java appears to be checking interfaces of Java builtins? #369

Closed
josh-thisisbud opened this issue Sep 29, 2023 · 4 comments · Fixed by #410

Comments

@josh-thisisbud
Copy link

I just want to prefix all of this with I know very little about Java, and I'm only building this tool because I'd like to use it to benchmark, having pre-compiled versions would be really handy.

I modified the test to:

    /**
     * GetInterfaces
     */
    @Test
    public void testGetInterfaces() {
        Class<?>[] expected = {
                Serializable.class,
                Cloneable.class,
                Iterable.class,
                Collection.class,
                List.class,
                RandomAccess.class,
        };
        Collection<Class<?>> results = ClassUtil.getInterfaces(target_class);
        // System.err.println(target_class + " => " + results);
        assert (!results.isEmpty());
        assertEquals(String.format("Target class was %s", target_class), expected.length, results.size());

        for (Class<?> e : expected) {
            assert (results.contains(e));
        } // FOR
    }

This resulted in output of

testGetInterfaces(com.oltpbenchmark.util.TestClassUtil)  Time elapsed: 0.003 sec  <<< FAILURE!
java.lang.AssertionError: Target class was class java.util.ArrayList expected:<6> but was:<7>
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.failNotEquals(Assert.java:835)
        at org.junit.Assert.assertEquals(Assert.java:647)
        at com.oltpbenchmark.util.TestClassUtil.testGetInterfaces(TestClassUtil.java:130)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
@superctj
Copy link

superctj commented Nov 7, 2023

hi @josh-thisisbud, did you solve this issue? I have the same error when building benchbase with the Microsoft build of openjdk 21 without modifying anything.

@josh-thisisbud
Copy link
Author

I removed the problematic test and compiled that way

@superctj
Copy link

superctj commented Nov 7, 2023

Thank you for the quick response! Same here. Not familiar with Java and ended up commenting out the test.

@bpkroth bpkroth linked a pull request Dec 8, 2023 that will close this issue
bpkroth added a commit that referenced this issue Dec 13, 2023
Separates a conversion to Java 21 from #398 and also handles errors
encountered in #369.
@bpkroth
Copy link
Collaborator

bpkroth commented Dec 14, 2023

FYI, this should be fixed now. Let us know how it goes. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants