# HG changeset patch # User ppunegov # Date 1453310793 -10800 # Node ID 173b2da63cc33ca4d87d087e90f98c970bf1aa5a # Parent 1225225bd34e266831e75065d25a1a523fb2d0d4 8145800: [Testbug] CompilerControl: inline message differs for not inlined methods Summary: Create callables outside the Internal subclasses Reviewed-by: kvn diff -r 1225225bd34e -r 173b2da63cc3 hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/compilercontrol/share/pool/SubMethodHolder.java Wed Jan 20 20:26:33 2016 +0300 @@ -0,0 +1,49 @@ +package pool; + +import jdk.test.lib.Pair; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Executable; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; + +/** + * A helper class that creates executables and callables for internal classes + * It's necessary to have this class to make all helper lambdas not contain + * any of class names that could be used as a pattern (Internal*, *Klass*) + */ +public abstract class SubMethodHolder extends MethodHolder { + @Override + public List>> getAllMethods() { + List>> pairs = new ArrayList<>(); + { + Method method = getMethod(this, "method", Float.class); + Pair> pair = new Pair<>(method, + () -> method.invoke(this, 3.141592f)); + pairs.add(pair); + } + { + Method method = getMethod(this, "methodDup"); + Pair> pair = new Pair<>(method, + () -> method.invoke(this)); + pairs.add(pair); + } + { + Method method = getMethod(this, "smethod", Integer.class); + Pair> pair = new Pair<>(method, + () -> method.invoke(this, 1024)); + pairs.add(pair); + } + try { + Constructor constructor = this.getClass().getConstructor(); + Pair> pair = new Pair<>(constructor, + constructor::newInstance); + pairs.add(pair); + } catch (NoSuchMethodException e) { + throw new Error("TESTBUG: unable to get constructor"); + } + return pairs; + } +} diff -r 1225225bd34e -r 173b2da63cc3 hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java --- a/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java Mon Jan 18 17:31:14 2016 +0100 +++ b/hotspot/test/compiler/compilercontrol/share/pool/sub/Klass.java Wed Jan 20 20:26:33 2016 +0300 @@ -23,13 +23,8 @@ package pool.sub; -import jdk.test.lib.Pair; import pool.MethodHolder; - -import java.lang.reflect.Executable; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; +import pool.SubMethodHolder; /** * Simple class with methods to test signatures @@ -53,7 +48,7 @@ } // Internal class and constructor - public static class Internal extends MethodHolder { + public static class Internal extends SubMethodHolder { public Internal() { } public Double method(Float fl) { return Double.valueOf(fl); } @@ -66,27 +61,5 @@ Integer var = 1024; return arg + var; } - - @Override - public List>> getAllMethods() { - List>> pairs = new ArrayList<>(); - Pair> pair = new Pair<> - (getMethod(this, "method", Float.class), - () -> this.method(3.141592f)); - pairs.add(pair); - pair = new Pair<>(getMethod(this, "methodDup"), this::methodDup); - pairs.add(pair); - pair = new Pair<>(getMethod(this, "smethod", Integer.class), - () -> smethod(1024)); - pairs.add(pair); - try { - pair = new Pair<>(this.getClass().getConstructor(), - Internal::new); - pairs.add(pair); - } catch (NoSuchMethodException e) { - throw new Error("TESTBUG: unable to get constructor"); - } - return pairs; - } } } diff -r 1225225bd34e -r 173b2da63cc3 hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java --- a/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java Mon Jan 18 17:31:14 2016 +0100 +++ b/hotspot/test/compiler/compilercontrol/share/pool/subpack/KlassDup.java Wed Jan 20 20:26:33 2016 +0300 @@ -23,13 +23,8 @@ package pool.subpack; -import jdk.test.lib.Pair; import pool.MethodHolder; - -import java.lang.reflect.Executable; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; +import pool.SubMethodHolder; /** * This is a clone of the pool.sub.Klass used to test pattern matching @@ -54,7 +49,7 @@ } // Internal class and constructor - public static class Internal extends MethodHolder { + public static class Internal extends SubMethodHolder { public Internal() { } public Double method(Float fl) { return Double.valueOf(fl); } @@ -67,27 +62,5 @@ Integer var = 1024; return arg + var; } - - @Override - public List>> getAllMethods() { - List>> pairs = new ArrayList<>(); - Pair> pair = new Pair<> - (getMethod(this, "method", Float.class), - () -> this.method(3.141592f)); - pairs.add(pair); - pair = new Pair<>(getMethod(this, "methodDup"), this::methodDup); - pairs.add(pair); - pair = new Pair<>(getMethod(this, "smethod", Integer.class), - () -> smethod(1024)); - pairs.add(pair); - try { - pair = new Pair<>(this.getClass().getConstructor(), - Internal::new); - pairs.add(pair); - } catch (NoSuchMethodException e) { - throw new Error("TESTBUG: unable to get constructor"); - } - return pairs; - } } }