Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jamie Mansfield
asm
Commits
94c6d3c0
Commit
94c6d3c0
authored
May 05, 2018
by
Remi Forax
Browse files
add a test that create a lambda using condy
parent
01a551c4
Changes
5
Hide whitespace changes
Inline
Side-by-side
asm-test/src/main/java/org/objectweb/asm/test/AsmTest.java
View file @
94c6d3c0
...
...
@@ -131,7 +131,8 @@ public abstract class AsmTest {
JDK9_MODULE
(
"jdk9.module-info"
),
JDK11_ALL_INSTRUCTIONS
(
"jdk11.AllInstructions"
),
JDK11_ALL_STRUCTURES
(
"jdk11.AllStructures"
),
JDK11_ALL_STRUCTURES_NESTED
(
"jdk11.AllStructures$Nested"
);
JDK11_ALL_STRUCTURES_NESTED
(
"jdk11.AllStructures$Nested"
),
JDK11_LAMBDA_CONDY
(
"jdk11.LambdaCondy"
);
private
final
String
name
;
...
...
asm-test/src/main/resources/jdk11/LambdaCondy.class
0 → 100644
View file @
94c6d3c0
File added
asm-test/src/resources/java/jdk11/LambdaCondy.java
0 → 100644
View file @
94c6d3c0
// ASM: a very small and fast Java bytecode manipulation framework
// Copyright (c) 2000-2011 INRIA, France Telecom
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holders nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
package
jdk11
;
/**
* By default with jdk 11, constant lambda are compiled using constant dynamic
* The classfile was generated with the amber (branch condy-folding) compiler.
*/
public
class
LambdaCondy
{
public
static
void
main
(
String
[]
args
)
{
Runnable
r
=
()
->
System
.
out
.
println
(
"hello condy"
);
r
.
run
();
}
}
asm-util/src/test/resources/jdk11.LambdaCondy.txt
0 → 100644
View file @
94c6d3c0
// class version 55.0 (55)
// access flags 0x21
public class jdk11/LambdaCondy {
// compiled from: LambdaCondy.java
// access flags 0x19
public final static INNERCLASS java/lang/invoke/MethodHandles$Lookup java/lang/invoke/MethodHandles Lookup
// access flags 0x1
public <init>()V
L0
LINENUMBER 7 L0
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
RETURN
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x9
public static main([Ljava/lang/String;)V
L0
LINENUMBER 9 L0
LDC run : Ljava/lang/Runnable; java/lang/invoke/LambdaMetafactory.metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/Object; (6) [()V, jdk11/LambdaCondy.lambda$main$0()V (6), ()V]
ASTORE 1
L1
LINENUMBER 10 L1
ALOAD 1
INVOKEINTERFACE java/lang/Runnable.run ()V (itf)
L2
LINENUMBER 11 L2
RETURN
MAXSTACK = 1
MAXLOCALS = 2
// access flags 0x100A
private static synthetic lambda$main$0()V
L0
LINENUMBER 9 L0
GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
LDC "hello condy"
INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
RETURN
MAXSTACK = 2
MAXLOCALS = 0
}
asm/src/test/java/org/objectweb/asm/ClassReaderTest.java
View file @
94c6d3c0
...
...
@@ -285,13 +285,14 @@ public class ClassReaderTest extends AsmTest implements Opcodes {
ClassVisitor
classVisitor
=
new
EmptyClassVisitor
(
apiParameter
.
value
());
// jdk8.ArtificialStructures contains structures which require ASM5, but only inside the method
// code. Here we skip the code, so this class can be read with ASM4. Likewise for
// jdk11.AllInstructions
.
// jdk11.AllInstructions
and jdk11.LambdaCondy
assertThat
(()
->
classReader
.
accept
(
classVisitor
,
ClassReader
.
SKIP_CODE
))
.
succeedsOrThrows
(
RuntimeException
.
class
)
.
when
(
classParameter
.
isMoreRecentThan
(
apiParameter
)
&&
classParameter
!=
PrecompiledClass
.
JDK8_ARTIFICIAL_STRUCTURES
&&
classParameter
!=
PrecompiledClass
.
JDK11_ALL_INSTRUCTIONS
);
&&
classParameter
!=
PrecompiledClass
.
JDK11_ALL_INSTRUCTIONS
&&
classParameter
!=
PrecompiledClass
.
JDK11_LAMBDA_CONDY
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment